[Lldb-commits] [lldb] r280751 - *** This commit represents a complete reformatting of the LLDB source code
Kate Stone via lldb-commits
lldb-commits at lists.llvm.org
Tue Sep 6 13:58:36 PDT 2016
Modified: lldb/trunk/include/lldb/Interpreter/OptionGroupFile.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Interpreter/OptionGroupFile.h?rev=280751&r1=280750&r2=280751&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Interpreter/OptionGroupFile.h (original)
+++ lldb/trunk/include/lldb/Interpreter/OptionGroupFile.h Tue Sep 6 15:57:50 2016
@@ -14,9 +14,9 @@
// C++ Includes
// Other libraries and framework includes
// Project includes
-#include "lldb/Interpreter/Options.h"
#include "lldb/Interpreter/OptionValueFileSpec.h"
#include "lldb/Interpreter/OptionValueFileSpecList.h"
+#include "lldb/Interpreter/Options.h"
namespace lldb_private {
@@ -24,109 +24,67 @@ namespace lldb_private {
// OptionGroupFile
//-------------------------------------------------------------------------
-class OptionGroupFile : public OptionGroup
-{
+class OptionGroupFile : public OptionGroup {
public:
- OptionGroupFile (uint32_t usage_mask,
- bool required,
- const char *long_option,
- int short_option,
- uint32_t completion_type,
- lldb::CommandArgumentType argument_type,
- const char *usage_text);
-
- ~OptionGroupFile() override;
-
- uint32_t
- GetNumDefinitions() override
- {
- return 1;
- }
-
- const OptionDefinition*
- GetDefinitions() override
- {
- return &m_option_definition;
- }
-
- Error
- SetOptionValue(uint32_t option_idx,
- const char *option_value,
- ExecutionContext *execution_context) override;
-
- void
- OptionParsingStarting(ExecutionContext *execution_context) override;
-
- OptionValueFileSpec &
- GetOptionValue ()
- {
- return m_file;
- }
-
- const OptionValueFileSpec &
- GetOptionValue () const
- {
- return m_file;
- }
+ OptionGroupFile(uint32_t usage_mask, bool required, const char *long_option,
+ int short_option, uint32_t completion_type,
+ lldb::CommandArgumentType argument_type,
+ const char *usage_text);
+
+ ~OptionGroupFile() override;
+
+ uint32_t GetNumDefinitions() override { return 1; }
+
+ const OptionDefinition *GetDefinitions() override {
+ return &m_option_definition;
+ }
+
+ Error SetOptionValue(uint32_t option_idx, const char *option_value,
+ ExecutionContext *execution_context) override;
+
+ void OptionParsingStarting(ExecutionContext *execution_context) override;
+
+ OptionValueFileSpec &GetOptionValue() { return m_file; }
+
+ const OptionValueFileSpec &GetOptionValue() const { return m_file; }
protected:
- OptionValueFileSpec m_file;
- OptionDefinition m_option_definition;
+ OptionValueFileSpec m_file;
+ OptionDefinition m_option_definition;
};
//-------------------------------------------------------------------------
// OptionGroupFileList
//-------------------------------------------------------------------------
-class OptionGroupFileList : public OptionGroup
-{
+class OptionGroupFileList : public OptionGroup {
public:
-
- OptionGroupFileList (uint32_t usage_mask,
- bool required,
- const char *long_option,
- int short_option,
- uint32_t completion_type,
- lldb::CommandArgumentType argument_type,
- const char *usage_text);
-
- ~OptionGroupFileList() override;
-
- uint32_t
- GetNumDefinitions() override
- {
- return 1;
- }
-
- const OptionDefinition*
- GetDefinitions() override
- {
- return &m_option_definition;
- }
-
- Error
- SetOptionValue(uint32_t option_idx,
- const char *option_value,
- ExecutionContext *execution_context) override;
-
- void
- OptionParsingStarting(ExecutionContext *execution_context) override;
-
- OptionValueFileSpecList &
- GetOptionValue ()
- {
- return m_file_list;
- }
-
- const OptionValueFileSpecList &
- GetOptionValue () const
- {
- return m_file_list;
- }
-
+ OptionGroupFileList(uint32_t usage_mask, bool required,
+ const char *long_option, int short_option,
+ uint32_t completion_type,
+ lldb::CommandArgumentType argument_type,
+ const char *usage_text);
+
+ ~OptionGroupFileList() override;
+
+ uint32_t GetNumDefinitions() override { return 1; }
+
+ const OptionDefinition *GetDefinitions() override {
+ return &m_option_definition;
+ }
+
+ Error SetOptionValue(uint32_t option_idx, const char *option_value,
+ ExecutionContext *execution_context) override;
+
+ void OptionParsingStarting(ExecutionContext *execution_context) override;
+
+ OptionValueFileSpecList &GetOptionValue() { return m_file_list; }
+
+ const OptionValueFileSpecList &GetOptionValue() const { return m_file_list; }
+
protected:
- OptionValueFileSpecList m_file_list;
- OptionDefinition m_option_definition;
+ OptionValueFileSpecList m_file_list;
+ OptionDefinition m_option_definition;
};
} // namespace lldb_private
Modified: lldb/trunk/include/lldb/Interpreter/OptionGroupFormat.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Interpreter/OptionGroupFormat.h?rev=280751&r1=280750&r2=280751&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Interpreter/OptionGroupFormat.h (original)
+++ lldb/trunk/include/lldb/Interpreter/OptionGroupFormat.h Tue Sep 6 15:57:50 2016
@@ -14,10 +14,10 @@
// C++ Includes
// Other libraries and framework includes
// Project includes
-#include "lldb/Interpreter/Options.h"
#include "lldb/Interpreter/OptionValueFormat.h"
#include "lldb/Interpreter/OptionValueSInt64.h"
#include "lldb/Interpreter/OptionValueUInt64.h"
+#include "lldb/Interpreter/Options.h"
namespace lldb_private {
@@ -25,103 +25,63 @@ namespace lldb_private {
// OptionGroupFormat
//-------------------------------------------------------------------------
-class OptionGroupFormat : public OptionGroup
-{
+class OptionGroupFormat : public OptionGroup {
public:
- static const uint32_t OPTION_GROUP_FORMAT = LLDB_OPT_SET_1;
- static const uint32_t OPTION_GROUP_GDB_FMT = LLDB_OPT_SET_2;
- static const uint32_t OPTION_GROUP_SIZE = LLDB_OPT_SET_3;
- static const uint32_t OPTION_GROUP_COUNT = LLDB_OPT_SET_4;
-
- OptionGroupFormat (lldb::Format default_format,
- uint64_t default_byte_size = UINT64_MAX, // Pass UINT64_MAX to disable the "--size" option
- uint64_t default_count = UINT64_MAX); // Pass UINT64_MAX to disable the "--count" option
-
- ~OptionGroupFormat() override;
-
- uint32_t
- GetNumDefinitions() override;
-
- const OptionDefinition*
- GetDefinitions() override;
-
- Error
- SetOptionValue(uint32_t option_idx,
- const char *option_value,
- ExecutionContext *execution_context) override;
-
- void
- OptionParsingStarting(ExecutionContext *execution_context) override;
-
- lldb::Format
- GetFormat () const
- {
- return m_format.GetCurrentValue();
- }
-
- OptionValueFormat &
- GetFormatValue()
- {
- return m_format;
- }
-
- const OptionValueFormat &
- GetFormatValue() const
- {
- return m_format;
- }
-
- OptionValueUInt64 &
- GetByteSizeValue()
- {
- return m_byte_size;
- }
-
- const OptionValueUInt64 &
- GetByteSizeValue() const
- {
- return m_byte_size;
- }
-
- OptionValueUInt64 &
- GetCountValue()
- {
- return m_count;
- }
-
- const OptionValueUInt64 &
- GetCountValue() const
- {
- return m_count;
- }
-
- bool
- HasGDBFormat () const
- {
- return m_has_gdb_format;
- }
-
- bool
- AnyOptionWasSet () const
- {
- return m_format.OptionWasSet() ||
- m_byte_size.OptionWasSet() ||
- m_count.OptionWasSet();
- }
+ static const uint32_t OPTION_GROUP_FORMAT = LLDB_OPT_SET_1;
+ static const uint32_t OPTION_GROUP_GDB_FMT = LLDB_OPT_SET_2;
+ static const uint32_t OPTION_GROUP_SIZE = LLDB_OPT_SET_3;
+ static const uint32_t OPTION_GROUP_COUNT = LLDB_OPT_SET_4;
+
+ OptionGroupFormat(
+ lldb::Format default_format,
+ uint64_t default_byte_size =
+ UINT64_MAX, // Pass UINT64_MAX to disable the "--size" option
+ uint64_t default_count =
+ UINT64_MAX); // Pass UINT64_MAX to disable the "--count" option
+
+ ~OptionGroupFormat() override;
+
+ uint32_t GetNumDefinitions() override;
+
+ const OptionDefinition *GetDefinitions() override;
+
+ Error SetOptionValue(uint32_t option_idx, const char *option_value,
+ ExecutionContext *execution_context) override;
+
+ void OptionParsingStarting(ExecutionContext *execution_context) override;
+
+ lldb::Format GetFormat() const { return m_format.GetCurrentValue(); }
+
+ OptionValueFormat &GetFormatValue() { return m_format; }
+
+ const OptionValueFormat &GetFormatValue() const { return m_format; }
+
+ OptionValueUInt64 &GetByteSizeValue() { return m_byte_size; }
+
+ const OptionValueUInt64 &GetByteSizeValue() const { return m_byte_size; }
+
+ OptionValueUInt64 &GetCountValue() { return m_count; }
+
+ const OptionValueUInt64 &GetCountValue() const { return m_count; }
+
+ bool HasGDBFormat() const { return m_has_gdb_format; }
+
+ bool AnyOptionWasSet() const {
+ return m_format.OptionWasSet() || m_byte_size.OptionWasSet() ||
+ m_count.OptionWasSet();
+ }
protected:
- bool
- ParserGDBFormatLetter (ExecutionContext *execution_context,
- char format_letter,
- lldb::Format &format,
- uint32_t &byte_size);
-
- OptionValueFormat m_format;
- OptionValueUInt64 m_byte_size;
- OptionValueUInt64 m_count;
- char m_prev_gdb_format;
- char m_prev_gdb_size;
- bool m_has_gdb_format;
+ bool ParserGDBFormatLetter(ExecutionContext *execution_context,
+ char format_letter, lldb::Format &format,
+ uint32_t &byte_size);
+
+ OptionValueFormat m_format;
+ OptionValueUInt64 m_byte_size;
+ OptionValueUInt64 m_count;
+ char m_prev_gdb_format;
+ char m_prev_gdb_size;
+ bool m_has_gdb_format;
};
} // namespace lldb_private
Modified: lldb/trunk/include/lldb/Interpreter/OptionGroupOutputFile.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Interpreter/OptionGroupOutputFile.h?rev=280751&r1=280750&r2=280751&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Interpreter/OptionGroupOutputFile.h (original)
+++ lldb/trunk/include/lldb/Interpreter/OptionGroupOutputFile.h Tue Sep 6 15:57:50 2016
@@ -14,57 +14,41 @@
// C++ Includes
// Other libraries and framework includes
// Project includes
-#include "lldb/Interpreter/Options.h"
#include "lldb/Interpreter/OptionValueBoolean.h"
#include "lldb/Interpreter/OptionValueFileSpec.h"
+#include "lldb/Interpreter/Options.h"
namespace lldb_private {
//-------------------------------------------------------------------------
// OptionGroupOutputFile
//-------------------------------------------------------------------------
-class OptionGroupOutputFile : public OptionGroup
-{
+class OptionGroupOutputFile : public OptionGroup {
public:
- OptionGroupOutputFile ();
-
- ~OptionGroupOutputFile() override;
-
- uint32_t
- GetNumDefinitions() override;
-
- const OptionDefinition*
- GetDefinitions() override;
-
- Error
- SetOptionValue(uint32_t option_idx,
- const char *option_value,
- ExecutionContext *execution_context) override;
-
- void
- OptionParsingStarting(ExecutionContext *execution_context) override;
-
- const OptionValueFileSpec &
- GetFile ()
- {
- return m_file;
- }
-
- const OptionValueBoolean &
- GetAppend ()
- {
- return m_append;
- }
-
- bool
- AnyOptionWasSet () const
- {
- return m_file.OptionWasSet() || m_append.OptionWasSet();
- }
+ OptionGroupOutputFile();
+
+ ~OptionGroupOutputFile() override;
+
+ uint32_t GetNumDefinitions() override;
+
+ const OptionDefinition *GetDefinitions() override;
+
+ Error SetOptionValue(uint32_t option_idx, const char *option_value,
+ ExecutionContext *execution_context) override;
+
+ void OptionParsingStarting(ExecutionContext *execution_context) override;
+
+ const OptionValueFileSpec &GetFile() { return m_file; }
+
+ const OptionValueBoolean &GetAppend() { return m_append; }
+
+ bool AnyOptionWasSet() const {
+ return m_file.OptionWasSet() || m_append.OptionWasSet();
+ }
protected:
- OptionValueFileSpec m_file;
- OptionValueBoolean m_append;
+ OptionValueFileSpec m_file;
+ OptionValueBoolean m_append;
};
} // namespace lldb_private
Modified: lldb/trunk/include/lldb/Interpreter/OptionGroupPlatform.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Interpreter/OptionGroupPlatform.h?rev=280751&r1=280750&r2=280751&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Interpreter/OptionGroupPlatform.h (original)
+++ lldb/trunk/include/lldb/Interpreter/OptionGroupPlatform.h Tue Sep 6 15:57:50 2016
@@ -24,93 +24,59 @@ namespace lldb_private {
//
// Make platform options available to any commands that need the settings.
//-------------------------------------------------------------------------
-class OptionGroupPlatform : public OptionGroup
-{
+class OptionGroupPlatform : public OptionGroup {
public:
- OptionGroupPlatform (bool include_platform_option) :
- OptionGroup(),
- m_platform_name (),
- m_sdk_sysroot (),
- m_os_version_major (UINT32_MAX),
- m_os_version_minor (UINT32_MAX),
- m_os_version_update (UINT32_MAX),
- m_include_platform_option (include_platform_option)
- {
- }
-
- ~OptionGroupPlatform() override = default;
-
- uint32_t
- GetNumDefinitions() override;
-
- const OptionDefinition*
- GetDefinitions() override;
-
- Error
- SetOptionValue(uint32_t option_idx,
- const char *option_value,
- ExecutionContext *execution_context) override;
-
- void
- OptionParsingStarting(ExecutionContext *execution_context) override;
-
- lldb::PlatformSP
- CreatePlatformWithOptions (CommandInterpreter &interpreter,
- const ArchSpec &arch,
- bool make_selected,
- Error& error,
- ArchSpec &platform_arch) const;
-
- bool
- PlatformWasSpecified () const
- {
- return !m_platform_name.empty();
- }
-
- void
- SetPlatformName (const char *platform_name)
- {
- if (platform_name && platform_name[0])
- m_platform_name.assign (platform_name);
- else
- m_platform_name.clear();
- }
-
- const ConstString &
- GetSDKRootDirectory () const
- {
- return m_sdk_sysroot;
- }
-
- void
- SetSDKRootDirectory (const ConstString &sdk_root_directory)
- {
- m_sdk_sysroot = sdk_root_directory;
- }
-
- const ConstString &
- GetSDKBuild () const
- {
- return m_sdk_build;
- }
-
- void
- SetSDKBuild (const ConstString &sdk_build)
- {
- m_sdk_build = sdk_build;
- }
+ OptionGroupPlatform(bool include_platform_option)
+ : OptionGroup(), m_platform_name(), m_sdk_sysroot(),
+ m_os_version_major(UINT32_MAX), m_os_version_minor(UINT32_MAX),
+ m_os_version_update(UINT32_MAX),
+ m_include_platform_option(include_platform_option) {}
- bool
- PlatformMatches(const lldb::PlatformSP &platform_sp) const;
+ ~OptionGroupPlatform() override = default;
+
+ uint32_t GetNumDefinitions() override;
+
+ const OptionDefinition *GetDefinitions() override;
+
+ Error SetOptionValue(uint32_t option_idx, const char *option_value,
+ ExecutionContext *execution_context) override;
+
+ void OptionParsingStarting(ExecutionContext *execution_context) override;
+
+ lldb::PlatformSP CreatePlatformWithOptions(CommandInterpreter &interpreter,
+ const ArchSpec &arch,
+ bool make_selected, Error &error,
+ ArchSpec &platform_arch) const;
+
+ bool PlatformWasSpecified() const { return !m_platform_name.empty(); }
+
+ void SetPlatformName(const char *platform_name) {
+ if (platform_name && platform_name[0])
+ m_platform_name.assign(platform_name);
+ else
+ m_platform_name.clear();
+ }
+
+ const ConstString &GetSDKRootDirectory() const { return m_sdk_sysroot; }
+
+ void SetSDKRootDirectory(const ConstString &sdk_root_directory) {
+ m_sdk_sysroot = sdk_root_directory;
+ }
+
+ const ConstString &GetSDKBuild() const { return m_sdk_build; }
+
+ void SetSDKBuild(const ConstString &sdk_build) { m_sdk_build = sdk_build; }
+
+ bool PlatformMatches(const lldb::PlatformSP &platform_sp) const;
protected:
- std::string m_platform_name;
- ConstString m_sdk_sysroot;
- ConstString m_sdk_build;
- uint32_t m_os_version_major;
- uint32_t m_os_version_minor;
- uint32_t m_os_version_update;
- bool m_include_platform_option;
+ std::string m_platform_name;
+ ConstString m_sdk_sysroot;
+ ConstString m_sdk_build;
+ uint32_t m_os_version_major;
+ uint32_t m_os_version_minor;
+ uint32_t m_os_version_update;
+ bool m_include_platform_option;
};
} // namespace lldb_private
Modified: lldb/trunk/include/lldb/Interpreter/OptionGroupString.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Interpreter/OptionGroupString.h?rev=280751&r1=280750&r2=280751&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Interpreter/OptionGroupString.h (original)
+++ lldb/trunk/include/lldb/Interpreter/OptionGroupString.h Tue Sep 6 15:57:50 2016
@@ -14,65 +14,43 @@
// C++ Includes
// Other libraries and framework includes
// Project includes
-#include "lldb/Interpreter/Options.h"
#include "lldb/Interpreter/OptionValueString.h"
+#include "lldb/Interpreter/Options.h"
namespace lldb_private {
- //-------------------------------------------------------------------------
- // OptionGroupString
- //-------------------------------------------------------------------------
-
- class OptionGroupString : public OptionGroup
- {
- public:
- OptionGroupString (uint32_t usage_mask,
- bool required,
- const char *long_option,
- int short_option,
- uint32_t completion_type,
- lldb::CommandArgumentType argument_type,
- const char *usage_text,
- const char *default_value);
-
- ~OptionGroupString() override;
-
- uint32_t
- GetNumDefinitions() override
- {
- return 1;
- }
-
- const OptionDefinition*
- GetDefinitions() override
- {
- return &m_option_definition;
- }
-
- Error
- SetOptionValue(uint32_t option_idx,
- const char *option_value,
+//-------------------------------------------------------------------------
+// OptionGroupString
+//-------------------------------------------------------------------------
+
+class OptionGroupString : public OptionGroup {
+public:
+ OptionGroupString(uint32_t usage_mask, bool required, const char *long_option,
+ int short_option, uint32_t completion_type,
+ lldb::CommandArgumentType argument_type,
+ const char *usage_text, const char *default_value);
+
+ ~OptionGroupString() override;
+
+ uint32_t GetNumDefinitions() override { return 1; }
+
+ const OptionDefinition *GetDefinitions() override {
+ return &m_option_definition;
+ }
+
+ Error SetOptionValue(uint32_t option_idx, const char *option_value,
ExecutionContext *execution_context) override;
-
- void
- OptionParsingStarting(ExecutionContext *execution_context) override;
-
- OptionValueString &
- GetOptionValue ()
- {
- return m_value;
- }
-
- const OptionValueString &
- GetOptionValue () const
- {
- return m_value;
- }
-
- protected:
- OptionValueString m_value;
- OptionDefinition m_option_definition;
- };
-
+
+ void OptionParsingStarting(ExecutionContext *execution_context) override;
+
+ OptionValueString &GetOptionValue() { return m_value; }
+
+ const OptionValueString &GetOptionValue() const { return m_value; }
+
+protected:
+ OptionValueString m_value;
+ OptionDefinition m_option_definition;
+};
+
} // namespace lldb_private
#endif // liblldb_OptionGroupString_h_
Modified: lldb/trunk/include/lldb/Interpreter/OptionGroupUInt64.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Interpreter/OptionGroupUInt64.h?rev=280751&r1=280750&r2=280751&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Interpreter/OptionGroupUInt64.h (original)
+++ lldb/trunk/include/lldb/Interpreter/OptionGroupUInt64.h Tue Sep 6 15:57:50 2016
@@ -14,66 +14,44 @@
// C++ Includes
// Other libraries and framework includes
// Project includes
-#include "lldb/Interpreter/Options.h"
#include "lldb/Interpreter/OptionValueUInt64.h"
+#include "lldb/Interpreter/Options.h"
namespace lldb_private {
- //-------------------------------------------------------------------------
- // OptionGroupUInt64
- //-------------------------------------------------------------------------
-
- class OptionGroupUInt64 : public OptionGroup
- {
- public:
- OptionGroupUInt64 (uint32_t usage_mask,
- bool required,
- const char *long_option,
- int short_option,
- uint32_t completion_type,
- lldb::CommandArgumentType argument_type,
- const char *usage_text,
- uint64_t default_value);
-
- ~OptionGroupUInt64() override;
-
- uint32_t
- GetNumDefinitions() override
- {
- return 1;
- }
-
- const OptionDefinition*
- GetDefinitions() override
- {
- return &m_option_definition;
- }
-
- Error
- SetOptionValue(uint32_t option_idx,
- const char *option_value,
+//-------------------------------------------------------------------------
+// OptionGroupUInt64
+//-------------------------------------------------------------------------
+
+class OptionGroupUInt64 : public OptionGroup {
+public:
+ OptionGroupUInt64(uint32_t usage_mask, bool required, const char *long_option,
+ int short_option, uint32_t completion_type,
+ lldb::CommandArgumentType argument_type,
+ const char *usage_text, uint64_t default_value);
+
+ ~OptionGroupUInt64() override;
+
+ uint32_t GetNumDefinitions() override { return 1; }
+
+ const OptionDefinition *GetDefinitions() override {
+ return &m_option_definition;
+ }
+
+ Error SetOptionValue(uint32_t option_idx, const char *option_value,
ExecutionContext *execution_context) override;
-
- void
- OptionParsingStarting(ExecutionContext *execution_context) override;
-
- OptionValueUInt64 &
- GetOptionValue ()
- {
- return m_value;
- }
-
- const OptionValueUInt64 &
- GetOptionValue () const
- {
- return m_value;
- }
-
- protected:
- OptionValueUInt64 m_value;
- OptionDefinition m_option_definition;
- };
-
+
+ void OptionParsingStarting(ExecutionContext *execution_context) override;
+
+ OptionValueUInt64 &GetOptionValue() { return m_value; }
+
+ const OptionValueUInt64 &GetOptionValue() const { return m_value; }
+
+protected:
+ OptionValueUInt64 m_value;
+ OptionDefinition m_option_definition;
+};
+
} // namespace lldb_private
#endif // liblldb_OptionGroupUInt64_h_
Modified: lldb/trunk/include/lldb/Interpreter/OptionGroupUUID.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Interpreter/OptionGroupUUID.h?rev=280751&r1=280750&r2=280751&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Interpreter/OptionGroupUUID.h (original)
+++ lldb/trunk/include/lldb/Interpreter/OptionGroupUUID.h Tue Sep 6 15:57:50 2016
@@ -14,8 +14,8 @@
// C++ Includes
// Other libraries and framework includes
// Project includes
-#include "lldb/Interpreter/Options.h"
#include "lldb/Interpreter/OptionValueUUID.h"
+#include "lldb/Interpreter/Options.h"
namespace lldb_private {
@@ -23,35 +23,25 @@ namespace lldb_private {
// OptionGroupUUID
//-------------------------------------------------------------------------
-class OptionGroupUUID : public OptionGroup
-{
+class OptionGroupUUID : public OptionGroup {
public:
- OptionGroupUUID ();
-
- ~OptionGroupUUID() override;
-
- uint32_t
- GetNumDefinitions() override;
-
- const OptionDefinition*
- GetDefinitions() override;
-
- Error
- SetOptionValue(uint32_t option_idx,
- const char *option_value,
- ExecutionContext *execution_context) override;
-
- void
- OptionParsingStarting(ExecutionContext *execution_context) override;
-
- const OptionValueUUID &
- GetOptionValue () const
- {
- return m_uuid;
- }
+ OptionGroupUUID();
+
+ ~OptionGroupUUID() override;
+
+ uint32_t GetNumDefinitions() override;
+
+ const OptionDefinition *GetDefinitions() override;
+
+ Error SetOptionValue(uint32_t option_idx, const char *option_value,
+ ExecutionContext *execution_context) override;
+
+ void OptionParsingStarting(ExecutionContext *execution_context) override;
+
+ const OptionValueUUID &GetOptionValue() const { return m_uuid; }
protected:
- OptionValueUUID m_uuid;
+ OptionValueUUID m_uuid;
};
} // namespace lldb_private
Modified: lldb/trunk/include/lldb/Interpreter/OptionGroupValueObjectDisplay.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Interpreter/OptionGroupValueObjectDisplay.h?rev=280751&r1=280750&r2=280751&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Interpreter/OptionGroupValueObjectDisplay.h (original)
+++ lldb/trunk/include/lldb/Interpreter/OptionGroupValueObjectDisplay.h Tue Sep 6 15:57:50 2016
@@ -23,62 +23,42 @@ namespace lldb_private {
// OptionGroupValueObjectDisplay
//-------------------------------------------------------------------------
-class OptionGroupValueObjectDisplay : public OptionGroup
-{
+class OptionGroupValueObjectDisplay : public OptionGroup {
public:
- OptionGroupValueObjectDisplay ();
-
- ~OptionGroupValueObjectDisplay() override;
-
- uint32_t
- GetNumDefinitions() override;
-
- const OptionDefinition*
- GetDefinitions() override;
-
- Error
- SetOptionValue(uint32_t option_idx,
- const char *option_value,
- ExecutionContext *execution_context) override;
-
- void
- OptionParsingStarting(ExecutionContext *execution_context) override;
-
- bool
- AnyOptionWasSet () const
- {
- return show_types ||
- no_summary_depth != 0 ||
- show_location ||
- flat_output ||
- use_objc ||
- max_depth != UINT32_MAX ||
- ptr_depth != 0 ||
- !use_synth ||
- be_raw ||
- ignore_cap ||
- run_validator;
- }
-
- DumpValueObjectOptions
- GetAsDumpOptions (LanguageRuntimeDescriptionDisplayVerbosity lang_descr_verbosity = eLanguageRuntimeDescriptionDisplayVerbosityFull,
- lldb::Format format = lldb::eFormatDefault,
- lldb::TypeSummaryImplSP summary_sp = lldb::TypeSummaryImplSP());
-
- bool show_types : 1,
- show_location : 1,
- flat_output : 1,
- use_objc : 1,
- use_synth : 1,
- be_raw : 1,
- ignore_cap : 1,
- run_validator : 1;
-
- uint32_t no_summary_depth;
- uint32_t max_depth;
- uint32_t ptr_depth;
- uint32_t elem_count;
- lldb::DynamicValueType use_dynamic;
+ OptionGroupValueObjectDisplay();
+
+ ~OptionGroupValueObjectDisplay() override;
+
+ uint32_t GetNumDefinitions() override;
+
+ const OptionDefinition *GetDefinitions() override;
+
+ Error SetOptionValue(uint32_t option_idx, const char *option_value,
+ ExecutionContext *execution_context) override;
+
+ void OptionParsingStarting(ExecutionContext *execution_context) override;
+
+ bool AnyOptionWasSet() const {
+ return show_types || no_summary_depth != 0 || show_location ||
+ flat_output || use_objc || max_depth != UINT32_MAX ||
+ ptr_depth != 0 || !use_synth || be_raw || ignore_cap ||
+ run_validator;
+ }
+
+ DumpValueObjectOptions GetAsDumpOptions(
+ LanguageRuntimeDescriptionDisplayVerbosity lang_descr_verbosity =
+ eLanguageRuntimeDescriptionDisplayVerbosityFull,
+ lldb::Format format = lldb::eFormatDefault,
+ lldb::TypeSummaryImplSP summary_sp = lldb::TypeSummaryImplSP());
+
+ bool show_types : 1, show_location : 1, flat_output : 1, use_objc : 1,
+ use_synth : 1, be_raw : 1, ignore_cap : 1, run_validator : 1;
+
+ uint32_t no_summary_depth;
+ uint32_t max_depth;
+ uint32_t ptr_depth;
+ uint32_t elem_count;
+ lldb::DynamicValueType use_dynamic;
};
} // namespace lldb_private
Modified: lldb/trunk/include/lldb/Interpreter/OptionGroupVariable.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Interpreter/OptionGroupVariable.h?rev=280751&r1=280750&r2=280751&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Interpreter/OptionGroupVariable.h (original)
+++ lldb/trunk/include/lldb/Interpreter/OptionGroupVariable.h Tue Sep 6 15:57:50 2016
@@ -23,41 +23,33 @@ namespace lldb_private {
// OptionGroupVariable
//-------------------------------------------------------------------------
- class OptionGroupVariable : public OptionGroup
- {
- public:
- OptionGroupVariable (bool show_frame_options);
-
- ~OptionGroupVariable() override;
-
- uint32_t
- GetNumDefinitions() override;
-
- const OptionDefinition*
- GetDefinitions() override;
-
- Error
- SetOptionValue(uint32_t option_idx,
- const char *option_arg,
+class OptionGroupVariable : public OptionGroup {
+public:
+ OptionGroupVariable(bool show_frame_options);
+
+ ~OptionGroupVariable() override;
+
+ uint32_t GetNumDefinitions() override;
+
+ const OptionDefinition *GetDefinitions() override;
+
+ Error SetOptionValue(uint32_t option_idx, const char *option_arg,
ExecutionContext *execution_context) override;
-
- void
- OptionParsingStarting(ExecutionContext *execution_context) override;
-
- bool include_frame_options:1,
- show_args:1, // Frame option only (include_frame_options == true)
- show_locals:1, // Frame option only (include_frame_options == true)
- show_globals:1, // Frame option only (include_frame_options == true)
- use_regex:1,
- show_scope:1,
- show_decl:1;
- OptionValueString summary; // the name of a named summary
- OptionValueString summary_string; // a summary string
-
- private:
- DISALLOW_COPY_AND_ASSIGN(OptionGroupVariable);
- };
-
+
+ void OptionParsingStarting(ExecutionContext *execution_context) override;
+
+ bool include_frame_options : 1,
+ show_args : 1, // Frame option only (include_frame_options == true)
+ show_locals : 1, // Frame option only (include_frame_options == true)
+ show_globals : 1, // Frame option only (include_frame_options == true)
+ use_regex : 1, show_scope : 1, show_decl : 1;
+ OptionValueString summary; // the name of a named summary
+ OptionValueString summary_string; // a summary string
+
+private:
+ DISALLOW_COPY_AND_ASSIGN(OptionGroupVariable);
+};
+
} // namespace lldb_private
#endif // liblldb_OptionGroupVariable_h_
Modified: lldb/trunk/include/lldb/Interpreter/OptionGroupWatchpoint.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Interpreter/OptionGroupWatchpoint.h?rev=280751&r1=280750&r2=280751&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Interpreter/OptionGroupWatchpoint.h (original)
+++ lldb/trunk/include/lldb/Interpreter/OptionGroupWatchpoint.h Tue Sep 6 15:57:50 2016
@@ -22,48 +22,41 @@ namespace lldb_private {
// OptionGroupWatchpoint
//-------------------------------------------------------------------------
- class OptionGroupWatchpoint : public OptionGroup
- {
- public:
- OptionGroupWatchpoint ();
-
- ~OptionGroupWatchpoint() override;
-
- static bool
- IsWatchSizeSupported(uint32_t watch_size);
-
- uint32_t
- GetNumDefinitions() override;
-
- const OptionDefinition*
- GetDefinitions() override;
-
- Error
- SetOptionValue(uint32_t option_idx,
- const char *option_arg,
+class OptionGroupWatchpoint : public OptionGroup {
+public:
+ OptionGroupWatchpoint();
+
+ ~OptionGroupWatchpoint() override;
+
+ static bool IsWatchSizeSupported(uint32_t watch_size);
+
+ uint32_t GetNumDefinitions() override;
+
+ const OptionDefinition *GetDefinitions() override;
+
+ Error SetOptionValue(uint32_t option_idx, const char *option_arg,
ExecutionContext *execution_context) override;
-
- void
- OptionParsingStarting(ExecutionContext *execution_context) override;
-
- // Note:
- // eWatchRead == LLDB_WATCH_TYPE_READ; and
- // eWatchWrite == LLDB_WATCH_TYPE_WRITE
- typedef enum WatchType {
- eWatchInvalid = 0,
- eWatchRead,
- eWatchWrite,
- eWatchReadWrite
- } WatchType;
-
- WatchType watch_type;
- uint32_t watch_size;
- bool watch_type_specified;
-
- private:
- DISALLOW_COPY_AND_ASSIGN(OptionGroupWatchpoint);
- };
-
+
+ void OptionParsingStarting(ExecutionContext *execution_context) override;
+
+ // Note:
+ // eWatchRead == LLDB_WATCH_TYPE_READ; and
+ // eWatchWrite == LLDB_WATCH_TYPE_WRITE
+ typedef enum WatchType {
+ eWatchInvalid = 0,
+ eWatchRead,
+ eWatchWrite,
+ eWatchReadWrite
+ } WatchType;
+
+ WatchType watch_type;
+ uint32_t watch_size;
+ bool watch_type_specified;
+
+private:
+ DISALLOW_COPY_AND_ASSIGN(OptionGroupWatchpoint);
+};
+
} // namespace lldb_private
#endif // liblldb_OptionGroupWatchpoint_h_
Modified: lldb/trunk/include/lldb/Interpreter/OptionValue.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Interpreter/OptionValue.h?rev=280751&r1=280750&r2=280751&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Interpreter/OptionValue.h (original)
+++ lldb/trunk/include/lldb/Interpreter/OptionValue.h Tue Sep 6 15:57:50 2016
@@ -14,428 +14,331 @@
// C++ Includes
// Other libraries and framework includes
// Project includes
-#include "lldb/lldb-defines.h"
#include "lldb/Core/ConstString.h"
#include "lldb/Core/Error.h"
#include "lldb/Core/FormatEntity.h"
+#include "lldb/lldb-defines.h"
namespace lldb_private {
- //---------------------------------------------------------------------
- // OptionValue
- //---------------------------------------------------------------------
- class OptionValue
- {
- public:
- typedef enum
- {
- eTypeInvalid = 0,
- eTypeArch,
- eTypeArgs,
- eTypeArray,
- eTypeBoolean,
- eTypeChar,
- eTypeDictionary,
- eTypeEnum,
- eTypeFileSpec,
- eTypeFileSpecList,
- eTypeFormat,
- eTypeLanguage,
- eTypePathMap,
- eTypeProperties,
- eTypeRegex,
- eTypeSInt64,
- eTypeString,
- eTypeUInt64,
- eTypeUUID,
- eTypeFormatEntity
- } Type;
-
- enum {
- eDumpOptionName = (1u << 0),
- eDumpOptionType = (1u << 1),
- eDumpOptionValue = (1u << 2),
- eDumpOptionDescription = (1u << 3),
- eDumpOptionRaw = (1u << 4),
- eDumpGroupValue = (eDumpOptionName | eDumpOptionType | eDumpOptionValue),
- eDumpGroupHelp = (eDumpOptionName | eDumpOptionType | eDumpOptionDescription)
- };
-
- OptionValue () :
- m_callback (nullptr),
- m_baton(nullptr),
- m_value_was_set (false)
- {
- }
-
- OptionValue (const OptionValue &rhs) :
- m_callback (rhs.m_callback),
- m_baton (rhs.m_baton),
- m_value_was_set (rhs.m_value_was_set)
- {
- }
-
- virtual ~OptionValue() = default;
-
- //-----------------------------------------------------------------
- // Subclasses should override these functions
- //-----------------------------------------------------------------
- virtual Type
- GetType () const = 0;
-
- // If this value is always hidden, the avoid showing any info on this
- // value, just show the info for the child values.
- virtual bool
- ValueIsTransparent () const
- {
- return GetType() == eTypeProperties;
- }
-
- virtual const char *
- GetTypeAsCString () const
- {
- return GetBuiltinTypeAsCString(GetType());
- }
-
- static const char *
- GetBuiltinTypeAsCString (Type t);
-
- virtual void
- DumpValue (const ExecutionContext *exe_ctx, Stream &strm, uint32_t dump_mask) = 0;
-
- virtual Error
- SetValueFromString (llvm::StringRef value, VarSetOperationType op = eVarSetOperationAssign);
-
- virtual bool
- Clear () = 0;
-
- virtual lldb::OptionValueSP
- DeepCopy () const = 0;
-
- virtual size_t
- AutoComplete (CommandInterpreter &interpreter,
- const char *s,
- int match_start_point,
- int max_return_elements,
- bool &word_complete,
- StringList &matches);
-
- //-----------------------------------------------------------------
- // Subclasses can override these functions
- //-----------------------------------------------------------------
- virtual lldb::OptionValueSP
- GetSubValue (const ExecutionContext *exe_ctx,
- const char *name,
- bool will_modify,
- Error &error) const
- {
- error.SetErrorStringWithFormat("'%s' is not a value subvalue", name);
- return lldb::OptionValueSP();
- }
-
- virtual Error
- SetSubValue (const ExecutionContext *exe_ctx,
- VarSetOperationType op,
- const char *name,
- const char *value);
-
- virtual bool
- IsAggregateValue () const
- {
- return false;
- }
-
- virtual ConstString
- GetName() const
- {
- return ConstString();
- }
-
- virtual bool
- DumpQualifiedName (Stream &strm) const;
-
- //-----------------------------------------------------------------
- // Subclasses should NOT override these functions as they use the
- // above functions to implement functionality
- //-----------------------------------------------------------------
- uint32_t
- GetTypeAsMask ()
- {
- return 1u << GetType();
- }
-
- static uint32_t
- ConvertTypeToMask (OptionValue::Type type)
- {
- return 1u << type;
- }
-
- static OptionValue::Type
- ConvertTypeMaskToType (uint32_t type_mask)
- {
- // If only one bit is set, then return an appropriate enumeration
- switch (type_mask)
- {
- case 1u << eTypeArch: return eTypeArch;
- case 1u << eTypeArgs: return eTypeArgs;
- case 1u << eTypeArray: return eTypeArray;
- case 1u << eTypeBoolean: return eTypeBoolean;
- case 1u << eTypeChar: return eTypeChar;
- case 1u << eTypeDictionary: return eTypeDictionary;
- case 1u << eTypeEnum: return eTypeEnum;
- case 1u << eTypeFileSpec: return eTypeFileSpec;
- case 1u << eTypeFileSpecList: return eTypeFileSpecList;
- case 1u << eTypeFormat: return eTypeFormat;
- case 1u << eTypeLanguage: return eTypeLanguage;
- case 1u << eTypePathMap: return eTypePathMap;
- case 1u << eTypeProperties: return eTypeProperties;
- case 1u << eTypeRegex: return eTypeRegex;
- case 1u << eTypeSInt64: return eTypeSInt64;
- case 1u << eTypeString: return eTypeString;
- case 1u << eTypeUInt64: return eTypeUInt64;
- case 1u << eTypeUUID: return eTypeUUID;
- }
- // Else return invalid
- return eTypeInvalid;
- }
-
- static lldb::OptionValueSP
- CreateValueFromCStringForTypeMask (const char *value_cstr,
- uint32_t type_mask,
- Error &error);
-
- // Get this value as a uint64_t value if it is encoded as a boolean,
- // uint64_t or int64_t. Other types will cause "fail_value" to be
- // returned
- uint64_t
- GetUInt64Value (uint64_t fail_value, bool *success_ptr);
-
- OptionValueArch *
- GetAsArch ();
-
- const OptionValueArch *
- GetAsArch () const;
-
- OptionValueArray *
- GetAsArray ();
-
- const OptionValueArray *
- GetAsArray () const;
-
- OptionValueArgs *
- GetAsArgs ();
-
- const OptionValueArgs *
- GetAsArgs () const;
-
- OptionValueBoolean *
- GetAsBoolean ();
-
- OptionValueChar *
- GetAsChar ();
-
- const OptionValueBoolean *
- GetAsBoolean () const;
-
- const OptionValueChar *
- GetAsChar () const;
-
- OptionValueDictionary *
- GetAsDictionary ();
-
- const OptionValueDictionary *
- GetAsDictionary () const;
-
- OptionValueEnumeration *
- GetAsEnumeration ();
-
- const OptionValueEnumeration *
- GetAsEnumeration () const;
-
- OptionValueFileSpec *
- GetAsFileSpec ();
-
- const OptionValueFileSpec *
- GetAsFileSpec () const;
-
- OptionValueFileSpecList *
- GetAsFileSpecList ();
-
- const OptionValueFileSpecList *
- GetAsFileSpecList () const;
-
- OptionValueFormat *
- GetAsFormat ();
-
- const OptionValueFormat *
- GetAsFormat () const;
-
- OptionValueLanguage *
- GetAsLanguage ();
-
- const OptionValueLanguage *
- GetAsLanguage () const;
-
- OptionValuePathMappings *
- GetAsPathMappings ();
-
- const OptionValuePathMappings *
- GetAsPathMappings () const;
-
- OptionValueProperties *
- GetAsProperties ();
-
- const OptionValueProperties *
- GetAsProperties () const;
-
- OptionValueRegex *
- GetAsRegex ();
-
- const OptionValueRegex *
- GetAsRegex () const;
-
- OptionValueSInt64 *
- GetAsSInt64 ();
-
- const OptionValueSInt64 *
- GetAsSInt64 () const;
-
- OptionValueString *
- GetAsString ();
-
- const OptionValueString *
- GetAsString () const;
-
- OptionValueUInt64 *
- GetAsUInt64 ();
-
- const OptionValueUInt64 *
- GetAsUInt64 () const;
-
- OptionValueUUID *
- GetAsUUID ();
-
- const OptionValueUUID *
- GetAsUUID () const;
-
- OptionValueFormatEntity *
- GetAsFormatEntity ();
-
- const OptionValueFormatEntity *
- GetAsFormatEntity () const;
-
- bool
- GetBooleanValue (bool fail_value = false) const;
-
- bool
- SetBooleanValue (bool new_value);
-
- char GetCharValue(char fail_value) const;
-
- char SetCharValue(char new_value);
-
- int64_t
- GetEnumerationValue (int64_t fail_value = -1) const;
-
- bool
- SetEnumerationValue (int64_t value);
-
- FileSpec
- GetFileSpecValue () const;
-
- bool
- SetFileSpecValue (const FileSpec &file_spec);
-
- FileSpecList
- GetFileSpecListValue () const;
-
- lldb::Format
- GetFormatValue (lldb::Format fail_value = lldb::eFormatDefault) const;
-
- bool
- SetFormatValue (lldb::Format new_value);
-
- lldb::LanguageType
- GetLanguageValue (lldb::LanguageType fail_value = lldb::eLanguageTypeUnknown) const;
-
- bool
- SetLanguageValue (lldb::LanguageType new_language);
-
- const FormatEntity::Entry *
- GetFormatEntity () const;
-
- const RegularExpression *
- GetRegexValue () const;
-
- int64_t
- GetSInt64Value (int64_t fail_value = 0) const;
-
- bool
- SetSInt64Value (int64_t new_value);
-
- const char *
- GetStringValue(const char *fail_value = nullptr) const;
-
- bool
- SetStringValue (const char *new_value);
-
- uint64_t
- GetUInt64Value (uint64_t fail_value = 0) const;
-
- bool
- SetUInt64Value (uint64_t new_value);
-
- UUID
- GetUUIDValue () const;
-
- bool
- SetUUIDValue (const UUID &uuid);
-
- bool
- OptionWasSet () const
- {
- return m_value_was_set;
- }
-
- void
- SetOptionWasSet ()
- {
- m_value_was_set = true;
- }
-
- void
- SetParent (const lldb::OptionValueSP &parent_sp)
- {
- m_parent_wp = parent_sp;
- }
-
- void
- SetValueChangedCallback (OptionValueChangedCallback callback,
- void *baton)
- {
- assert (m_callback == nullptr);
- m_callback = callback;
- m_baton = baton;
- }
-
- void
- NotifyValueChanged ()
- {
- if (m_callback)
- m_callback (m_baton, this);
- }
-
- protected:
- lldb::OptionValueWP m_parent_wp;
- OptionValueChangedCallback m_callback;
- void *m_baton;
- bool m_value_was_set; // This can be used to see if a value has been set
- // by a call to SetValueFromCString(). It is often
- // handy to know if an option value was set from
- // the command line or as a setting, versus if we
- // just have the default value that was already
- // populated in the option value.
- };
+//---------------------------------------------------------------------
+// OptionValue
+//---------------------------------------------------------------------
+class OptionValue {
+public:
+ typedef enum {
+ eTypeInvalid = 0,
+ eTypeArch,
+ eTypeArgs,
+ eTypeArray,
+ eTypeBoolean,
+ eTypeChar,
+ eTypeDictionary,
+ eTypeEnum,
+ eTypeFileSpec,
+ eTypeFileSpecList,
+ eTypeFormat,
+ eTypeLanguage,
+ eTypePathMap,
+ eTypeProperties,
+ eTypeRegex,
+ eTypeSInt64,
+ eTypeString,
+ eTypeUInt64,
+ eTypeUUID,
+ eTypeFormatEntity
+ } Type;
+
+ enum {
+ eDumpOptionName = (1u << 0),
+ eDumpOptionType = (1u << 1),
+ eDumpOptionValue = (1u << 2),
+ eDumpOptionDescription = (1u << 3),
+ eDumpOptionRaw = (1u << 4),
+ eDumpGroupValue = (eDumpOptionName | eDumpOptionType | eDumpOptionValue),
+ eDumpGroupHelp =
+ (eDumpOptionName | eDumpOptionType | eDumpOptionDescription)
+ };
+
+ OptionValue()
+ : m_callback(nullptr), m_baton(nullptr), m_value_was_set(false) {}
+
+ OptionValue(const OptionValue &rhs)
+ : m_callback(rhs.m_callback), m_baton(rhs.m_baton),
+ m_value_was_set(rhs.m_value_was_set) {}
+
+ virtual ~OptionValue() = default;
+
+ //-----------------------------------------------------------------
+ // Subclasses should override these functions
+ //-----------------------------------------------------------------
+ virtual Type GetType() const = 0;
+
+ // If this value is always hidden, the avoid showing any info on this
+ // value, just show the info for the child values.
+ virtual bool ValueIsTransparent() const {
+ return GetType() == eTypeProperties;
+ }
+
+ virtual const char *GetTypeAsCString() const {
+ return GetBuiltinTypeAsCString(GetType());
+ }
+
+ static const char *GetBuiltinTypeAsCString(Type t);
+
+ virtual void DumpValue(const ExecutionContext *exe_ctx, Stream &strm,
+ uint32_t dump_mask) = 0;
+
+ virtual Error
+ SetValueFromString(llvm::StringRef value,
+ VarSetOperationType op = eVarSetOperationAssign);
+
+ virtual bool Clear() = 0;
+
+ virtual lldb::OptionValueSP DeepCopy() const = 0;
+
+ virtual size_t AutoComplete(CommandInterpreter &interpreter, const char *s,
+ int match_start_point, int max_return_elements,
+ bool &word_complete, StringList &matches);
+
+ //-----------------------------------------------------------------
+ // Subclasses can override these functions
+ //-----------------------------------------------------------------
+ virtual lldb::OptionValueSP GetSubValue(const ExecutionContext *exe_ctx,
+ const char *name, bool will_modify,
+ Error &error) const {
+ error.SetErrorStringWithFormat("'%s' is not a value subvalue", name);
+ return lldb::OptionValueSP();
+ }
+
+ virtual Error SetSubValue(const ExecutionContext *exe_ctx,
+ VarSetOperationType op, const char *name,
+ const char *value);
+
+ virtual bool IsAggregateValue() const { return false; }
+
+ virtual ConstString GetName() const { return ConstString(); }
+
+ virtual bool DumpQualifiedName(Stream &strm) const;
+
+ //-----------------------------------------------------------------
+ // Subclasses should NOT override these functions as they use the
+ // above functions to implement functionality
+ //-----------------------------------------------------------------
+ uint32_t GetTypeAsMask() { return 1u << GetType(); }
+
+ static uint32_t ConvertTypeToMask(OptionValue::Type type) {
+ return 1u << type;
+ }
+
+ static OptionValue::Type ConvertTypeMaskToType(uint32_t type_mask) {
+ // If only one bit is set, then return an appropriate enumeration
+ switch (type_mask) {
+ case 1u << eTypeArch:
+ return eTypeArch;
+ case 1u << eTypeArgs:
+ return eTypeArgs;
+ case 1u << eTypeArray:
+ return eTypeArray;
+ case 1u << eTypeBoolean:
+ return eTypeBoolean;
+ case 1u << eTypeChar:
+ return eTypeChar;
+ case 1u << eTypeDictionary:
+ return eTypeDictionary;
+ case 1u << eTypeEnum:
+ return eTypeEnum;
+ case 1u << eTypeFileSpec:
+ return eTypeFileSpec;
+ case 1u << eTypeFileSpecList:
+ return eTypeFileSpecList;
+ case 1u << eTypeFormat:
+ return eTypeFormat;
+ case 1u << eTypeLanguage:
+ return eTypeLanguage;
+ case 1u << eTypePathMap:
+ return eTypePathMap;
+ case 1u << eTypeProperties:
+ return eTypeProperties;
+ case 1u << eTypeRegex:
+ return eTypeRegex;
+ case 1u << eTypeSInt64:
+ return eTypeSInt64;
+ case 1u << eTypeString:
+ return eTypeString;
+ case 1u << eTypeUInt64:
+ return eTypeUInt64;
+ case 1u << eTypeUUID:
+ return eTypeUUID;
+ }
+ // Else return invalid
+ return eTypeInvalid;
+ }
+
+ static lldb::OptionValueSP
+ CreateValueFromCStringForTypeMask(const char *value_cstr, uint32_t type_mask,
+ Error &error);
+
+ // Get this value as a uint64_t value if it is encoded as a boolean,
+ // uint64_t or int64_t. Other types will cause "fail_value" to be
+ // returned
+ uint64_t GetUInt64Value(uint64_t fail_value, bool *success_ptr);
+
+ OptionValueArch *GetAsArch();
+
+ const OptionValueArch *GetAsArch() const;
+
+ OptionValueArray *GetAsArray();
+
+ const OptionValueArray *GetAsArray() const;
+
+ OptionValueArgs *GetAsArgs();
+
+ const OptionValueArgs *GetAsArgs() const;
+
+ OptionValueBoolean *GetAsBoolean();
+
+ OptionValueChar *GetAsChar();
+
+ const OptionValueBoolean *GetAsBoolean() const;
+
+ const OptionValueChar *GetAsChar() const;
+
+ OptionValueDictionary *GetAsDictionary();
+
+ const OptionValueDictionary *GetAsDictionary() const;
+
+ OptionValueEnumeration *GetAsEnumeration();
+
+ const OptionValueEnumeration *GetAsEnumeration() const;
+
+ OptionValueFileSpec *GetAsFileSpec();
+
+ const OptionValueFileSpec *GetAsFileSpec() const;
+
+ OptionValueFileSpecList *GetAsFileSpecList();
+
+ const OptionValueFileSpecList *GetAsFileSpecList() const;
+
+ OptionValueFormat *GetAsFormat();
+
+ const OptionValueFormat *GetAsFormat() const;
+
+ OptionValueLanguage *GetAsLanguage();
+
+ const OptionValueLanguage *GetAsLanguage() const;
+
+ OptionValuePathMappings *GetAsPathMappings();
+
+ const OptionValuePathMappings *GetAsPathMappings() const;
+
+ OptionValueProperties *GetAsProperties();
+
+ const OptionValueProperties *GetAsProperties() const;
+
+ OptionValueRegex *GetAsRegex();
+
+ const OptionValueRegex *GetAsRegex() const;
+
+ OptionValueSInt64 *GetAsSInt64();
+
+ const OptionValueSInt64 *GetAsSInt64() const;
+
+ OptionValueString *GetAsString();
+
+ const OptionValueString *GetAsString() const;
+
+ OptionValueUInt64 *GetAsUInt64();
+
+ const OptionValueUInt64 *GetAsUInt64() const;
+
+ OptionValueUUID *GetAsUUID();
+
+ const OptionValueUUID *GetAsUUID() const;
+
+ OptionValueFormatEntity *GetAsFormatEntity();
+
+ const OptionValueFormatEntity *GetAsFormatEntity() const;
+
+ bool GetBooleanValue(bool fail_value = false) const;
+
+ bool SetBooleanValue(bool new_value);
+
+ char GetCharValue(char fail_value) const;
+
+ char SetCharValue(char new_value);
+
+ int64_t GetEnumerationValue(int64_t fail_value = -1) const;
+
+ bool SetEnumerationValue(int64_t value);
+
+ FileSpec GetFileSpecValue() const;
+
+ bool SetFileSpecValue(const FileSpec &file_spec);
+
+ FileSpecList GetFileSpecListValue() const;
+
+ lldb::Format
+ GetFormatValue(lldb::Format fail_value = lldb::eFormatDefault) const;
+
+ bool SetFormatValue(lldb::Format new_value);
+
+ lldb::LanguageType GetLanguageValue(
+ lldb::LanguageType fail_value = lldb::eLanguageTypeUnknown) const;
+
+ bool SetLanguageValue(lldb::LanguageType new_language);
+
+ const FormatEntity::Entry *GetFormatEntity() const;
+
+ const RegularExpression *GetRegexValue() const;
+
+ int64_t GetSInt64Value(int64_t fail_value = 0) const;
+
+ bool SetSInt64Value(int64_t new_value);
+
+ const char *GetStringValue(const char *fail_value = nullptr) const;
+
+ bool SetStringValue(const char *new_value);
+
+ uint64_t GetUInt64Value(uint64_t fail_value = 0) const;
+
+ bool SetUInt64Value(uint64_t new_value);
+
+ UUID GetUUIDValue() const;
+
+ bool SetUUIDValue(const UUID &uuid);
+
+ bool OptionWasSet() const { return m_value_was_set; }
+
+ void SetOptionWasSet() { m_value_was_set = true; }
+
+ void SetParent(const lldb::OptionValueSP &parent_sp) {
+ m_parent_wp = parent_sp;
+ }
+
+ void SetValueChangedCallback(OptionValueChangedCallback callback,
+ void *baton) {
+ assert(m_callback == nullptr);
+ m_callback = callback;
+ m_baton = baton;
+ }
+
+ void NotifyValueChanged() {
+ if (m_callback)
+ m_callback(m_baton, this);
+ }
+
+protected:
+ lldb::OptionValueWP m_parent_wp;
+ OptionValueChangedCallback m_callback;
+ void *m_baton;
+ bool m_value_was_set; // This can be used to see if a value has been set
+ // by a call to SetValueFromCString(). It is often
+ // handy to know if an option value was set from
+ // the command line or as a setting, versus if we
+ // just have the default value that was already
+ // populated in the option value.
+};
} // namespace lldb_private
Modified: lldb/trunk/include/lldb/Interpreter/OptionValueArch.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Interpreter/OptionValueArch.h?rev=280751&r1=280750&r2=280751&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Interpreter/OptionValueArch.h (original)
+++ lldb/trunk/include/lldb/Interpreter/OptionValueArch.h Tue Sep 6 15:57:50 2016
@@ -19,118 +19,70 @@
namespace lldb_private {
-class OptionValueArch : public OptionValue
-{
+class OptionValueArch : public OptionValue {
public:
- OptionValueArch () :
- OptionValue(),
- m_current_value (),
- m_default_value ()
- {
- }
-
- OptionValueArch (const char *triple) :
- OptionValue(),
- m_current_value (triple),
- m_default_value ()
- {
- m_default_value = m_current_value;
- }
-
- OptionValueArch (const ArchSpec &value) :
- OptionValue(),
- m_current_value (value),
- m_default_value (value)
- {
- }
-
- OptionValueArch (const ArchSpec ¤t_value,
- const ArchSpec &default_value) :
- OptionValue(),
- m_current_value (current_value),
- m_default_value (default_value)
- {
- }
-
- ~OptionValueArch() override
- {
- }
-
- //---------------------------------------------------------------------
- // Virtual subclass pure virtual overrides
- //---------------------------------------------------------------------
-
- OptionValue::Type
- GetType() const override
- {
- return eTypeArch;
- }
-
- void
- DumpValue(const ExecutionContext *exe_ctx, Stream &strm, uint32_t dump_mask) override;
-
- Error
- SetValueFromString(llvm::StringRef value,
- VarSetOperationType op = eVarSetOperationAssign) override;
-
- bool
- Clear() override
- {
- m_current_value = m_default_value;
- m_value_was_set = false;
- return true;
- }
-
- lldb::OptionValueSP
- DeepCopy() const override;
-
- size_t
- AutoComplete(CommandInterpreter &interpreter,
- const char *s,
- int match_start_point,
- int max_return_elements,
- bool &word_complete,
- StringList &matches) override;
-
- //---------------------------------------------------------------------
- // Subclass specific functions
- //---------------------------------------------------------------------
-
- ArchSpec &
- GetCurrentValue()
- {
- return m_current_value;
- }
-
- const ArchSpec &
- GetCurrentValue() const
- {
- return m_current_value;
- }
-
- const ArchSpec &
- GetDefaultValue() const
- {
- return m_default_value;
- }
-
- void
- SetCurrentValue (const ArchSpec &value, bool set_value_was_set)
- {
- m_current_value = value;
- if (set_value_was_set)
- m_value_was_set = true;
- }
-
- void
- SetDefaultValue (const ArchSpec &value)
- {
- m_default_value = value;
- }
-
+ OptionValueArch() : OptionValue(), m_current_value(), m_default_value() {}
+
+ OptionValueArch(const char *triple)
+ : OptionValue(), m_current_value(triple), m_default_value() {
+ m_default_value = m_current_value;
+ }
+
+ OptionValueArch(const ArchSpec &value)
+ : OptionValue(), m_current_value(value), m_default_value(value) {}
+
+ OptionValueArch(const ArchSpec ¤t_value, const ArchSpec &default_value)
+ : OptionValue(), m_current_value(current_value),
+ m_default_value(default_value) {}
+
+ ~OptionValueArch() override {}
+
+ //---------------------------------------------------------------------
+ // Virtual subclass pure virtual overrides
+ //---------------------------------------------------------------------
+
+ OptionValue::Type GetType() const override { return eTypeArch; }
+
+ void DumpValue(const ExecutionContext *exe_ctx, Stream &strm,
+ uint32_t dump_mask) override;
+
+ Error
+ SetValueFromString(llvm::StringRef value,
+ VarSetOperationType op = eVarSetOperationAssign) override;
+
+ bool Clear() override {
+ m_current_value = m_default_value;
+ m_value_was_set = false;
+ return true;
+ }
+
+ lldb::OptionValueSP DeepCopy() const override;
+
+ size_t AutoComplete(CommandInterpreter &interpreter, const char *s,
+ int match_start_point, int max_return_elements,
+ bool &word_complete, StringList &matches) override;
+
+ //---------------------------------------------------------------------
+ // Subclass specific functions
+ //---------------------------------------------------------------------
+
+ ArchSpec &GetCurrentValue() { return m_current_value; }
+
+ const ArchSpec &GetCurrentValue() const { return m_current_value; }
+
+ const ArchSpec &GetDefaultValue() const { return m_default_value; }
+
+ void SetCurrentValue(const ArchSpec &value, bool set_value_was_set) {
+ m_current_value = value;
+ if (set_value_was_set)
+ m_value_was_set = true;
+ }
+
+ void SetDefaultValue(const ArchSpec &value) { m_default_value = value; }
+
protected:
- ArchSpec m_current_value;
- ArchSpec m_default_value;
+ ArchSpec m_current_value;
+ ArchSpec m_default_value;
};
} // namespace lldb_private
Modified: lldb/trunk/include/lldb/Interpreter/OptionValueArgs.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Interpreter/OptionValueArgs.h?rev=280751&r1=280750&r2=280751&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Interpreter/OptionValueArgs.h (original)
+++ lldb/trunk/include/lldb/Interpreter/OptionValueArgs.h Tue Sep 6 15:57:50 2016
@@ -18,26 +18,17 @@
namespace lldb_private {
-class OptionValueArgs : public OptionValueArray
-{
+class OptionValueArgs : public OptionValueArray {
public:
- OptionValueArgs () :
- OptionValueArray (OptionValue::ConvertTypeToMask (OptionValue::eTypeString))
- {
- }
-
- ~OptionValueArgs() override
- {
- }
-
- size_t
- GetArgs (Args &args);
-
- Type
- GetType() const override
- {
- return eTypeArgs;
- }
+ OptionValueArgs()
+ : OptionValueArray(
+ OptionValue::ConvertTypeToMask(OptionValue::eTypeString)) {}
+
+ ~OptionValueArgs() override {}
+
+ size_t GetArgs(Args &args);
+
+ Type GetType() const override { return eTypeArgs; }
};
} // namespace lldb_private
Modified: lldb/trunk/include/lldb/Interpreter/OptionValueArray.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Interpreter/OptionValueArray.h?rev=280751&r1=280750&r2=280751&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Interpreter/OptionValueArray.h (original)
+++ lldb/trunk/include/lldb/Interpreter/OptionValueArray.h Tue Sep 6 15:57:50 2016
@@ -20,156 +20,113 @@
namespace lldb_private {
-class OptionValueArray : public OptionValue
-{
+class OptionValueArray : public OptionValue {
public:
- OptionValueArray (uint32_t type_mask = UINT32_MAX, bool raw_value_dump = false) :
- m_type_mask (type_mask),
- m_values (),
- m_raw_value_dump(raw_value_dump)
- {
- }
-
- ~OptionValueArray() override
- {
- }
-
- //---------------------------------------------------------------------
- // Virtual subclass pure virtual overrides
- //---------------------------------------------------------------------
-
- OptionValue::Type
- GetType() const override
- {
- return eTypeArray;
- }
-
- void
- DumpValue(const ExecutionContext *exe_ctx, Stream &strm, uint32_t dump_mask) override;
-
- Error
- SetValueFromString(llvm::StringRef value,
- VarSetOperationType op = eVarSetOperationAssign) override;
-
- bool
- Clear() override
- {
- m_values.clear();
- m_value_was_set = false;
- return true;
- }
-
- lldb::OptionValueSP
- DeepCopy() const override;
-
- bool
- IsAggregateValue() const override
- {
+ OptionValueArray(uint32_t type_mask = UINT32_MAX, bool raw_value_dump = false)
+ : m_type_mask(type_mask), m_values(), m_raw_value_dump(raw_value_dump) {}
+
+ ~OptionValueArray() override {}
+
+ //---------------------------------------------------------------------
+ // Virtual subclass pure virtual overrides
+ //---------------------------------------------------------------------
+
+ OptionValue::Type GetType() const override { return eTypeArray; }
+
+ void DumpValue(const ExecutionContext *exe_ctx, Stream &strm,
+ uint32_t dump_mask) override;
+
+ Error
+ SetValueFromString(llvm::StringRef value,
+ VarSetOperationType op = eVarSetOperationAssign) override;
+
+ bool Clear() override {
+ m_values.clear();
+ m_value_was_set = false;
+ return true;
+ }
+
+ lldb::OptionValueSP DeepCopy() const override;
+
+ bool IsAggregateValue() const override { return true; }
+
+ lldb::OptionValueSP GetSubValue(const ExecutionContext *exe_ctx,
+ const char *name, bool will_modify,
+ Error &error) const override;
+
+ //---------------------------------------------------------------------
+ // Subclass specific functions
+ //---------------------------------------------------------------------
+
+ size_t GetSize() const { return m_values.size(); }
+
+ lldb::OptionValueSP operator[](size_t idx) const {
+ lldb::OptionValueSP value_sp;
+ if (idx < m_values.size())
+ value_sp = m_values[idx];
+ return value_sp;
+ }
+
+ lldb::OptionValueSP GetValueAtIndex(size_t idx) const {
+ lldb::OptionValueSP value_sp;
+ if (idx < m_values.size())
+ value_sp = m_values[idx];
+ return value_sp;
+ }
+
+ bool AppendValue(const lldb::OptionValueSP &value_sp) {
+ // Make sure the value_sp object is allowed to contain
+ // values of the type passed in...
+ if (value_sp && (m_type_mask & value_sp->GetTypeAsMask())) {
+ m_values.push_back(value_sp);
+ return true;
+ }
+ return false;
+ }
+
+ bool InsertValue(size_t idx, const lldb::OptionValueSP &value_sp) {
+ // Make sure the value_sp object is allowed to contain
+ // values of the type passed in...
+ if (value_sp && (m_type_mask & value_sp->GetTypeAsMask())) {
+ if (idx < m_values.size())
+ m_values.insert(m_values.begin() + idx, value_sp);
+ else
+ m_values.push_back(value_sp);
+ return true;
+ }
+ return false;
+ }
+
+ bool ReplaceValue(size_t idx, const lldb::OptionValueSP &value_sp) {
+ // Make sure the value_sp object is allowed to contain
+ // values of the type passed in...
+ if (value_sp && (m_type_mask & value_sp->GetTypeAsMask())) {
+ if (idx < m_values.size()) {
+ m_values[idx] = value_sp;
return true;
+ }
}
-
- lldb::OptionValueSP
- GetSubValue(const ExecutionContext *exe_ctx,
- const char *name,
- bool will_modify,
- Error &error) const override;
-
- //---------------------------------------------------------------------
- // Subclass specific functions
- //---------------------------------------------------------------------
-
- size_t
- GetSize () const
- {
- return m_values.size();
- }
+ return false;
+ }
- lldb::OptionValueSP
- operator[](size_t idx) const
- {
- lldb::OptionValueSP value_sp;
- if (idx < m_values.size())
- value_sp = m_values[idx];
- return value_sp;
+ bool DeleteValue(size_t idx) {
+ if (idx < m_values.size()) {
+ m_values.erase(m_values.begin() + idx);
+ return true;
}
+ return false;
+ }
- lldb::OptionValueSP
- GetValueAtIndex (size_t idx) const
- {
- lldb::OptionValueSP value_sp;
- if (idx < m_values.size())
- value_sp = m_values[idx];
- return value_sp;
- }
-
- bool
- AppendValue (const lldb::OptionValueSP &value_sp)
- {
- // Make sure the value_sp object is allowed to contain
- // values of the type passed in...
- if (value_sp && (m_type_mask & value_sp->GetTypeAsMask()))
- {
- m_values.push_back(value_sp);
- return true;
- }
- return false;
- }
-
- bool
- InsertValue (size_t idx, const lldb::OptionValueSP &value_sp)
- {
- // Make sure the value_sp object is allowed to contain
- // values of the type passed in...
- if (value_sp && (m_type_mask & value_sp->GetTypeAsMask()))
- {
- if (idx < m_values.size())
- m_values.insert(m_values.begin() + idx, value_sp);
- else
- m_values.push_back(value_sp);
- return true;
- }
- return false;
- }
+ size_t GetArgs(Args &args) const;
- bool
- ReplaceValue (size_t idx, const lldb::OptionValueSP &value_sp)
- {
- // Make sure the value_sp object is allowed to contain
- // values of the type passed in...
- if (value_sp && (m_type_mask & value_sp->GetTypeAsMask()))
- {
- if (idx < m_values.size())
- {
- m_values[idx] = value_sp;
- return true;
- }
- }
- return false;
- }
+ Error SetArgs(const Args &args, VarSetOperationType op);
- bool
- DeleteValue (size_t idx)
- {
- if (idx < m_values.size())
- {
- m_values.erase (m_values.begin() + idx);
- return true;
- }
- return false;
- }
-
- size_t
- GetArgs (Args &args) const;
-
- Error
- SetArgs (const Args &args, VarSetOperationType op);
-
protected:
- typedef std::vector<lldb::OptionValueSP> collection;
-
- uint32_t m_type_mask;
- collection m_values;
- bool m_raw_value_dump;
+ typedef std::vector<lldb::OptionValueSP> collection;
+
+ uint32_t m_type_mask;
+ collection m_values;
+ bool m_raw_value_dump;
};
} // namespace lldb_private
Modified: lldb/trunk/include/lldb/Interpreter/OptionValueBoolean.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Interpreter/OptionValueBoolean.h?rev=280751&r1=280750&r2=280751&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Interpreter/OptionValueBoolean.h (original)
+++ lldb/trunk/include/lldb/Interpreter/OptionValueBoolean.h Tue Sep 6 15:57:50 2016
@@ -18,121 +18,78 @@
namespace lldb_private {
-class OptionValueBoolean : public OptionValue
-{
+class OptionValueBoolean : public OptionValue {
public:
- OptionValueBoolean (bool value) :
- OptionValue(),
- m_current_value (value),
- m_default_value (value)
- {
- }
- OptionValueBoolean (bool current_value,
- bool default_value) :
- OptionValue(),
- m_current_value (current_value),
- m_default_value (default_value)
- {
- }
-
- ~OptionValueBoolean() override
- {
- }
-
- //---------------------------------------------------------------------
- // Virtual subclass pure virtual overrides
- //---------------------------------------------------------------------
-
- OptionValue::Type
- GetType() const override
- {
- return eTypeBoolean;
- }
-
- void
- DumpValue(const ExecutionContext *exe_ctx, Stream &strm, uint32_t dump_mask) override;
-
- Error
- SetValueFromString(llvm::StringRef value,
- VarSetOperationType op = eVarSetOperationAssign) override;
-
- bool
- Clear() override
- {
- m_current_value = m_default_value;
- m_value_was_set = false;
- return true;
- }
-
- size_t
- AutoComplete(CommandInterpreter &interpreter,
- const char *s,
- int match_start_point,
- int max_return_elements,
- bool &word_complete,
- StringList &matches) override;
-
- //---------------------------------------------------------------------
- // Subclass specific functions
- //---------------------------------------------------------------------
-
- //------------------------------------------------------------------
- /// Convert to bool operator.
- ///
- /// This allows code to check a OptionValueBoolean in conditions.
- ///
- /// @code
- /// OptionValueBoolean bool_value(...);
- /// if (bool_value)
- /// { ...
- /// @endcode
- ///
- /// @return
- /// /b True this object contains a valid namespace decl, \b
- /// false otherwise.
- //------------------------------------------------------------------
- explicit operator bool() const
- {
- return m_current_value;
- }
-
- const bool &
- operator = (bool b)
- {
- m_current_value = b;
- return m_current_value;
- }
-
- bool
- GetCurrentValue() const
- {
- return m_current_value;
- }
-
- bool
- GetDefaultValue() const
- {
- return m_default_value;
- }
-
- void
- SetCurrentValue (bool value)
- {
- m_current_value = value;
- }
-
- void
- SetDefaultValue (bool value)
- {
- m_default_value = value;
- }
-
- lldb::OptionValueSP
- DeepCopy() const override;
+ OptionValueBoolean(bool value)
+ : OptionValue(), m_current_value(value), m_default_value(value) {}
+ OptionValueBoolean(bool current_value, bool default_value)
+ : OptionValue(), m_current_value(current_value),
+ m_default_value(default_value) {}
+
+ ~OptionValueBoolean() override {}
+
+ //---------------------------------------------------------------------
+ // Virtual subclass pure virtual overrides
+ //---------------------------------------------------------------------
+
+ OptionValue::Type GetType() const override { return eTypeBoolean; }
+
+ void DumpValue(const ExecutionContext *exe_ctx, Stream &strm,
+ uint32_t dump_mask) override;
+
+ Error
+ SetValueFromString(llvm::StringRef value,
+ VarSetOperationType op = eVarSetOperationAssign) override;
+
+ bool Clear() override {
+ m_current_value = m_default_value;
+ m_value_was_set = false;
+ return true;
+ }
+
+ size_t AutoComplete(CommandInterpreter &interpreter, const char *s,
+ int match_start_point, int max_return_elements,
+ bool &word_complete, StringList &matches) override;
+
+ //---------------------------------------------------------------------
+ // Subclass specific functions
+ //---------------------------------------------------------------------
+
+ //------------------------------------------------------------------
+ /// Convert to bool operator.
+ ///
+ /// This allows code to check a OptionValueBoolean in conditions.
+ ///
+ /// @code
+ /// OptionValueBoolean bool_value(...);
+ /// if (bool_value)
+ /// { ...
+ /// @endcode
+ ///
+ /// @return
+ /// /b True this object contains a valid namespace decl, \b
+ /// false otherwise.
+ //------------------------------------------------------------------
+ explicit operator bool() const { return m_current_value; }
+
+ const bool &operator=(bool b) {
+ m_current_value = b;
+ return m_current_value;
+ }
+
+ bool GetCurrentValue() const { return m_current_value; }
+
+ bool GetDefaultValue() const { return m_default_value; }
+
+ void SetCurrentValue(bool value) { m_current_value = value; }
+
+ void SetDefaultValue(bool value) { m_default_value = value; }
+
+ lldb::OptionValueSP DeepCopy() const override;
protected:
- bool m_current_value;
- bool m_default_value;
+ bool m_current_value;
+ bool m_default_value;
};
} // namespace lldb_private
Modified: lldb/trunk/include/lldb/Interpreter/OptionValueChar.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Interpreter/OptionValueChar.h?rev=280751&r1=280750&r2=280751&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Interpreter/OptionValueChar.h (original)
+++ lldb/trunk/include/lldb/Interpreter/OptionValueChar.h Tue Sep 6 15:57:50 2016
@@ -18,94 +18,58 @@
namespace lldb_private {
-class OptionValueChar : public OptionValue
-{
+class OptionValueChar : public OptionValue {
public:
- OptionValueChar (char value) :
- OptionValue(),
- m_current_value (value),
- m_default_value (value)
- {
- }
-
- OptionValueChar (char current_value,
- char default_value) :
- OptionValue(),
- m_current_value (current_value),
- m_default_value (default_value)
- {
- }
-
- ~OptionValueChar() override
- {
- }
-
- //---------------------------------------------------------------------
- // Virtual subclass pure virtual overrides
- //---------------------------------------------------------------------
-
- OptionValue::Type
- GetType() const override
- {
- return eTypeChar;
- }
-
- void
- DumpValue(const ExecutionContext *exe_ctx, Stream &strm, uint32_t dump_mask) override;
-
- Error
- SetValueFromString(llvm::StringRef value,
- VarSetOperationType op = eVarSetOperationAssign) override;
-
- bool
- Clear() override
- {
- m_current_value = m_default_value;
- m_value_was_set = false;
- return true;
- }
-
- //---------------------------------------------------------------------
- // Subclass specific functions
- //---------------------------------------------------------------------
-
- const char &
- operator = (char c)
- {
- m_current_value = c;
- return m_current_value;
- }
-
- char
- GetCurrentValue() const
- {
- return m_current_value;
- }
-
- char
- GetDefaultValue() const
- {
- return m_default_value;
- }
-
- void
- SetCurrentValue (char value)
- {
- m_current_value = value;
- }
-
- void
- SetDefaultValue (char value)
- {
- m_default_value = value;
- }
-
- lldb::OptionValueSP
- DeepCopy() const override;
+ OptionValueChar(char value)
+ : OptionValue(), m_current_value(value), m_default_value(value) {}
+
+ OptionValueChar(char current_value, char default_value)
+ : OptionValue(), m_current_value(current_value),
+ m_default_value(default_value) {}
+
+ ~OptionValueChar() override {}
+
+ //---------------------------------------------------------------------
+ // Virtual subclass pure virtual overrides
+ //---------------------------------------------------------------------
+
+ OptionValue::Type GetType() const override { return eTypeChar; }
+
+ void DumpValue(const ExecutionContext *exe_ctx, Stream &strm,
+ uint32_t dump_mask) override;
+
+ Error
+ SetValueFromString(llvm::StringRef value,
+ VarSetOperationType op = eVarSetOperationAssign) override;
+
+ bool Clear() override {
+ m_current_value = m_default_value;
+ m_value_was_set = false;
+ return true;
+ }
+
+ //---------------------------------------------------------------------
+ // Subclass specific functions
+ //---------------------------------------------------------------------
+
+ const char &operator=(char c) {
+ m_current_value = c;
+ return m_current_value;
+ }
+
+ char GetCurrentValue() const { return m_current_value; }
+
+ char GetDefaultValue() const { return m_default_value; }
+
+ void SetCurrentValue(char value) { m_current_value = value; }
+
+ void SetDefaultValue(char value) { m_default_value = value; }
+
+ lldb::OptionValueSP DeepCopy() const override;
protected:
- char m_current_value;
- char m_default_value;
+ char m_current_value;
+ char m_default_value;
};
} // namespace lldb_private
Modified: lldb/trunk/include/lldb/Interpreter/OptionValueDictionary.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Interpreter/OptionValueDictionary.h?rev=280751&r1=280750&r2=280751&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Interpreter/OptionValueDictionary.h (original)
+++ lldb/trunk/include/lldb/Interpreter/OptionValueDictionary.h Tue Sep 6 15:57:50 2016
@@ -19,120 +19,83 @@
#include "lldb/Interpreter/OptionValue.h"
namespace lldb_private {
-
-class OptionValueDictionary : public OptionValue
-{
+
+class OptionValueDictionary : public OptionValue {
public:
- OptionValueDictionary (uint32_t type_mask = UINT32_MAX, bool raw_value_dump = true) :
- OptionValue(),
- m_type_mask (type_mask),
- m_values (),
- m_raw_value_dump (raw_value_dump)
- {
- }
-
- ~OptionValueDictionary() override
- {
- }
-
- //---------------------------------------------------------------------
- // Virtual subclass pure virtual overrides
- //---------------------------------------------------------------------
-
- OptionValue::Type
- GetType() const override
- {
- return eTypeDictionary;
- }
-
- void
- DumpValue(const ExecutionContext *exe_ctx, Stream &strm, uint32_t dump_mask) override;
-
- Error
- SetValueFromString(llvm::StringRef value,
- VarSetOperationType op = eVarSetOperationAssign) override;
-
- bool
- Clear() override
- {
- m_values.clear();
- m_value_was_set = false;
- return true;
- }
-
- lldb::OptionValueSP
- DeepCopy() const override;
-
- bool
- IsAggregateValue() const override
- {
- return true;
- }
-
- bool
- IsHomogenous() const
- {
- return ConvertTypeMaskToType (m_type_mask) != eTypeInvalid;
- }
-
- //---------------------------------------------------------------------
- // Subclass specific functions
- //---------------------------------------------------------------------
-
- size_t
- GetNumValues() const
- {
- return m_values.size();
- }
-
- lldb::OptionValueSP
- GetValueForKey (const ConstString &key) const;
-
- lldb::OptionValueSP
- GetSubValue(const ExecutionContext *exe_ctx,
- const char *name,
- bool will_modify,
- Error &error) const override;
-
- Error
- SetSubValue(const ExecutionContext *exe_ctx,
- VarSetOperationType op,
- const char *name,
- const char *value) override;
-
- //---------------------------------------------------------------------
- // String value getters and setters
- //---------------------------------------------------------------------
- const char *
- GetStringValueForKey (const ConstString &key);
-
- bool
- SetStringValueForKey (const ConstString &key,
- const char *value,
- bool can_replace = true);
-
-
- bool
- SetValueForKey (const ConstString &key,
- const lldb::OptionValueSP &value_sp,
- bool can_replace = true);
-
- bool
- DeleteValueForKey (const ConstString &key);
-
- size_t
- GetArgs (Args &args) const;
-
- Error
- SetArgs (const Args &args, VarSetOperationType op);
-
+ OptionValueDictionary(uint32_t type_mask = UINT32_MAX,
+ bool raw_value_dump = true)
+ : OptionValue(), m_type_mask(type_mask), m_values(),
+ m_raw_value_dump(raw_value_dump) {}
+
+ ~OptionValueDictionary() override {}
+
+ //---------------------------------------------------------------------
+ // Virtual subclass pure virtual overrides
+ //---------------------------------------------------------------------
+
+ OptionValue::Type GetType() const override { return eTypeDictionary; }
+
+ void DumpValue(const ExecutionContext *exe_ctx, Stream &strm,
+ uint32_t dump_mask) override;
+
+ Error
+ SetValueFromString(llvm::StringRef value,
+ VarSetOperationType op = eVarSetOperationAssign) override;
+
+ bool Clear() override {
+ m_values.clear();
+ m_value_was_set = false;
+ return true;
+ }
+
+ lldb::OptionValueSP DeepCopy() const override;
+
+ bool IsAggregateValue() const override { return true; }
+
+ bool IsHomogenous() const {
+ return ConvertTypeMaskToType(m_type_mask) != eTypeInvalid;
+ }
+
+ //---------------------------------------------------------------------
+ // Subclass specific functions
+ //---------------------------------------------------------------------
+
+ size_t GetNumValues() const { return m_values.size(); }
+
+ lldb::OptionValueSP GetValueForKey(const ConstString &key) const;
+
+ lldb::OptionValueSP GetSubValue(const ExecutionContext *exe_ctx,
+ const char *name, bool will_modify,
+ Error &error) const override;
+
+ Error SetSubValue(const ExecutionContext *exe_ctx, VarSetOperationType op,
+ const char *name, const char *value) override;
+
+ //---------------------------------------------------------------------
+ // String value getters and setters
+ //---------------------------------------------------------------------
+ const char *GetStringValueForKey(const ConstString &key);
+
+ bool SetStringValueForKey(const ConstString &key, const char *value,
+ bool can_replace = true);
+
+ bool SetValueForKey(const ConstString &key,
+ const lldb::OptionValueSP &value_sp,
+ bool can_replace = true);
+
+ bool DeleteValueForKey(const ConstString &key);
+
+ size_t GetArgs(Args &args) const;
+
+ Error SetArgs(const Args &args, VarSetOperationType op);
+
protected:
- typedef std::map<ConstString, lldb::OptionValueSP> collection;
- uint32_t m_type_mask;
- collection m_values;
- bool m_raw_value_dump;
+ typedef std::map<ConstString, lldb::OptionValueSP> collection;
+ uint32_t m_type_mask;
+ collection m_values;
+ bool m_raw_value_dump;
};
-
+
} // namespace lldb_private
#endif // liblldb_OptionValueDictionary_h_
Modified: lldb/trunk/include/lldb/Interpreter/OptionValueEnumeration.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Interpreter/OptionValueEnumeration.h?rev=280751&r1=280750&r2=280751&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Interpreter/OptionValueEnumeration.h (original)
+++ lldb/trunk/include/lldb/Interpreter/OptionValueEnumeration.h Tue Sep 6 15:57:50 2016
@@ -23,100 +23,69 @@
namespace lldb_private {
-class OptionValueEnumeration : public OptionValue
-{
+class OptionValueEnumeration : public OptionValue {
public:
- typedef int64_t enum_type;
- struct EnumeratorInfo
- {
- enum_type value;
- const char *description;
- };
- typedef UniqueCStringMap<EnumeratorInfo> EnumerationMap;
- typedef EnumerationMap::Entry EnumerationMapEntry;
-
- OptionValueEnumeration (const OptionEnumValueElement *enumerators, enum_type value);
-
- ~OptionValueEnumeration() override;
-
- //---------------------------------------------------------------------
- // Virtual subclass pure virtual overrides
- //---------------------------------------------------------------------
-
- OptionValue::Type
- GetType() const override
- {
- return eTypeEnum;
- }
-
- void
- DumpValue(const ExecutionContext *exe_ctx, Stream &strm, uint32_t dump_mask) override;
-
- Error
- SetValueFromString(llvm::StringRef value,
- VarSetOperationType op = eVarSetOperationAssign) override;
-
- bool
- Clear() override
- {
- m_current_value = m_default_value;
- m_value_was_set = false;
- return true;
- }
-
- lldb::OptionValueSP
- DeepCopy() const override;
-
- size_t
- AutoComplete(CommandInterpreter &interpreter,
- const char *s,
- int match_start_point,
- int max_return_elements,
- bool &word_complete,
- StringList &matches) override;
-
- //---------------------------------------------------------------------
- // Subclass specific functions
- //---------------------------------------------------------------------
-
- enum_type
- operator = (enum_type value)
- {
- m_current_value = value;
- return m_current_value;
- }
-
- enum_type
- GetCurrentValue() const
- {
- return m_current_value;
- }
-
- enum_type
- GetDefaultValue() const
- {
- return m_default_value;
- }
-
- void
- SetCurrentValue (enum_type value)
- {
- m_current_value = value;
- }
-
- void
- SetDefaultValue (enum_type value)
- {
- m_default_value = value;
- }
-
+ typedef int64_t enum_type;
+ struct EnumeratorInfo {
+ enum_type value;
+ const char *description;
+ };
+ typedef UniqueCStringMap<EnumeratorInfo> EnumerationMap;
+ typedef EnumerationMap::Entry EnumerationMapEntry;
+
+ OptionValueEnumeration(const OptionEnumValueElement *enumerators,
+ enum_type value);
+
+ ~OptionValueEnumeration() override;
+
+ //---------------------------------------------------------------------
+ // Virtual subclass pure virtual overrides
+ //---------------------------------------------------------------------
+
+ OptionValue::Type GetType() const override { return eTypeEnum; }
+
+ void DumpValue(const ExecutionContext *exe_ctx, Stream &strm,
+ uint32_t dump_mask) override;
+
+ Error
+ SetValueFromString(llvm::StringRef value,
+ VarSetOperationType op = eVarSetOperationAssign) override;
+
+ bool Clear() override {
+ m_current_value = m_default_value;
+ m_value_was_set = false;
+ return true;
+ }
+
+ lldb::OptionValueSP DeepCopy() const override;
+
+ size_t AutoComplete(CommandInterpreter &interpreter, const char *s,
+ int match_start_point, int max_return_elements,
+ bool &word_complete, StringList &matches) override;
+
+ //---------------------------------------------------------------------
+ // Subclass specific functions
+ //---------------------------------------------------------------------
+
+ enum_type operator=(enum_type value) {
+ m_current_value = value;
+ return m_current_value;
+ }
+
+ enum_type GetCurrentValue() const { return m_current_value; }
+
+ enum_type GetDefaultValue() const { return m_default_value; }
+
+ void SetCurrentValue(enum_type value) { m_current_value = value; }
+
+ void SetDefaultValue(enum_type value) { m_default_value = value; }
+
protected:
- void
- SetEnumerations (const OptionEnumValueElement *enumerators);
+ void SetEnumerations(const OptionEnumValueElement *enumerators);
- enum_type m_current_value;
- enum_type m_default_value;
- EnumerationMap m_enumerations;
+ enum_type m_current_value;
+ enum_type m_default_value;
+ EnumerationMap m_enumerations;
};
} // namespace lldb_private
Modified: lldb/trunk/include/lldb/Interpreter/OptionValueFileSpec.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Interpreter/OptionValueFileSpec.h?rev=280751&r1=280750&r2=280751&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Interpreter/OptionValueFileSpec.h (original)
+++ lldb/trunk/include/lldb/Interpreter/OptionValueFileSpec.h Tue Sep 6 15:57:50 2016
@@ -19,113 +19,74 @@
namespace lldb_private {
-class OptionValueFileSpec : public OptionValue
-{
+class OptionValueFileSpec : public OptionValue {
public:
- OptionValueFileSpec (bool resolve = true);
-
- OptionValueFileSpec (const FileSpec &value,
- bool resolve = true);
-
- OptionValueFileSpec (const FileSpec ¤t_value,
- const FileSpec &default_value,
- bool resolve = true);
-
- ~OptionValueFileSpec() override
- {
- }
-
- //---------------------------------------------------------------------
- // Virtual subclass pure virtual overrides
- //---------------------------------------------------------------------
-
- OptionValue::Type
- GetType() const override
- {
- return eTypeFileSpec;
- }
-
- void
- DumpValue(const ExecutionContext *exe_ctx, Stream &strm, uint32_t dump_mask) override;
-
- Error
- SetValueFromString(llvm::StringRef value,
- VarSetOperationType op = eVarSetOperationAssign) override;
-
- bool
- Clear() override
- {
- m_current_value = m_default_value;
- m_value_was_set = false;
- m_data_sp.reset();
- m_data_mod_time.Clear();
- return true;
- }
-
- lldb::OptionValueSP
- DeepCopy() const override;
-
- size_t
- AutoComplete(CommandInterpreter &interpreter,
- const char *s,
- int match_start_point,
- int max_return_elements,
- bool &word_complete,
- StringList &matches) override;
-
- //---------------------------------------------------------------------
- // Subclass specific functions
- //---------------------------------------------------------------------
-
- FileSpec &
- GetCurrentValue()
- {
- return m_current_value;
- }
-
- const FileSpec &
- GetCurrentValue() const
- {
- return m_current_value;
- }
-
- const FileSpec &
- GetDefaultValue() const
- {
- return m_default_value;
- }
-
- void
- SetCurrentValue (const FileSpec &value, bool set_value_was_set)
- {
- m_current_value = value;
- if (set_value_was_set)
- m_value_was_set = true;
- m_data_sp.reset();
- }
-
- void
- SetDefaultValue (const FileSpec &value)
- {
- m_default_value = value;
- }
-
- const lldb::DataBufferSP &
- GetFileContents(bool null_terminate);
-
- void
- SetCompletionMask (uint32_t mask)
- {
- m_completion_mask = mask;
- }
+ OptionValueFileSpec(bool resolve = true);
+
+ OptionValueFileSpec(const FileSpec &value, bool resolve = true);
+
+ OptionValueFileSpec(const FileSpec ¤t_value,
+ const FileSpec &default_value, bool resolve = true);
+
+ ~OptionValueFileSpec() override {}
+
+ //---------------------------------------------------------------------
+ // Virtual subclass pure virtual overrides
+ //---------------------------------------------------------------------
+
+ OptionValue::Type GetType() const override { return eTypeFileSpec; }
+
+ void DumpValue(const ExecutionContext *exe_ctx, Stream &strm,
+ uint32_t dump_mask) override;
+
+ Error
+ SetValueFromString(llvm::StringRef value,
+ VarSetOperationType op = eVarSetOperationAssign) override;
+
+ bool Clear() override {
+ m_current_value = m_default_value;
+ m_value_was_set = false;
+ m_data_sp.reset();
+ m_data_mod_time.Clear();
+ return true;
+ }
+
+ lldb::OptionValueSP DeepCopy() const override;
+
+ size_t AutoComplete(CommandInterpreter &interpreter, const char *s,
+ int match_start_point, int max_return_elements,
+ bool &word_complete, StringList &matches) override;
+
+ //---------------------------------------------------------------------
+ // Subclass specific functions
+ //---------------------------------------------------------------------
+
+ FileSpec &GetCurrentValue() { return m_current_value; }
+
+ const FileSpec &GetCurrentValue() const { return m_current_value; }
+
+ const FileSpec &GetDefaultValue() const { return m_default_value; }
+
+ void SetCurrentValue(const FileSpec &value, bool set_value_was_set) {
+ m_current_value = value;
+ if (set_value_was_set)
+ m_value_was_set = true;
+ m_data_sp.reset();
+ }
+
+ void SetDefaultValue(const FileSpec &value) { m_default_value = value; }
+
+ const lldb::DataBufferSP &GetFileContents(bool null_terminate);
+
+ void SetCompletionMask(uint32_t mask) { m_completion_mask = mask; }
protected:
- FileSpec m_current_value;
- FileSpec m_default_value;
- lldb::DataBufferSP m_data_sp;
- TimeValue m_data_mod_time;
- uint32_t m_completion_mask;
- bool m_resolve;
+ FileSpec m_current_value;
+ FileSpec m_default_value;
+ lldb::DataBufferSP m_data_sp;
+ TimeValue m_data_mod_time;
+ uint32_t m_completion_mask;
+ bool m_resolve;
};
} // namespace lldb_private
Modified: lldb/trunk/include/lldb/Interpreter/OptionValueFileSpecList.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Interpreter/OptionValueFileSpecList.h?rev=280751&r1=280750&r2=280751&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Interpreter/OptionValueFileSpecList.h (original)
+++ lldb/trunk/include/lldb/Interpreter/OptionValueFileSpecList.h Tue Sep 6 15:57:50 2016
@@ -19,83 +19,50 @@
namespace lldb_private {
-class OptionValueFileSpecList : public OptionValue
-{
+class OptionValueFileSpecList : public OptionValue {
public:
- OptionValueFileSpecList () :
- OptionValue(),
- m_current_value ()
- {
- }
-
- OptionValueFileSpecList (const FileSpecList ¤t_value) :
- OptionValue(),
- m_current_value (current_value)
- {
- }
-
- ~OptionValueFileSpecList() override
- {
- }
-
- //---------------------------------------------------------------------
- // Virtual subclass pure virtual overrides
- //---------------------------------------------------------------------
-
- OptionValue::Type
- GetType() const override
- {
- return eTypeFileSpecList;
- }
-
- void
- DumpValue(const ExecutionContext *exe_ctx, Stream &strm, uint32_t dump_mask) override;
-
- Error
- SetValueFromString(llvm::StringRef value,
- VarSetOperationType op = eVarSetOperationAssign) override;
-
- bool
- Clear() override
- {
- m_current_value.Clear();
- m_value_was_set = false;
- return true;
- }
-
- lldb::OptionValueSP
- DeepCopy() const override;
-
- bool
- IsAggregateValue() const override
- {
- return true;
- }
-
- //---------------------------------------------------------------------
- // Subclass specific functions
- //---------------------------------------------------------------------
-
- FileSpecList &
- GetCurrentValue()
- {
- return m_current_value;
- }
-
- const FileSpecList &
- GetCurrentValue() const
- {
- return m_current_value;
- }
-
- void
- SetCurrentValue (const FileSpecList &value)
- {
- m_current_value = value;
- }
-
+ OptionValueFileSpecList() : OptionValue(), m_current_value() {}
+
+ OptionValueFileSpecList(const FileSpecList ¤t_value)
+ : OptionValue(), m_current_value(current_value) {}
+
+ ~OptionValueFileSpecList() override {}
+
+ //---------------------------------------------------------------------
+ // Virtual subclass pure virtual overrides
+ //---------------------------------------------------------------------
+
+ OptionValue::Type GetType() const override { return eTypeFileSpecList; }
+
+ void DumpValue(const ExecutionContext *exe_ctx, Stream &strm,
+ uint32_t dump_mask) override;
+
+ Error
+ SetValueFromString(llvm::StringRef value,
+ VarSetOperationType op = eVarSetOperationAssign) override;
+
+ bool Clear() override {
+ m_current_value.Clear();
+ m_value_was_set = false;
+ return true;
+ }
+
+ lldb::OptionValueSP DeepCopy() const override;
+
+ bool IsAggregateValue() const override { return true; }
+
+ //---------------------------------------------------------------------
+ // Subclass specific functions
+ //---------------------------------------------------------------------
+
+ FileSpecList &GetCurrentValue() { return m_current_value; }
+
+ const FileSpecList &GetCurrentValue() const { return m_current_value; }
+
+ void SetCurrentValue(const FileSpecList &value) { m_current_value = value; }
+
protected:
- FileSpecList m_current_value;
+ FileSpecList m_current_value;
};
} // namespace lldb_private
Modified: lldb/trunk/include/lldb/Interpreter/OptionValueFormat.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Interpreter/OptionValueFormat.h?rev=280751&r1=280750&r2=280751&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Interpreter/OptionValueFormat.h (original)
+++ lldb/trunk/include/lldb/Interpreter/OptionValueFormat.h Tue Sep 6 15:57:50 2016
@@ -18,87 +18,53 @@
namespace lldb_private {
-class OptionValueFormat : public OptionValue
-{
+class OptionValueFormat : public OptionValue {
public:
- OptionValueFormat (lldb::Format value) :
- OptionValue(),
- m_current_value (value),
- m_default_value (value)
- {
- }
-
- OptionValueFormat (lldb::Format current_value,
- lldb::Format default_value) :
- OptionValue(),
- m_current_value (current_value),
- m_default_value (default_value)
- {
- }
-
- ~OptionValueFormat() override
- {
- }
-
- //---------------------------------------------------------------------
- // Virtual subclass pure virtual overrides
- //---------------------------------------------------------------------
-
- OptionValue::Type
- GetType() const override
- {
- return eTypeFormat;
- }
-
- void
- DumpValue(const ExecutionContext *exe_ctx, Stream &strm, uint32_t dump_mask) override;
-
- Error
- SetValueFromString(llvm::StringRef value,
- VarSetOperationType op = eVarSetOperationAssign) override;
-
- bool
- Clear() override
- {
- m_current_value = m_default_value;
- m_value_was_set = false;
- return true;
- }
-
- lldb::OptionValueSP
- DeepCopy() const override;
-
- //---------------------------------------------------------------------
- // Subclass specific functions
- //---------------------------------------------------------------------
-
- lldb::Format
- GetCurrentValue() const
- {
- return m_current_value;
- }
-
- lldb::Format
- GetDefaultValue() const
- {
- return m_default_value;
- }
-
- void
- SetCurrentValue (lldb::Format value)
- {
- m_current_value = value;
- }
-
- void
- SetDefaultValue (lldb::Format value)
- {
- m_default_value = value;
- }
-
+ OptionValueFormat(lldb::Format value)
+ : OptionValue(), m_current_value(value), m_default_value(value) {}
+
+ OptionValueFormat(lldb::Format current_value, lldb::Format default_value)
+ : OptionValue(), m_current_value(current_value),
+ m_default_value(default_value) {}
+
+ ~OptionValueFormat() override {}
+
+ //---------------------------------------------------------------------
+ // Virtual subclass pure virtual overrides
+ //---------------------------------------------------------------------
+
+ OptionValue::Type GetType() const override { return eTypeFormat; }
+
+ void DumpValue(const ExecutionContext *exe_ctx, Stream &strm,
+ uint32_t dump_mask) override;
+
+ Error
+ SetValueFromString(llvm::StringRef value,
+ VarSetOperationType op = eVarSetOperationAssign) override;
+
+ bool Clear() override {
+ m_current_value = m_default_value;
+ m_value_was_set = false;
+ return true;
+ }
+
+ lldb::OptionValueSP DeepCopy() const override;
+
+ //---------------------------------------------------------------------
+ // Subclass specific functions
+ //---------------------------------------------------------------------
+
+ lldb::Format GetCurrentValue() const { return m_current_value; }
+
+ lldb::Format GetDefaultValue() const { return m_default_value; }
+
+ void SetCurrentValue(lldb::Format value) { m_current_value = value; }
+
+ void SetDefaultValue(lldb::Format value) { m_default_value = value; }
+
protected:
- lldb::Format m_current_value;
- lldb::Format m_default_value;
+ lldb::Format m_current_value;
+ lldb::Format m_default_value;
};
} // namespace lldb_private
Modified: lldb/trunk/include/lldb/Interpreter/OptionValueFormatEntity.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Interpreter/OptionValueFormatEntity.h?rev=280751&r1=280750&r2=280751&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Interpreter/OptionValueFormatEntity.h (original)
+++ lldb/trunk/include/lldb/Interpreter/OptionValueFormatEntity.h Tue Sep 6 15:57:50 2016
@@ -1,4 +1,5 @@
-//===-- OptionValueFormatEntity.h --------------------------------------*- C++ -*-===//
+//===-- OptionValueFormatEntity.h --------------------------------------*- C++
+//-*-===//
//
// The LLVM Compiler Infrastructure
//
@@ -19,85 +20,54 @@
namespace lldb_private {
-class OptionValueFormatEntity : public OptionValue
-{
+class OptionValueFormatEntity : public OptionValue {
public:
- OptionValueFormatEntity (const char *default_format);
-
- ~OptionValueFormatEntity() override
- {
- }
-
- //---------------------------------------------------------------------
- // Virtual subclass pure virtual overrides
- //---------------------------------------------------------------------
-
- OptionValue::Type
- GetType () const override
- {
- return eTypeFormatEntity;
- }
-
- void
- DumpValue (const ExecutionContext *exe_ctx, Stream &strm, uint32_t dump_mask) override;
-
- Error
- SetValueFromString (llvm::StringRef value,
- VarSetOperationType op = eVarSetOperationAssign) override;
-
- bool
- Clear () override;
-
- lldb::OptionValueSP
- DeepCopy () const override;
-
- size_t
- AutoComplete (CommandInterpreter &interpreter,
- const char *s,
- int match_start_point,
- int max_return_elements,
- bool &word_complete,
- StringList &matches) override;
-
- //---------------------------------------------------------------------
- // Subclass specific functions
- //---------------------------------------------------------------------
-
- FormatEntity::Entry &
- GetCurrentValue()
- {
- return m_current_entry;
- }
-
- const FormatEntity::Entry &
- GetCurrentValue() const
- {
- return m_current_entry;
- }
-
- void
- SetCurrentValue (const FormatEntity::Entry &value)
- {
- m_current_entry = value;
- }
-
- FormatEntity::Entry &
- GetDefaultValue()
- {
- return m_default_entry;
- }
-
- const FormatEntity::Entry &
- GetDefaultValue() const
- {
- return m_default_entry;
- }
+ OptionValueFormatEntity(const char *default_format);
+
+ ~OptionValueFormatEntity() override {}
+
+ //---------------------------------------------------------------------
+ // Virtual subclass pure virtual overrides
+ //---------------------------------------------------------------------
+
+ OptionValue::Type GetType() const override { return eTypeFormatEntity; }
+
+ void DumpValue(const ExecutionContext *exe_ctx, Stream &strm,
+ uint32_t dump_mask) override;
+
+ Error
+ SetValueFromString(llvm::StringRef value,
+ VarSetOperationType op = eVarSetOperationAssign) override;
+
+ bool Clear() override;
+
+ lldb::OptionValueSP DeepCopy() const override;
+
+ size_t AutoComplete(CommandInterpreter &interpreter, const char *s,
+ int match_start_point, int max_return_elements,
+ bool &word_complete, StringList &matches) override;
+
+ //---------------------------------------------------------------------
+ // Subclass specific functions
+ //---------------------------------------------------------------------
+
+ FormatEntity::Entry &GetCurrentValue() { return m_current_entry; }
+
+ const FormatEntity::Entry &GetCurrentValue() const { return m_current_entry; }
+
+ void SetCurrentValue(const FormatEntity::Entry &value) {
+ m_current_entry = value;
+ }
+
+ FormatEntity::Entry &GetDefaultValue() { return m_default_entry; }
+
+ const FormatEntity::Entry &GetDefaultValue() const { return m_default_entry; }
protected:
- std::string m_current_format;
- std::string m_default_format;
- FormatEntity::Entry m_current_entry;
- FormatEntity::Entry m_default_entry;
+ std::string m_current_format;
+ std::string m_default_format;
+ FormatEntity::Entry m_current_entry;
+ FormatEntity::Entry m_default_entry;
};
} // namespace lldb_private
Modified: lldb/trunk/include/lldb/Interpreter/OptionValueLanguage.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Interpreter/OptionValueLanguage.h?rev=280751&r1=280750&r2=280751&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Interpreter/OptionValueLanguage.h (original)
+++ lldb/trunk/include/lldb/Interpreter/OptionValueLanguage.h Tue Sep 6 15:57:50 2016
@@ -1,4 +1,5 @@
-//===-- OptionValueLanguage.h -------------------------------------*- C++ -*-===//
+//===-- OptionValueLanguage.h -------------------------------------*- C++
+//-*-===//
//
// The LLVM Compiler Infrastructure
//
@@ -14,91 +15,59 @@
// C++ Includes
// Other libraries and framework includes
// Project includes
-#include "lldb/lldb-enumerations.h"
#include "lldb/Interpreter/OptionValue.h"
+#include "lldb/lldb-enumerations.h"
namespace lldb_private {
-class OptionValueLanguage : public OptionValue
-{
+class OptionValueLanguage : public OptionValue {
public:
- OptionValueLanguage (lldb::LanguageType value) :
- OptionValue(),
- m_current_value (value),
- m_default_value (value)
- {
- }
-
- OptionValueLanguage (lldb::LanguageType current_value,
- lldb::LanguageType default_value) :
- OptionValue(),
- m_current_value (current_value),
- m_default_value (default_value)
- {
- }
-
- ~OptionValueLanguage() override
- {
- }
-
- //---------------------------------------------------------------------
- // Virtual subclass pure virtual overrides
- //---------------------------------------------------------------------
-
- OptionValue::Type
- GetType () const override
- {
- return eTypeLanguage;
- }
-
- void
- DumpValue (const ExecutionContext *exe_ctx, Stream &strm, uint32_t dump_mask) override;
-
- Error
- SetValueFromString (llvm::StringRef value, VarSetOperationType op = eVarSetOperationAssign) override;
-
- bool
- Clear () override
- {
- m_current_value = m_default_value;
- m_value_was_set = false;
- return true;
- }
-
- lldb::OptionValueSP
- DeepCopy () const override;
-
- //---------------------------------------------------------------------
- // Subclass specific functions
- //---------------------------------------------------------------------
-
- lldb::LanguageType
- GetCurrentValue() const
- {
- return m_current_value;
- }
-
- lldb::LanguageType
- GetDefaultValue() const
- {
- return m_default_value;
- }
-
- void
- SetCurrentValue (lldb::LanguageType value)
- {
- m_current_value = value;
- }
-
- void
- SetDefaultValue (lldb::LanguageType value)
- {
- m_default_value = value;
- }
-
+ OptionValueLanguage(lldb::LanguageType value)
+ : OptionValue(), m_current_value(value), m_default_value(value) {}
+
+ OptionValueLanguage(lldb::LanguageType current_value,
+ lldb::LanguageType default_value)
+ : OptionValue(), m_current_value(current_value),
+ m_default_value(default_value) {}
+
+ ~OptionValueLanguage() override {}
+
+ //---------------------------------------------------------------------
+ // Virtual subclass pure virtual overrides
+ //---------------------------------------------------------------------
+
+ OptionValue::Type GetType() const override { return eTypeLanguage; }
+
+ void DumpValue(const ExecutionContext *exe_ctx, Stream &strm,
+ uint32_t dump_mask) override;
+
+ Error
+ SetValueFromString(llvm::StringRef value,
+ VarSetOperationType op = eVarSetOperationAssign) override;
+
+ bool Clear() override {
+ m_current_value = m_default_value;
+ m_value_was_set = false;
+ return true;
+ }
+
+ lldb::OptionValueSP DeepCopy() const override;
+
+ //---------------------------------------------------------------------
+ // Subclass specific functions
+ //---------------------------------------------------------------------
+
+ lldb::LanguageType GetCurrentValue() const { return m_current_value; }
+
+ lldb::LanguageType GetDefaultValue() const { return m_default_value; }
+
+ void SetCurrentValue(lldb::LanguageType value) { m_current_value = value; }
+
+ void SetDefaultValue(lldb::LanguageType value) { m_default_value = value; }
+
protected:
- lldb::LanguageType m_current_value;
- lldb::LanguageType m_default_value;
+ lldb::LanguageType m_current_value;
+ lldb::LanguageType m_default_value;
};
} // namespace lldb_private
Modified: lldb/trunk/include/lldb/Interpreter/OptionValuePathMappings.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Interpreter/OptionValuePathMappings.h?rev=280751&r1=280750&r2=280751&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Interpreter/OptionValuePathMappings.h (original)
+++ lldb/trunk/include/lldb/Interpreter/OptionValuePathMappings.h Tue Sep 6 15:57:50 2016
@@ -14,78 +14,52 @@
// C++ Includes
// Other libraries and framework includes
// Project includes
-#include "lldb/Target/PathMappingList.h"
#include "lldb/Interpreter/OptionValue.h"
+#include "lldb/Target/PathMappingList.h"
namespace lldb_private {
-class OptionValuePathMappings : public OptionValue
-{
+class OptionValuePathMappings : public OptionValue {
public:
- OptionValuePathMappings (bool notify_changes) :
- OptionValue(),
- m_path_mappings (),
- m_notify_changes (notify_changes)
- {
- }
-
- ~OptionValuePathMappings() override
- {
- }
-
- //---------------------------------------------------------------------
- // Virtual subclass pure virtual overrides
- //---------------------------------------------------------------------
-
- OptionValue::Type
- GetType() const override
- {
- return eTypePathMap;
- }
-
- void
- DumpValue(const ExecutionContext *exe_ctx, Stream &strm, uint32_t dump_mask) override;
-
- Error
- SetValueFromString(llvm::StringRef value,
- VarSetOperationType op = eVarSetOperationAssign) override;
-
- bool
- Clear() override
- {
- m_path_mappings.Clear(m_notify_changes);
- m_value_was_set = false;
- return true;
- }
-
- lldb::OptionValueSP
- DeepCopy() const override;
-
- bool
- IsAggregateValue() const override
- {
- return true;
- }
-
- //---------------------------------------------------------------------
- // Subclass specific functions
- //---------------------------------------------------------------------
-
- PathMappingList &
- GetCurrentValue()
- {
- return m_path_mappings;
- }
-
- const PathMappingList &
- GetCurrentValue() const
- {
- return m_path_mappings;
- }
-
+ OptionValuePathMappings(bool notify_changes)
+ : OptionValue(), m_path_mappings(), m_notify_changes(notify_changes) {}
+
+ ~OptionValuePathMappings() override {}
+
+ //---------------------------------------------------------------------
+ // Virtual subclass pure virtual overrides
+ //---------------------------------------------------------------------
+
+ OptionValue::Type GetType() const override { return eTypePathMap; }
+
+ void DumpValue(const ExecutionContext *exe_ctx, Stream &strm,
+ uint32_t dump_mask) override;
+
+ Error
+ SetValueFromString(llvm::StringRef value,
+ VarSetOperationType op = eVarSetOperationAssign) override;
+
+ bool Clear() override {
+ m_path_mappings.Clear(m_notify_changes);
+ m_value_was_set = false;
+ return true;
+ }
+
+ lldb::OptionValueSP DeepCopy() const override;
+
+ bool IsAggregateValue() const override { return true; }
+
+ //---------------------------------------------------------------------
+ // Subclass specific functions
+ //---------------------------------------------------------------------
+
+ PathMappingList &GetCurrentValue() { return m_path_mappings; }
+
+ const PathMappingList &GetCurrentValue() const { return m_path_mappings; }
+
protected:
- PathMappingList m_path_mappings;
- bool m_notify_changes;
+ PathMappingList m_path_mappings;
+ bool m_notify_changes;
};
} // namespace lldb_private
Modified: lldb/trunk/include/lldb/Interpreter/OptionValueProperties.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Interpreter/OptionValueProperties.h?rev=280751&r1=280750&r2=280751&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Interpreter/OptionValueProperties.h (original)
+++ lldb/trunk/include/lldb/Interpreter/OptionValueProperties.h Tue Sep 6 15:57:50 2016
@@ -24,251 +24,213 @@
namespace lldb_private {
-class OptionValueProperties :
- public OptionValue,
- public std::enable_shared_from_this<OptionValueProperties>
-{
+class OptionValueProperties
+ : public OptionValue,
+ public std::enable_shared_from_this<OptionValueProperties> {
public:
- OptionValueProperties () :
- OptionValue(),
- m_name (),
- m_properties (),
- m_name_to_index ()
- {
- }
-
- OptionValueProperties (const ConstString &name);
-
- OptionValueProperties (const OptionValueProperties &global_properties);
-
- ~OptionValueProperties() override = default;
-
- Type
- GetType() const override
- {
- return eTypeProperties;
- }
-
- bool
- Clear() override;
-
- lldb::OptionValueSP
- DeepCopy() const override;
-
- Error
- SetValueFromString(llvm::StringRef value,
- VarSetOperationType op = eVarSetOperationAssign) override;
-
- void
- DumpValue(const ExecutionContext *exe_ctx,
- Stream &strm,
- uint32_t dump_mask) override;
-
- ConstString
- GetName() const override
- {
- return m_name;
- }
-
- virtual Error
- DumpPropertyValue (const ExecutionContext *exe_ctx,
- Stream &strm,
- const char *property_path,
- uint32_t dump_mask);
-
- virtual void
- DumpAllDescriptions (CommandInterpreter &interpreter,
- Stream &strm) const;
-
- void
- Apropos (const char *keyword,
- std::vector<const Property *> &matching_properties) const;
-
- void
- Initialize (const PropertyDefinition *setting_definitions);
-
-// bool
-// GetQualifiedName (Stream &strm);
-
- //---------------------------------------------------------------------
- // Subclass specific functions
- //---------------------------------------------------------------------
-
- virtual size_t
- GetNumProperties() const;
-
- virtual ConstString
- GetPropertyNameAtIndex (uint32_t idx) const;
-
- virtual const char *
- GetPropertyDescriptionAtIndex (uint32_t idx) const;
-
- //---------------------------------------------------------------------
- // Get the index of a property given its exact name in this property
- // collection, "name" can't be a path to a property path that refers
- // to a property within a property
- //---------------------------------------------------------------------
- virtual uint32_t
- GetPropertyIndex (const ConstString &name) const;
-
- //---------------------------------------------------------------------
- // Get a property by exact name exists in this property collection, name
- // can not be a path to a property path that refers to a property within
- // a property
- //---------------------------------------------------------------------
- virtual const Property *
- GetProperty (const ExecutionContext *exe_ctx,
- bool will_modify,
- const ConstString &name) const;
-
- virtual const Property *
- GetPropertyAtIndex (const ExecutionContext *exe_ctx,
- bool will_modify,
- uint32_t idx) const;
-
- //---------------------------------------------------------------------
- // Property can be be a property path like "target.process.extra-startup-command"
- //---------------------------------------------------------------------
- virtual const Property *
- GetPropertyAtPath (const ExecutionContext *exe_ctx,
- bool will_modify,
- const char *property_path) const;
-
- virtual lldb::OptionValueSP
- GetPropertyValueAtIndex (const ExecutionContext *exe_ctx,
- bool will_modify,
- uint32_t idx) const;
-
- virtual lldb::OptionValueSP
- GetValueForKey (const ExecutionContext *exe_ctx,
- const ConstString &key,
- bool value_will_be_modified) const;
-
- lldb::OptionValueSP
- GetSubValue(const ExecutionContext *exe_ctx,
- const char *name,
- bool value_will_be_modified,
- Error &error) const override;
-
- Error
- SetSubValue(const ExecutionContext *exe_ctx,
- VarSetOperationType op,
- const char *path,
- const char *value) override;
-
- virtual bool
- PredicateMatches (const ExecutionContext *exe_ctx,
- const char *predicate) const
- {
- return false;
- }
-
-
- OptionValueArch *
- GetPropertyAtIndexAsOptionValueArch (const ExecutionContext *exe_ctx, uint32_t idx) const;
-
- OptionValueLanguage *
- GetPropertyAtIndexAsOptionValueLanguage (const ExecutionContext *exe_ctx, uint32_t idx) const;
-
- bool
- GetPropertyAtIndexAsArgs (const ExecutionContext *exe_ctx, uint32_t idx, Args &args) const;
-
- bool
- SetPropertyAtIndexFromArgs (const ExecutionContext *exe_ctx, uint32_t idx, const Args &args);
-
- bool
- GetPropertyAtIndexAsBoolean (const ExecutionContext *exe_ctx, uint32_t idx, bool fail_value) const;
-
- bool
- SetPropertyAtIndexAsBoolean (const ExecutionContext *exe_ctx, uint32_t idx, bool new_value);
-
- OptionValueDictionary *
- GetPropertyAtIndexAsOptionValueDictionary (const ExecutionContext *exe_ctx, uint32_t idx) const;
-
- int64_t
- GetPropertyAtIndexAsEnumeration (const ExecutionContext *exe_ctx, uint32_t idx, int64_t fail_value) const;
-
- bool
- SetPropertyAtIndexAsEnumeration (const ExecutionContext *exe_ctx, uint32_t idx, int64_t new_value);
-
- const FormatEntity::Entry *
- GetPropertyAtIndexAsFormatEntity (const ExecutionContext *exe_ctx, uint32_t idx);
-
- const RegularExpression *
- GetPropertyAtIndexAsOptionValueRegex (const ExecutionContext *exe_ctx, uint32_t idx) const;
-
- OptionValueSInt64 *
- GetPropertyAtIndexAsOptionValueSInt64 (const ExecutionContext *exe_ctx, uint32_t idx) const;
-
- int64_t
- GetPropertyAtIndexAsSInt64 (const ExecutionContext *exe_ctx, uint32_t idx, int64_t fail_value) const;
-
- bool
- SetPropertyAtIndexAsSInt64 (const ExecutionContext *exe_ctx, uint32_t idx, int64_t new_value);
-
- uint64_t
- GetPropertyAtIndexAsUInt64 (const ExecutionContext *exe_ctx, uint32_t idx, uint64_t fail_value) const;
-
- bool
- SetPropertyAtIndexAsUInt64 (const ExecutionContext *exe_ctx, uint32_t idx, uint64_t new_value);
-
- const char *
- GetPropertyAtIndexAsString (const ExecutionContext *exe_ctx, uint32_t idx, const char *fail_value) const;
-
- bool
- SetPropertyAtIndexAsString (const ExecutionContext *exe_ctx, uint32_t idx, const char *new_value);
-
- OptionValueString *
- GetPropertyAtIndexAsOptionValueString (const ExecutionContext *exe_ctx, bool will_modify, uint32_t idx) const;
-
- OptionValueFileSpec *
- GetPropertyAtIndexAsOptionValueFileSpec (const ExecutionContext *exe_ctx, bool will_modify, uint32_t idx) const;
-
- FileSpec
- GetPropertyAtIndexAsFileSpec (const ExecutionContext *exe_ctx, uint32_t idx) const;
-
- bool
- SetPropertyAtIndexAsFileSpec (const ExecutionContext *exe_ctx, uint32_t idx, const FileSpec &file_spec);
-
- OptionValuePathMappings *
- GetPropertyAtIndexAsOptionValuePathMappings (const ExecutionContext *exe_ctx, bool will_modify, uint32_t idx) const;
-
- OptionValueFileSpecList *
- GetPropertyAtIndexAsOptionValueFileSpecList (const ExecutionContext *exe_ctx, bool will_modify, uint32_t idx) const;
-
- void
- AppendProperty(const ConstString &name,
- const ConstString &desc,
- bool is_global,
- const lldb::OptionValueSP &value_sp);
-
- lldb::OptionValuePropertiesSP
- GetSubProperty (const ExecutionContext *exe_ctx,
- const ConstString &name);
-
- void
- SetValueChangedCallback (uint32_t property_idx,
- OptionValueChangedCallback callback,
- void *baton);
+ OptionValueProperties()
+ : OptionValue(), m_name(), m_properties(), m_name_to_index() {}
+
+ OptionValueProperties(const ConstString &name);
+
+ OptionValueProperties(const OptionValueProperties &global_properties);
+
+ ~OptionValueProperties() override = default;
+
+ Type GetType() const override { return eTypeProperties; }
+
+ bool Clear() override;
+
+ lldb::OptionValueSP DeepCopy() const override;
+
+ Error
+ SetValueFromString(llvm::StringRef value,
+ VarSetOperationType op = eVarSetOperationAssign) override;
+
+ void DumpValue(const ExecutionContext *exe_ctx, Stream &strm,
+ uint32_t dump_mask) override;
+
+ ConstString GetName() const override { return m_name; }
+
+ virtual Error DumpPropertyValue(const ExecutionContext *exe_ctx, Stream &strm,
+ const char *property_path,
+ uint32_t dump_mask);
+
+ virtual void DumpAllDescriptions(CommandInterpreter &interpreter,
+ Stream &strm) const;
+
+ void Apropos(const char *keyword,
+ std::vector<const Property *> &matching_properties) const;
+
+ void Initialize(const PropertyDefinition *setting_definitions);
+
+ // bool
+ // GetQualifiedName (Stream &strm);
+
+ //---------------------------------------------------------------------
+ // Subclass specific functions
+ //---------------------------------------------------------------------
+
+ virtual size_t GetNumProperties() const;
+
+ virtual ConstString GetPropertyNameAtIndex(uint32_t idx) const;
+
+ virtual const char *GetPropertyDescriptionAtIndex(uint32_t idx) const;
+
+ //---------------------------------------------------------------------
+ // Get the index of a property given its exact name in this property
+ // collection, "name" can't be a path to a property path that refers
+ // to a property within a property
+ //---------------------------------------------------------------------
+ virtual uint32_t GetPropertyIndex(const ConstString &name) const;
+
+ //---------------------------------------------------------------------
+ // Get a property by exact name exists in this property collection, name
+ // can not be a path to a property path that refers to a property within
+ // a property
+ //---------------------------------------------------------------------
+ virtual const Property *GetProperty(const ExecutionContext *exe_ctx,
+ bool will_modify,
+ const ConstString &name) const;
+
+ virtual const Property *GetPropertyAtIndex(const ExecutionContext *exe_ctx,
+ bool will_modify,
+ uint32_t idx) const;
+
+ //---------------------------------------------------------------------
+ // Property can be be a property path like
+ // "target.process.extra-startup-command"
+ //---------------------------------------------------------------------
+ virtual const Property *GetPropertyAtPath(const ExecutionContext *exe_ctx,
+ bool will_modify,
+ const char *property_path) const;
+
+ virtual lldb::OptionValueSP
+ GetPropertyValueAtIndex(const ExecutionContext *exe_ctx, bool will_modify,
+ uint32_t idx) const;
+
+ virtual lldb::OptionValueSP GetValueForKey(const ExecutionContext *exe_ctx,
+ const ConstString &key,
+ bool value_will_be_modified) const;
+
+ lldb::OptionValueSP GetSubValue(const ExecutionContext *exe_ctx,
+ const char *name, bool value_will_be_modified,
+ Error &error) const override;
+
+ Error SetSubValue(const ExecutionContext *exe_ctx, VarSetOperationType op,
+ const char *path, const char *value) override;
+
+ virtual bool PredicateMatches(const ExecutionContext *exe_ctx,
+ const char *predicate) const {
+ return false;
+ }
+
+ OptionValueArch *
+ GetPropertyAtIndexAsOptionValueArch(const ExecutionContext *exe_ctx,
+ uint32_t idx) const;
+
+ OptionValueLanguage *
+ GetPropertyAtIndexAsOptionValueLanguage(const ExecutionContext *exe_ctx,
+ uint32_t idx) const;
+
+ bool GetPropertyAtIndexAsArgs(const ExecutionContext *exe_ctx, uint32_t idx,
+ Args &args) const;
+
+ bool SetPropertyAtIndexFromArgs(const ExecutionContext *exe_ctx, uint32_t idx,
+ const Args &args);
+
+ bool GetPropertyAtIndexAsBoolean(const ExecutionContext *exe_ctx,
+ uint32_t idx, bool fail_value) const;
+
+ bool SetPropertyAtIndexAsBoolean(const ExecutionContext *exe_ctx,
+ uint32_t idx, bool new_value);
+
+ OptionValueDictionary *
+ GetPropertyAtIndexAsOptionValueDictionary(const ExecutionContext *exe_ctx,
+ uint32_t idx) const;
+
+ int64_t GetPropertyAtIndexAsEnumeration(const ExecutionContext *exe_ctx,
+ uint32_t idx,
+ int64_t fail_value) const;
+
+ bool SetPropertyAtIndexAsEnumeration(const ExecutionContext *exe_ctx,
+ uint32_t idx, int64_t new_value);
+
+ const FormatEntity::Entry *
+ GetPropertyAtIndexAsFormatEntity(const ExecutionContext *exe_ctx,
+ uint32_t idx);
+
+ const RegularExpression *
+ GetPropertyAtIndexAsOptionValueRegex(const ExecutionContext *exe_ctx,
+ uint32_t idx) const;
+
+ OptionValueSInt64 *
+ GetPropertyAtIndexAsOptionValueSInt64(const ExecutionContext *exe_ctx,
+ uint32_t idx) const;
+
+ int64_t GetPropertyAtIndexAsSInt64(const ExecutionContext *exe_ctx,
+ uint32_t idx, int64_t fail_value) const;
+
+ bool SetPropertyAtIndexAsSInt64(const ExecutionContext *exe_ctx, uint32_t idx,
+ int64_t new_value);
+
+ uint64_t GetPropertyAtIndexAsUInt64(const ExecutionContext *exe_ctx,
+ uint32_t idx, uint64_t fail_value) const;
+
+ bool SetPropertyAtIndexAsUInt64(const ExecutionContext *exe_ctx, uint32_t idx,
+ uint64_t new_value);
+
+ const char *GetPropertyAtIndexAsString(const ExecutionContext *exe_ctx,
+ uint32_t idx,
+ const char *fail_value) const;
+
+ bool SetPropertyAtIndexAsString(const ExecutionContext *exe_ctx, uint32_t idx,
+ const char *new_value);
+
+ OptionValueString *
+ GetPropertyAtIndexAsOptionValueString(const ExecutionContext *exe_ctx,
+ bool will_modify, uint32_t idx) const;
+
+ OptionValueFileSpec *
+ GetPropertyAtIndexAsOptionValueFileSpec(const ExecutionContext *exe_ctx,
+ bool will_modify, uint32_t idx) const;
+
+ FileSpec GetPropertyAtIndexAsFileSpec(const ExecutionContext *exe_ctx,
+ uint32_t idx) const;
+
+ bool SetPropertyAtIndexAsFileSpec(const ExecutionContext *exe_ctx,
+ uint32_t idx, const FileSpec &file_spec);
+
+ OptionValuePathMappings *GetPropertyAtIndexAsOptionValuePathMappings(
+ const ExecutionContext *exe_ctx, bool will_modify, uint32_t idx) const;
+
+ OptionValueFileSpecList *GetPropertyAtIndexAsOptionValueFileSpecList(
+ const ExecutionContext *exe_ctx, bool will_modify, uint32_t idx) const;
+
+ void AppendProperty(const ConstString &name, const ConstString &desc,
+ bool is_global, const lldb::OptionValueSP &value_sp);
+
+ lldb::OptionValuePropertiesSP GetSubProperty(const ExecutionContext *exe_ctx,
+ const ConstString &name);
+
+ void SetValueChangedCallback(uint32_t property_idx,
+ OptionValueChangedCallback callback,
+ void *baton);
protected:
- Property *
- ProtectedGetPropertyAtIndex(uint32_t idx)
- {
- return ((idx < m_properties.size()) ? &m_properties[idx] : nullptr);
- }
-
- const Property *
- ProtectedGetPropertyAtIndex(uint32_t idx) const
- {
- return ((idx < m_properties.size()) ? &m_properties[idx] : nullptr);
- }
-
- typedef UniqueCStringMap<size_t> NameToIndex;
-
- ConstString m_name;
- std::vector<Property> m_properties;
- NameToIndex m_name_to_index;
+ Property *ProtectedGetPropertyAtIndex(uint32_t idx) {
+ return ((idx < m_properties.size()) ? &m_properties[idx] : nullptr);
+ }
+
+ const Property *ProtectedGetPropertyAtIndex(uint32_t idx) const {
+ return ((idx < m_properties.size()) ? &m_properties[idx] : nullptr);
+ }
+
+ typedef UniqueCStringMap<size_t> NameToIndex;
+
+ ConstString m_name;
+ std::vector<Property> m_properties;
+ NameToIndex m_name_to_index;
};
} // namespace lldb_private
Modified: lldb/trunk/include/lldb/Interpreter/OptionValueRegex.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Interpreter/OptionValueRegex.h?rev=280751&r1=280750&r2=280751&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Interpreter/OptionValueRegex.h (original)
+++ lldb/trunk/include/lldb/Interpreter/OptionValueRegex.h Tue Sep 6 15:57:50 2016
@@ -19,71 +19,52 @@
namespace lldb_private {
-class OptionValueRegex : public OptionValue
-{
+class OptionValueRegex : public OptionValue {
public:
- OptionValueRegex(const char *value = nullptr) :
- OptionValue(),
- m_regex (value)
- {
- }
-
- ~OptionValueRegex() override = default;
-
- //---------------------------------------------------------------------
- // Virtual subclass pure virtual overrides
- //---------------------------------------------------------------------
-
- OptionValue::Type
- GetType() const override
- {
- return eTypeRegex;
- }
-
- void
- DumpValue(const ExecutionContext *exe_ctx, Stream &strm, uint32_t dump_mask) override;
-
- Error
- SetValueFromString(llvm::StringRef value,
- VarSetOperationType op = eVarSetOperationAssign) override;
-
- bool
- Clear() override
- {
- m_regex.Clear();
- m_value_was_set = false;
- return true;
- }
-
- lldb::OptionValueSP
- DeepCopy() const override;
-
- //---------------------------------------------------------------------
- // Subclass specific functions
- //---------------------------------------------------------------------
- const RegularExpression *
- GetCurrentValue() const
- {
- return (m_regex.IsValid() ? &m_regex : nullptr);
- }
-
- void
- SetCurrentValue (const char *value)
- {
- if (value && value[0])
- m_regex.Compile (value);
- else
- m_regex.Clear();
- }
-
- bool
- IsValid () const
- {
- return m_regex.IsValid();
- }
-
+ OptionValueRegex(const char *value = nullptr)
+ : OptionValue(), m_regex(value) {}
+
+ ~OptionValueRegex() override = default;
+
+ //---------------------------------------------------------------------
+ // Virtual subclass pure virtual overrides
+ //---------------------------------------------------------------------
+
+ OptionValue::Type GetType() const override { return eTypeRegex; }
+
+ void DumpValue(const ExecutionContext *exe_ctx, Stream &strm,
+ uint32_t dump_mask) override;
+
+ Error
+ SetValueFromString(llvm::StringRef value,
+ VarSetOperationType op = eVarSetOperationAssign) override;
+
+ bool Clear() override {
+ m_regex.Clear();
+ m_value_was_set = false;
+ return true;
+ }
+
+ lldb::OptionValueSP DeepCopy() const override;
+
+ //---------------------------------------------------------------------
+ // Subclass specific functions
+ //---------------------------------------------------------------------
+ const RegularExpression *GetCurrentValue() const {
+ return (m_regex.IsValid() ? &m_regex : nullptr);
+ }
+
+ void SetCurrentValue(const char *value) {
+ if (value && value[0])
+ m_regex.Compile(value);
+ else
+ m_regex.Clear();
+ }
+
+ bool IsValid() const { return m_regex.IsValid(); }
+
protected:
- RegularExpression m_regex;
+ RegularExpression m_regex;
};
} // namespace lldb_private
Modified: lldb/trunk/include/lldb/Interpreter/OptionValueSInt64.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Interpreter/OptionValueSInt64.h?rev=280751&r1=280750&r2=280751&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Interpreter/OptionValueSInt64.h (original)
+++ lldb/trunk/include/lldb/Interpreter/OptionValueSInt64.h Tue Sep 6 15:57:50 2016
@@ -1,4 +1,5 @@
-//===-- OptionValueSInt64.h --------------------------------------*- C++ -*-===//
+//===-- OptionValueSInt64.h --------------------------------------*- C++
+//-*-===//
//
// The LLVM Compiler Infrastructure
//
@@ -18,152 +19,91 @@
namespace lldb_private {
-class OptionValueSInt64 : public OptionValue
-{
+class OptionValueSInt64 : public OptionValue {
public:
- OptionValueSInt64 () :
- OptionValue(),
- m_current_value (0),
- m_default_value (0),
- m_min_value (INT64_MIN),
- m_max_value (INT64_MAX)
- {
- }
+ OptionValueSInt64()
+ : OptionValue(), m_current_value(0), m_default_value(0),
+ m_min_value(INT64_MIN), m_max_value(INT64_MAX) {}
- OptionValueSInt64 (int64_t value) :
- OptionValue(),
- m_current_value (value),
- m_default_value (value),
- m_min_value (INT64_MIN),
- m_max_value (INT64_MAX)
- {
- }
+ OptionValueSInt64(int64_t value)
+ : OptionValue(), m_current_value(value), m_default_value(value),
+ m_min_value(INT64_MIN), m_max_value(INT64_MAX) {}
- OptionValueSInt64 (int64_t current_value,
- int64_t default_value) :
- OptionValue(),
- m_current_value (current_value),
- m_default_value (default_value),
- m_min_value (INT64_MIN),
- m_max_value (INT64_MAX)
- {
- }
-
- OptionValueSInt64 (const OptionValueSInt64 &rhs) :
- OptionValue(rhs),
- m_current_value (rhs.m_current_value),
- m_default_value (rhs.m_default_value),
- m_min_value (rhs.m_min_value),
- m_max_value (rhs.m_max_value)
- {
- }
+ OptionValueSInt64(int64_t current_value, int64_t default_value)
+ : OptionValue(), m_current_value(current_value),
+ m_default_value(default_value), m_min_value(INT64_MIN),
+ m_max_value(INT64_MAX) {}
- ~OptionValueSInt64() override
- {
- }
-
- //---------------------------------------------------------------------
- // Virtual subclass pure virtual overrides
- //---------------------------------------------------------------------
-
- OptionValue::Type
- GetType() const override
- {
- return eTypeSInt64;
- }
-
- void
- DumpValue(const ExecutionContext *exe_ctx, Stream &strm, uint32_t dump_mask) override;
-
- Error
- SetValueFromString(llvm::StringRef value,
- VarSetOperationType op = eVarSetOperationAssign) override;
-
- bool
- Clear() override
- {
- m_current_value = m_default_value;
- m_value_was_set = false;
- return true;
- }
-
- lldb::OptionValueSP
- DeepCopy() const override;
-
- //---------------------------------------------------------------------
- // Subclass specific functions
- //---------------------------------------------------------------------
-
- const int64_t &
- operator = (int64_t value)
- {
- m_current_value = value;
- return m_current_value;
- }
+ OptionValueSInt64(const OptionValueSInt64 &rhs)
+ : OptionValue(rhs), m_current_value(rhs.m_current_value),
+ m_default_value(rhs.m_default_value), m_min_value(rhs.m_min_value),
+ m_max_value(rhs.m_max_value) {}
- int64_t
- GetCurrentValue() const
- {
- return m_current_value;
- }
-
- int64_t
- GetDefaultValue() const
- {
- return m_default_value;
- }
-
- bool
- SetCurrentValue (int64_t value)
- {
- if (value >= m_min_value && value <= m_max_value)
- {
- m_current_value = value;
- return true;
- }
- return false;
- }
-
- bool
- SetDefaultValue (int64_t value)
- {
- if (value >= m_min_value && value <= m_max_value)
- {
- m_default_value = value;
- return true;
- }
- return false;
- }
-
- void
- SetMinimumValue (int64_t v)
- {
- m_min_value = v;
- }
+ ~OptionValueSInt64() override {}
- int64_t
- GetMinimumValue () const
- {
- return m_min_value;
- }
-
- void
- SetMaximumValue (int64_t v)
- {
- m_max_value = v;
+ //---------------------------------------------------------------------
+ // Virtual subclass pure virtual overrides
+ //---------------------------------------------------------------------
+
+ OptionValue::Type GetType() const override { return eTypeSInt64; }
+
+ void DumpValue(const ExecutionContext *exe_ctx, Stream &strm,
+ uint32_t dump_mask) override;
+
+ Error
+ SetValueFromString(llvm::StringRef value,
+ VarSetOperationType op = eVarSetOperationAssign) override;
+
+ bool Clear() override {
+ m_current_value = m_default_value;
+ m_value_was_set = false;
+ return true;
+ }
+
+ lldb::OptionValueSP DeepCopy() const override;
+
+ //---------------------------------------------------------------------
+ // Subclass specific functions
+ //---------------------------------------------------------------------
+
+ const int64_t &operator=(int64_t value) {
+ m_current_value = value;
+ return m_current_value;
+ }
+
+ int64_t GetCurrentValue() const { return m_current_value; }
+
+ int64_t GetDefaultValue() const { return m_default_value; }
+
+ bool SetCurrentValue(int64_t value) {
+ if (value >= m_min_value && value <= m_max_value) {
+ m_current_value = value;
+ return true;
}
+ return false;
+ }
- int64_t
- GetMaximumValue () const
- {
- return m_max_value;
+ bool SetDefaultValue(int64_t value) {
+ if (value >= m_min_value && value <= m_max_value) {
+ m_default_value = value;
+ return true;
}
+ return false;
+ }
+
+ void SetMinimumValue(int64_t v) { m_min_value = v; }
+
+ int64_t GetMinimumValue() const { return m_min_value; }
+
+ void SetMaximumValue(int64_t v) { m_max_value = v; }
+
+ int64_t GetMaximumValue() const { return m_max_value; }
protected:
- int64_t m_current_value;
- int64_t m_default_value;
- int64_t m_min_value;
- int64_t m_max_value;
+ int64_t m_current_value;
+ int64_t m_default_value;
+ int64_t m_min_value;
+ int64_t m_max_value;
};
} // namespace lldb_private
Modified: lldb/trunk/include/lldb/Interpreter/OptionValueString.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Interpreter/OptionValueString.h?rev=280751&r1=280750&r2=280751&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Interpreter/OptionValueString.h (original)
+++ lldb/trunk/include/lldb/Interpreter/OptionValueString.h Tue Sep 6 15:57:50 2016
@@ -21,200 +21,119 @@
namespace lldb_private {
-class OptionValueString : public OptionValue
-{
+class OptionValueString : public OptionValue {
public:
- typedef Error (*ValidatorCallback) (const char* string,
- void* baton);
-
- enum Options
- {
- eOptionEncodeCharacterEscapeSequences = (1u << 0)
- };
-
- OptionValueString () :
- OptionValue(),
- m_current_value (),
- m_default_value (),
- m_options(),
- m_validator(),
- m_validator_baton()
- {
- }
-
- OptionValueString(ValidatorCallback validator,
- void* baton = nullptr) :
- OptionValue(),
- m_current_value (),
- m_default_value (),
- m_options(),
- m_validator(validator),
- m_validator_baton(baton)
- {
- }
+ typedef Error (*ValidatorCallback)(const char *string, void *baton);
- OptionValueString (const char *value) :
- OptionValue(),
- m_current_value (),
- m_default_value (),
- m_options(),
- m_validator(),
- m_validator_baton()
- {
- if (value && value[0])
- {
- m_current_value.assign (value);
- m_default_value.assign (value);
- }
- }
+ enum Options { eOptionEncodeCharacterEscapeSequences = (1u << 0) };
- OptionValueString (const char *current_value,
- const char *default_value) :
- OptionValue(),
- m_current_value (),
- m_default_value (),
- m_options(),
- m_validator(),
- m_validator_baton()
- {
- if (current_value && current_value[0])
- m_current_value.assign (current_value);
- if (default_value && default_value[0])
- m_default_value.assign (default_value);
- }
-
- OptionValueString(const char *value,
- ValidatorCallback validator,
- void* baton = nullptr) :
- OptionValue(),
- m_current_value (),
- m_default_value (),
- m_options(),
- m_validator(validator),
- m_validator_baton(baton)
- {
- if (value && value[0])
- {
- m_current_value.assign (value);
- m_default_value.assign (value);
- }
- }
-
- OptionValueString(const char *current_value,
- const char *default_value,
- ValidatorCallback validator,
- void* baton = nullptr) :
- OptionValue(),
- m_current_value (),
- m_default_value (),
- m_options(),
- m_validator(validator),
- m_validator_baton(baton)
- {
- if (current_value && current_value[0])
- m_current_value.assign (current_value);
- if (default_value && default_value[0])
- m_default_value.assign (default_value);
- }
-
- ~OptionValueString() override = default;
+ OptionValueString()
+ : OptionValue(), m_current_value(), m_default_value(), m_options(),
+ m_validator(), m_validator_baton() {}
- //---------------------------------------------------------------------
- // Virtual subclass pure virtual overrides
- //---------------------------------------------------------------------
-
- OptionValue::Type
- GetType() const override
- {
- return eTypeString;
- }
-
- void
- DumpValue(const ExecutionContext *exe_ctx, Stream &strm, uint32_t dump_mask) override;
-
- Error
- SetValueFromString(llvm::StringRef value,
- VarSetOperationType op = eVarSetOperationAssign) override;
-
- bool
- Clear() override
- {
- m_current_value = m_default_value;
- m_value_was_set = false;
- return true;
+ OptionValueString(ValidatorCallback validator, void *baton = nullptr)
+ : OptionValue(), m_current_value(), m_default_value(), m_options(),
+ m_validator(validator), m_validator_baton(baton) {}
+
+ OptionValueString(const char *value)
+ : OptionValue(), m_current_value(), m_default_value(), m_options(),
+ m_validator(), m_validator_baton() {
+ if (value && value[0]) {
+ m_current_value.assign(value);
+ m_default_value.assign(value);
}
+ }
- lldb::OptionValueSP
- DeepCopy() const override;
+ OptionValueString(const char *current_value, const char *default_value)
+ : OptionValue(), m_current_value(), m_default_value(), m_options(),
+ m_validator(), m_validator_baton() {
+ if (current_value && current_value[0])
+ m_current_value.assign(current_value);
+ if (default_value && default_value[0])
+ m_default_value.assign(default_value);
+ }
- //---------------------------------------------------------------------
- // Subclass specific functions
- //---------------------------------------------------------------------
-
- Flags &
- GetOptions ()
- {
- return m_options;
+ OptionValueString(const char *value, ValidatorCallback validator,
+ void *baton = nullptr)
+ : OptionValue(), m_current_value(), m_default_value(), m_options(),
+ m_validator(validator), m_validator_baton(baton) {
+ if (value && value[0]) {
+ m_current_value.assign(value);
+ m_default_value.assign(value);
}
+ }
- const Flags &
- GetOptions () const
- {
- return m_options;
- }
-
- const char *
- operator = (const char *value)
- {
- SetCurrentValue(value);
- return m_current_value.c_str();
- }
+ OptionValueString(const char *current_value, const char *default_value,
+ ValidatorCallback validator, void *baton = nullptr)
+ : OptionValue(), m_current_value(), m_default_value(), m_options(),
+ m_validator(validator), m_validator_baton(baton) {
+ if (current_value && current_value[0])
+ m_current_value.assign(current_value);
+ if (default_value && default_value[0])
+ m_default_value.assign(default_value);
+ }
- const char *
- GetCurrentValue() const
- {
- return m_current_value.c_str();
- }
-
- const char *
- GetDefaultValue() const
- {
- return m_default_value.c_str();
- }
-
- Error
- SetCurrentValue (const char *value);
-
- Error
- AppendToCurrentValue (const char *value);
-
- void
- SetDefaultValue (const char *value)
- {
- if (value && value[0])
- m_default_value.assign (value);
- else
- m_default_value.clear();
- }
+ ~OptionValueString() override = default;
- bool
- IsCurrentValueEmpty () const
- {
- return m_current_value.empty();
- }
+ //---------------------------------------------------------------------
+ // Virtual subclass pure virtual overrides
+ //---------------------------------------------------------------------
- bool
- IsDefaultValueEmpty () const
- {
- return m_default_value.empty();
- }
+ OptionValue::Type GetType() const override { return eTypeString; }
+
+ void DumpValue(const ExecutionContext *exe_ctx, Stream &strm,
+ uint32_t dump_mask) override;
+
+ Error
+ SetValueFromString(llvm::StringRef value,
+ VarSetOperationType op = eVarSetOperationAssign) override;
+
+ bool Clear() override {
+ m_current_value = m_default_value;
+ m_value_was_set = false;
+ return true;
+ }
+
+ lldb::OptionValueSP DeepCopy() const override;
+
+ //---------------------------------------------------------------------
+ // Subclass specific functions
+ //---------------------------------------------------------------------
+
+ Flags &GetOptions() { return m_options; }
+
+ const Flags &GetOptions() const { return m_options; }
+
+ const char *operator=(const char *value) {
+ SetCurrentValue(value);
+ return m_current_value.c_str();
+ }
+
+ const char *GetCurrentValue() const { return m_current_value.c_str(); }
+
+ const char *GetDefaultValue() const { return m_default_value.c_str(); }
+
+ Error SetCurrentValue(const char *value);
+
+ Error AppendToCurrentValue(const char *value);
+
+ void SetDefaultValue(const char *value) {
+ if (value && value[0])
+ m_default_value.assign(value);
+ else
+ m_default_value.clear();
+ }
+
+ bool IsCurrentValueEmpty() const { return m_current_value.empty(); }
+
+ bool IsDefaultValueEmpty() const { return m_default_value.empty(); }
protected:
- std::string m_current_value;
- std::string m_default_value;
- Flags m_options;
- ValidatorCallback m_validator;
- void* m_validator_baton;
+ std::string m_current_value;
+ std::string m_default_value;
+ Flags m_options;
+ ValidatorCallback m_validator;
+ void *m_validator_baton;
};
} // namespace lldb_private
Modified: lldb/trunk/include/lldb/Interpreter/OptionValueUInt64.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Interpreter/OptionValueUInt64.h?rev=280751&r1=280750&r2=280751&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Interpreter/OptionValueUInt64.h (original)
+++ lldb/trunk/include/lldb/Interpreter/OptionValueUInt64.h Tue Sep 6 15:57:50 2016
@@ -1,4 +1,5 @@
-//===-- OptionValueUInt64.h --------------------------------------*- C++ -*-===//
+//===-- OptionValueUInt64.h --------------------------------------*- C++
+//-*-===//
//
// The LLVM Compiler Infrastructure
//
@@ -17,115 +18,70 @@
#include "lldb/Interpreter/OptionValue.h"
namespace lldb_private {
-
-class OptionValueUInt64 : public OptionValue
-{
+
+class OptionValueUInt64 : public OptionValue {
public:
- OptionValueUInt64 () :
- OptionValue(),
- m_current_value (0),
- m_default_value (0)
- {
- }
-
- OptionValueUInt64 (uint64_t value) :
- OptionValue(),
- m_current_value (value),
- m_default_value (value)
- {
- }
-
- OptionValueUInt64 (uint64_t current_value,
- uint64_t default_value) :
- OptionValue(),
- m_current_value (current_value),
- m_default_value (default_value)
- {
- }
-
- ~OptionValueUInt64() override
- {
- }
-
- //---------------------------------------------------------------------
- // Decode a uint64_t from "value_cstr" return a OptionValueUInt64 object
- // inside of a lldb::OptionValueSP object if all goes well. If the
- // string isn't a uint64_t value or any other error occurs, return an
- // empty lldb::OptionValueSP and fill error in with the correct stuff.
- //---------------------------------------------------------------------
- static lldb::OptionValueSP
- Create (const char *value_cstr, Error &error);
- //---------------------------------------------------------------------
- // Virtual subclass pure virtual overrides
- //---------------------------------------------------------------------
-
- OptionValue::Type
- GetType() const override
- {
- return eTypeUInt64;
- }
-
- void
- DumpValue(const ExecutionContext *exe_ctx, Stream &strm, uint32_t dump_mask) override;
-
- Error
- SetValueFromString(llvm::StringRef value,
- VarSetOperationType op = eVarSetOperationAssign) override;
-
- bool
- Clear() override
- {
- m_current_value = m_default_value;
- m_value_was_set = false;
- return true;
- }
-
- lldb::OptionValueSP
- DeepCopy() const override;
-
- //---------------------------------------------------------------------
- // Subclass specific functions
- //---------------------------------------------------------------------
-
- const uint64_t &
- operator = (uint64_t value)
- {
- m_current_value = value;
- return m_current_value;
- }
-
- operator uint64_t () const
- {
- return m_current_value;
- }
-
- uint64_t
- GetCurrentValue() const
- {
- return m_current_value;
- }
-
- uint64_t
- GetDefaultValue() const
- {
- return m_default_value;
- }
-
- void
- SetCurrentValue (uint64_t value)
- {
- m_current_value = value;
- }
-
- void
- SetDefaultValue (uint64_t value)
- {
- m_default_value = value;
- }
-
+ OptionValueUInt64() : OptionValue(), m_current_value(0), m_default_value(0) {}
+
+ OptionValueUInt64(uint64_t value)
+ : OptionValue(), m_current_value(value), m_default_value(value) {}
+
+ OptionValueUInt64(uint64_t current_value, uint64_t default_value)
+ : OptionValue(), m_current_value(current_value),
+ m_default_value(default_value) {}
+
+ ~OptionValueUInt64() override {}
+
+ //---------------------------------------------------------------------
+ // Decode a uint64_t from "value_cstr" return a OptionValueUInt64 object
+ // inside of a lldb::OptionValueSP object if all goes well. If the
+ // string isn't a uint64_t value or any other error occurs, return an
+ // empty lldb::OptionValueSP and fill error in with the correct stuff.
+ //---------------------------------------------------------------------
+ static lldb::OptionValueSP Create(const char *value_cstr, Error &error);
+ //---------------------------------------------------------------------
+ // Virtual subclass pure virtual overrides
+ //---------------------------------------------------------------------
+
+ OptionValue::Type GetType() const override { return eTypeUInt64; }
+
+ void DumpValue(const ExecutionContext *exe_ctx, Stream &strm,
+ uint32_t dump_mask) override;
+
+ Error
+ SetValueFromString(llvm::StringRef value,
+ VarSetOperationType op = eVarSetOperationAssign) override;
+
+ bool Clear() override {
+ m_current_value = m_default_value;
+ m_value_was_set = false;
+ return true;
+ }
+
+ lldb::OptionValueSP DeepCopy() const override;
+
+ //---------------------------------------------------------------------
+ // Subclass specific functions
+ //---------------------------------------------------------------------
+
+ const uint64_t &operator=(uint64_t value) {
+ m_current_value = value;
+ return m_current_value;
+ }
+
+ operator uint64_t() const { return m_current_value; }
+
+ uint64_t GetCurrentValue() const { return m_current_value; }
+
+ uint64_t GetDefaultValue() const { return m_default_value; }
+
+ void SetCurrentValue(uint64_t value) { m_current_value = value; }
+
+ void SetDefaultValue(uint64_t value) { m_default_value = value; }
+
protected:
- uint64_t m_current_value;
- uint64_t m_default_value;
+ uint64_t m_current_value;
+ uint64_t m_default_value;
};
} // namespace lldb_private
Modified: lldb/trunk/include/lldb/Interpreter/OptionValueUUID.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Interpreter/OptionValueUUID.h?rev=280751&r1=280750&r2=280751&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Interpreter/OptionValueUUID.h (original)
+++ lldb/trunk/include/lldb/Interpreter/OptionValueUUID.h Tue Sep 6 15:57:50 2016
@@ -19,85 +19,51 @@
namespace lldb_private {
-class OptionValueUUID : public OptionValue
-{
+class OptionValueUUID : public OptionValue {
public:
- OptionValueUUID () :
- OptionValue(),
- m_uuid ()
- {
- }
-
- OptionValueUUID (const UUID &uuid) :
- OptionValue(),
- m_uuid (uuid)
- {
- }
-
- ~OptionValueUUID() override
- {
- }
-
- //---------------------------------------------------------------------
- // Virtual subclass pure virtual overrides
- //---------------------------------------------------------------------
-
- OptionValue::Type
- GetType() const override
- {
- return eTypeUUID;
- }
-
- void
- DumpValue(const ExecutionContext *exe_ctx, Stream &strm, uint32_t dump_mask) override;
-
- Error
- SetValueFromString(llvm::StringRef value,
- VarSetOperationType op = eVarSetOperationAssign) override;
-
- bool
- Clear() override
- {
- m_uuid.Clear();
- m_value_was_set = false;
- return true;
- }
-
- lldb::OptionValueSP
- DeepCopy() const override;
-
- //---------------------------------------------------------------------
- // Subclass specific functions
- //---------------------------------------------------------------------
-
- UUID &
- GetCurrentValue()
- {
- return m_uuid;
- }
-
- const UUID &
- GetCurrentValue() const
- {
- return m_uuid;
- }
-
- void
- SetCurrentValue (const UUID &value)
- {
- m_uuid = value;
- }
-
- size_t
- AutoComplete(CommandInterpreter &interpreter,
- const char *s,
- int match_start_point,
- int max_return_elements,
- bool &word_complete,
- StringList &matches) override;
+ OptionValueUUID() : OptionValue(), m_uuid() {}
+
+ OptionValueUUID(const UUID &uuid) : OptionValue(), m_uuid(uuid) {}
+
+ ~OptionValueUUID() override {}
+
+ //---------------------------------------------------------------------
+ // Virtual subclass pure virtual overrides
+ //---------------------------------------------------------------------
+
+ OptionValue::Type GetType() const override { return eTypeUUID; }
+
+ void DumpValue(const ExecutionContext *exe_ctx, Stream &strm,
+ uint32_t dump_mask) override;
+
+ Error
+ SetValueFromString(llvm::StringRef value,
+ VarSetOperationType op = eVarSetOperationAssign) override;
+
+ bool Clear() override {
+ m_uuid.Clear();
+ m_value_was_set = false;
+ return true;
+ }
+
+ lldb::OptionValueSP DeepCopy() const override;
+
+ //---------------------------------------------------------------------
+ // Subclass specific functions
+ //---------------------------------------------------------------------
+
+ UUID &GetCurrentValue() { return m_uuid; }
+
+ const UUID &GetCurrentValue() const { return m_uuid; }
+
+ void SetCurrentValue(const UUID &value) { m_uuid = value; }
+
+ size_t AutoComplete(CommandInterpreter &interpreter, const char *s,
+ int match_start_point, int max_return_elements,
+ bool &word_complete, StringList &matches) override;
protected:
- UUID m_uuid;
+ UUID m_uuid;
};
} // namespace lldb_private
Modified: lldb/trunk/include/lldb/Interpreter/OptionValues.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Interpreter/OptionValues.h?rev=280751&r1=280750&r2=280751&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Interpreter/OptionValues.h (original)
+++ lldb/trunk/include/lldb/Interpreter/OptionValues.h Tue Sep 6 15:57:50 2016
@@ -21,8 +21,8 @@
#include "lldb/Interpreter/OptionValueFileSpec.h"
#include "lldb/Interpreter/OptionValueFileSpecList.h"
#include "lldb/Interpreter/OptionValueFormat.h"
-#include "lldb/Interpreter/OptionValueLanguage.h"
#include "lldb/Interpreter/OptionValueFormatEntity.h"
+#include "lldb/Interpreter/OptionValueLanguage.h"
#include "lldb/Interpreter/OptionValuePathMappings.h"
#include "lldb/Interpreter/OptionValueProperties.h"
#include "lldb/Interpreter/OptionValueRegex.h"
@@ -31,4 +31,4 @@
#include "lldb/Interpreter/OptionValueUInt64.h"
#include "lldb/Interpreter/OptionValueUUID.h"
-#endif // liblldb_OptionValues_h_
+#endif // liblldb_OptionValues_h_
Modified: lldb/trunk/include/lldb/Interpreter/Options.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Interpreter/Options.h?rev=280751&r1=280750&r2=280751&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Interpreter/Options.h (original)
+++ lldb/trunk/include/lldb/Interpreter/Options.h Tue Sep 6 15:57:50 2016
@@ -17,19 +17,17 @@
// Other libraries and framework includes
// Project includes
-#include "lldb/lldb-private.h"
-#include "lldb/lldb-defines.h"
#include "lldb/Interpreter/Args.h"
+#include "lldb/lldb-defines.h"
+#include "lldb/lldb-private.h"
namespace lldb_private {
- static inline bool
- isprint8 (int ch)
- {
- if (ch & 0xffffff00u)
- return false;
- return isprint(ch);
- }
+static inline bool isprint8(int ch) {
+ if (ch & 0xffffff00u)
+ return false;
+ return isprint(ch);
+}
//----------------------------------------------------------------------
/// @class Options Options.h "lldb/Interpreter/Options.h"
@@ -45,7 +43,8 @@ namespace lldb_private {
/// options parsing function getopt_long_only:
/// \code
/// #include <getopt.h>
-/// int getopt_long_only(int argc, char * const *argv, const char *optstring, const struct option *longopts, int *longindex);
+/// int getopt_long_only(int argc, char * const *argv, const char
+/// *optstring, const struct option *longopts, int *longindex);
/// \endcode
///
/// Example code:
@@ -62,7 +61,8 @@ namespace lldb_private {
/// }
///
/// virtual Error
-/// SetOptionValue (uint32_t option_idx, int option_val, const char *option_arg)
+/// SetOptionValue (uint32_t option_idx, int option_val, const char
+/// *option_arg)
/// {
/// Error error;
/// switch (option_val)
@@ -72,14 +72,16 @@ namespace lldb_private {
/// case 'l': log_file = option_arg; break;
/// case 'f': log_flags = strtoull(option_arg, nullptr, 0); break;
/// default:
-/// error.SetErrorStringWithFormat("unrecognized short option %c", option_val);
+/// error.SetErrorStringWithFormat("unrecognized short option
+/// %c", option_val);
/// break;
/// }
///
/// return error;
/// }
///
-/// CommandOptions (CommandInterpreter &interpreter) : debug (true), verbose (false), log_file (), log_flags (0)
+/// CommandOptions (CommandInterpreter &interpreter) : debug (true),
+/// verbose (false), log_file (), log_flags (0)
/// {}
///
/// bool debug;
@@ -114,382 +116,313 @@ namespace lldb_private {
/// }
/// \endcode
//----------------------------------------------------------------------
-class Options
-{
+class Options {
public:
- Options ();
+ Options();
- virtual
- ~Options ();
+ virtual ~Options();
- void
- BuildGetoptTable ();
+ void BuildGetoptTable();
- void
- BuildValidOptionSets ();
-
- uint32_t
- NumCommandOptions ();
-
- //------------------------------------------------------------------
- /// Get the option definitions to use when parsing Args options.
- ///
- /// @see Args::ParseOptions (Options&)
- /// @see man getopt_long_only
- //------------------------------------------------------------------
- Option *
- GetLongOptions ();
-
- // This gets passed the short option as an integer...
- void
- OptionSeen (int short_option);
-
- bool
- VerifyOptions (CommandReturnObject &result);
-
- // Verify that the options given are in the options table and can
- // be used together, but there may be some required options that are
- // missing (used to verify options that get folded into command aliases).
- bool
- VerifyPartialOptions (CommandReturnObject &result);
-
- void
- OutputFormattedUsageText (Stream &strm,
- const OptionDefinition &option_def,
- uint32_t output_max_columns);
-
- void
- GenerateOptionUsage (Stream &strm,
- CommandObject *cmd,
- uint32_t screen_width);
-
- bool
- SupportsLongOption (const char *long_option);
-
- // The following two pure virtual functions must be defined by every
- // class that inherits from this class.
-
- virtual const OptionDefinition*
- GetDefinitions()
- {
- return nullptr;
- }
-
- // Call this prior to parsing any options. This call will call the
- // subclass OptionParsingStarting() and will avoid the need for all
- // OptionParsingStarting() function instances from having to call the
- // Option::OptionParsingStarting() like they did before. This was error
- // prone and subclasses shouldn't have to do it.
- void
- NotifyOptionParsingStarting (ExecutionContext *execution_context);
-
- Error
- NotifyOptionParsingFinished (ExecutionContext *execution_context);
-
- //------------------------------------------------------------------
- /// Set the value of an option.
- ///
- /// @param[in] option_idx
- /// The index into the "struct option" array that was returned
- /// by Options::GetLongOptions().
- ///
- /// @param[in] option_arg
- /// The argument value for the option that the user entered, or
- /// nullptr if there is no argument for the current option.
- ///
- /// @param[in] execution_context
- /// The execution context to use for evaluating the option.
- /// May be nullptr if the option is to be evaluated outside any
- /// particular context.
- ///
- /// @see Args::ParseOptions (Options&)
- /// @see man getopt_long_only
- //------------------------------------------------------------------
- virtual Error
- SetOptionValue (uint32_t option_idx, const char *option_arg,
- ExecutionContext *execution_context) = 0;
-
- //------------------------------------------------------------------
- /// Handles the generic bits of figuring out whether we are in an
- /// option, and if so completing it.
- ///
- /// @param[in] input
- /// The command line parsed into words
- ///
- /// @param[in] cursor_index
- /// The index in \ainput of the word in which the cursor lies.
- ///
- /// @param[in] char_pos
- /// The character position of the cursor in its argument word.
- ///
- /// @param[in] match_start_point
- /// @param[in] match_return_elements
- /// See CommandObject::HandleCompletions for a description of
- /// how these work.
- ///
- /// @param[in] interpreter
- /// The interpreter that's doing the completing.
- ///
- /// @param[out] word_complete
- /// \btrue if this is a complete option value (a space will be
- /// inserted after the completion.) \b false otherwise.
- ///
- /// @param[out] matches
- /// The array of matches returned.
- ///
- /// FIXME: This is the wrong return value, since we also need to
- /// make a distinction between total number of matches, and the
- /// window the user wants returned.
- ///
- /// @return
- /// \btrue if we were in an option, \bfalse otherwise.
- //------------------------------------------------------------------
- bool
- HandleOptionCompletion (Args &input,
- OptionElementVector &option_map,
- int cursor_index,
- int char_pos,
- int match_start_point,
- int max_return_elements,
- CommandInterpreter &interpreter,
- bool &word_complete,
- lldb_private::StringList &matches);
-
- //------------------------------------------------------------------
- /// Handles the generic bits of figuring out whether we are in an
- /// option, and if so completing it.
- ///
- /// @param[in] interpreter
- /// The command interpreter doing the completion.
- ///
- /// @param[in] input
- /// The command line parsed into words
- ///
- /// @param[in] cursor_index
- /// The index in \ainput of the word in which the cursor lies.
- ///
- /// @param[in] char_pos
- /// The character position of the cursor in its argument word.
- ///
- /// @param[in] opt_element_vector
- /// The results of the options parse of \a input.
- ///
- /// @param[in] opt_element_index
- /// The position in \a opt_element_vector of the word in \a
- /// input containing the cursor.
- ///
- /// @param[in] match_start_point
- /// @param[in] match_return_elements
- /// See CommandObject::HandleCompletions for a description of
- /// how these work.
- ///
- /// @param[in] interpreter
- /// The command interpreter in which we're doing completion.
- ///
- /// @param[out] word_complete
- /// \btrue if this is a complete option value (a space will
- /// be inserted after the completion.) \bfalse otherwise.
- ///
- /// @param[out] matches
- /// The array of matches returned.
- ///
- /// FIXME: This is the wrong return value, since we also need to
- /// make a distinction between total number of matches, and the
- /// window the user wants returned.
- ///
- /// @return
- /// \btrue if we were in an option, \bfalse otherwise.
- //------------------------------------------------------------------
- virtual bool
- HandleOptionArgumentCompletion (Args &input,
- int cursor_index,
- int char_pos,
- OptionElementVector &opt_element_vector,
- int opt_element_index,
- int match_start_point,
- int max_return_elements,
- CommandInterpreter &interpreter,
- bool &word_complete,
- StringList &matches);
+ void BuildValidOptionSets();
+
+ uint32_t NumCommandOptions();
+
+ //------------------------------------------------------------------
+ /// Get the option definitions to use when parsing Args options.
+ ///
+ /// @see Args::ParseOptions (Options&)
+ /// @see man getopt_long_only
+ //------------------------------------------------------------------
+ Option *GetLongOptions();
+
+ // This gets passed the short option as an integer...
+ void OptionSeen(int short_option);
+
+ bool VerifyOptions(CommandReturnObject &result);
+
+ // Verify that the options given are in the options table and can
+ // be used together, but there may be some required options that are
+ // missing (used to verify options that get folded into command aliases).
+ bool VerifyPartialOptions(CommandReturnObject &result);
+
+ void OutputFormattedUsageText(Stream &strm,
+ const OptionDefinition &option_def,
+ uint32_t output_max_columns);
+
+ void GenerateOptionUsage(Stream &strm, CommandObject *cmd,
+ uint32_t screen_width);
+
+ bool SupportsLongOption(const char *long_option);
+
+ // The following two pure virtual functions must be defined by every
+ // class that inherits from this class.
+
+ virtual const OptionDefinition *GetDefinitions() { return nullptr; }
+
+ // Call this prior to parsing any options. This call will call the
+ // subclass OptionParsingStarting() and will avoid the need for all
+ // OptionParsingStarting() function instances from having to call the
+ // Option::OptionParsingStarting() like they did before. This was error
+ // prone and subclasses shouldn't have to do it.
+ void NotifyOptionParsingStarting(ExecutionContext *execution_context);
+
+ Error NotifyOptionParsingFinished(ExecutionContext *execution_context);
+
+ //------------------------------------------------------------------
+ /// Set the value of an option.
+ ///
+ /// @param[in] option_idx
+ /// The index into the "struct option" array that was returned
+ /// by Options::GetLongOptions().
+ ///
+ /// @param[in] option_arg
+ /// The argument value for the option that the user entered, or
+ /// nullptr if there is no argument for the current option.
+ ///
+ /// @param[in] execution_context
+ /// The execution context to use for evaluating the option.
+ /// May be nullptr if the option is to be evaluated outside any
+ /// particular context.
+ ///
+ /// @see Args::ParseOptions (Options&)
+ /// @see man getopt_long_only
+ //------------------------------------------------------------------
+ virtual Error SetOptionValue(uint32_t option_idx, const char *option_arg,
+ ExecutionContext *execution_context) = 0;
+
+ //------------------------------------------------------------------
+ /// Handles the generic bits of figuring out whether we are in an
+ /// option, and if so completing it.
+ ///
+ /// @param[in] input
+ /// The command line parsed into words
+ ///
+ /// @param[in] cursor_index
+ /// The index in \ainput of the word in which the cursor lies.
+ ///
+ /// @param[in] char_pos
+ /// The character position of the cursor in its argument word.
+ ///
+ /// @param[in] match_start_point
+ /// @param[in] match_return_elements
+ /// See CommandObject::HandleCompletions for a description of
+ /// how these work.
+ ///
+ /// @param[in] interpreter
+ /// The interpreter that's doing the completing.
+ ///
+ /// @param[out] word_complete
+ /// \btrue if this is a complete option value (a space will be
+ /// inserted after the completion.) \b false otherwise.
+ ///
+ /// @param[out] matches
+ /// The array of matches returned.
+ ///
+ /// FIXME: This is the wrong return value, since we also need to
+ /// make a distinction between total number of matches, and the
+ /// window the user wants returned.
+ ///
+ /// @return
+ /// \btrue if we were in an option, \bfalse otherwise.
+ //------------------------------------------------------------------
+ bool HandleOptionCompletion(Args &input, OptionElementVector &option_map,
+ int cursor_index, int char_pos,
+ int match_start_point, int max_return_elements,
+ CommandInterpreter &interpreter,
+ bool &word_complete,
+ lldb_private::StringList &matches);
+
+ //------------------------------------------------------------------
+ /// Handles the generic bits of figuring out whether we are in an
+ /// option, and if so completing it.
+ ///
+ /// @param[in] interpreter
+ /// The command interpreter doing the completion.
+ ///
+ /// @param[in] input
+ /// The command line parsed into words
+ ///
+ /// @param[in] cursor_index
+ /// The index in \ainput of the word in which the cursor lies.
+ ///
+ /// @param[in] char_pos
+ /// The character position of the cursor in its argument word.
+ ///
+ /// @param[in] opt_element_vector
+ /// The results of the options parse of \a input.
+ ///
+ /// @param[in] opt_element_index
+ /// The position in \a opt_element_vector of the word in \a
+ /// input containing the cursor.
+ ///
+ /// @param[in] match_start_point
+ /// @param[in] match_return_elements
+ /// See CommandObject::HandleCompletions for a description of
+ /// how these work.
+ ///
+ /// @param[in] interpreter
+ /// The command interpreter in which we're doing completion.
+ ///
+ /// @param[out] word_complete
+ /// \btrue if this is a complete option value (a space will
+ /// be inserted after the completion.) \bfalse otherwise.
+ ///
+ /// @param[out] matches
+ /// The array of matches returned.
+ ///
+ /// FIXME: This is the wrong return value, since we also need to
+ /// make a distinction between total number of matches, and the
+ /// window the user wants returned.
+ ///
+ /// @return
+ /// \btrue if we were in an option, \bfalse otherwise.
+ //------------------------------------------------------------------
+ virtual bool
+ HandleOptionArgumentCompletion(Args &input, int cursor_index, int char_pos,
+ OptionElementVector &opt_element_vector,
+ int opt_element_index, int match_start_point,
+ int max_return_elements,
+ CommandInterpreter &interpreter,
+ bool &word_complete, StringList &matches);
protected:
- // This is a set of options expressed as indexes into the options table for this Option.
- typedef std::set<int> OptionSet;
- typedef std::vector<OptionSet> OptionSetVector;
-
- std::vector<Option> m_getopt_table;
- OptionSet m_seen_options;
- OptionSetVector m_required_options;
- OptionSetVector m_optional_options;
-
- OptionSetVector &GetRequiredOptions ()
- {
- BuildValidOptionSets();
- return m_required_options;
- }
-
- OptionSetVector &GetOptionalOptions ()
- {
- BuildValidOptionSets();
- return m_optional_options;
- }
-
- bool
- IsASubset (const OptionSet& set_a, const OptionSet& set_b);
-
- size_t
- OptionsSetDiff (const OptionSet &set_a, const OptionSet &set_b, OptionSet &diffs);
-
- void
- OptionsSetUnion (const OptionSet &set_a, const OptionSet &set_b, OptionSet &union_set);
-
- // Subclasses must reset their option values prior to starting a new
- // option parse. Each subclass must override this function and revert
- // all option settings to default values.
- virtual void
- OptionParsingStarting (ExecutionContext *execution_context) = 0;
-
- virtual Error
- OptionParsingFinished (ExecutionContext *execution_context)
- {
- // If subclasses need to know when the options are done being parsed
- // they can implement this function to do extra checking
- Error error;
- return error;
- }
+ // This is a set of options expressed as indexes into the options table for
+ // this Option.
+ typedef std::set<int> OptionSet;
+ typedef std::vector<OptionSet> OptionSetVector;
+
+ std::vector<Option> m_getopt_table;
+ OptionSet m_seen_options;
+ OptionSetVector m_required_options;
+ OptionSetVector m_optional_options;
+
+ OptionSetVector &GetRequiredOptions() {
+ BuildValidOptionSets();
+ return m_required_options;
+ }
+
+ OptionSetVector &GetOptionalOptions() {
+ BuildValidOptionSets();
+ return m_optional_options;
+ }
+
+ bool IsASubset(const OptionSet &set_a, const OptionSet &set_b);
+
+ size_t OptionsSetDiff(const OptionSet &set_a, const OptionSet &set_b,
+ OptionSet &diffs);
+
+ void OptionsSetUnion(const OptionSet &set_a, const OptionSet &set_b,
+ OptionSet &union_set);
+
+ // Subclasses must reset their option values prior to starting a new
+ // option parse. Each subclass must override this function and revert
+ // all option settings to default values.
+ virtual void OptionParsingStarting(ExecutionContext *execution_context) = 0;
+
+ virtual Error OptionParsingFinished(ExecutionContext *execution_context) {
+ // If subclasses need to know when the options are done being parsed
+ // they can implement this function to do extra checking
+ Error error;
+ return error;
+ }
};
- class OptionGroup
- {
- public:
- OptionGroup() = default;
-
- virtual
- ~OptionGroup() = default;
-
- virtual uint32_t
- GetNumDefinitions () = 0;
-
- virtual const OptionDefinition*
- GetDefinitions () = 0;
-
- virtual Error
- SetOptionValue (uint32_t option_idx,
- const char *option_value,
- ExecutionContext *execution_context) = 0;
-
- virtual void
- OptionParsingStarting(ExecutionContext *execution_context) = 0;
-
- virtual Error
- OptionParsingFinished(ExecutionContext *execution_context)
- {
- // If subclasses need to know when the options are done being parsed
- // they can implement this function to do extra checking
- Error error;
- return error;
- }
- };
-
- class OptionGroupOptions : public Options
- {
- public:
- OptionGroupOptions () :
- Options (),
- m_option_defs (),
- m_option_infos (),
- m_did_finalize (false)
- {
- }
-
- ~OptionGroupOptions() override = default;
-
- //----------------------------------------------------------------------
- /// Append options from a OptionGroup class.
- ///
- /// Append all options from \a group using the exact same option groups
- /// that each option is defined with.
- ///
- /// @param[in] group
- /// A group of options to take option values from and copy their
- /// definitions into this class.
- //----------------------------------------------------------------------
- void
- Append (OptionGroup* group);
-
- //----------------------------------------------------------------------
- /// Append options from a OptionGroup class.
- ///
- /// Append options from \a group that have a usage mask that has any bits
- /// in "src_mask" set. After the option definition is copied into the
- /// options definitions in this class, set the usage_mask to "dst_mask".
- ///
- /// @param[in] group
- /// A group of options to take option values from and copy their
- /// definitions into this class.
- ///
- /// @param[in] src_mask
- /// When copying options from \a group, you might only want some of
- /// the options to be appended to this group. This mask allows you
- /// to control which options from \a group get added. It also allows
- /// you to specify the same options from \a group multiple times
- /// for different option sets.
- ///
- /// @param[in] dst_mask
- /// Set the usage mask for any copied options to \a dst_mask after
- /// copying the option definition.
- //----------------------------------------------------------------------
- void
- Append (OptionGroup* group,
- uint32_t src_mask,
- uint32_t dst_mask);
-
- void
- Finalize ();
-
- bool
- DidFinalize ()
- {
- return m_did_finalize;
- }
-
- Error
- SetOptionValue(uint32_t option_idx,
- const char *option_arg,
+class OptionGroup {
+public:
+ OptionGroup() = default;
+
+ virtual ~OptionGroup() = default;
+
+ virtual uint32_t GetNumDefinitions() = 0;
+
+ virtual const OptionDefinition *GetDefinitions() = 0;
+
+ virtual Error SetOptionValue(uint32_t option_idx, const char *option_value,
+ ExecutionContext *execution_context) = 0;
+
+ virtual void OptionParsingStarting(ExecutionContext *execution_context) = 0;
+
+ virtual Error OptionParsingFinished(ExecutionContext *execution_context) {
+ // If subclasses need to know when the options are done being parsed
+ // they can implement this function to do extra checking
+ Error error;
+ return error;
+ }
+};
+
+class OptionGroupOptions : public Options {
+public:
+ OptionGroupOptions()
+ : Options(), m_option_defs(), m_option_infos(), m_did_finalize(false) {}
+
+ ~OptionGroupOptions() override = default;
+
+ //----------------------------------------------------------------------
+ /// Append options from a OptionGroup class.
+ ///
+ /// Append all options from \a group using the exact same option groups
+ /// that each option is defined with.
+ ///
+ /// @param[in] group
+ /// A group of options to take option values from and copy their
+ /// definitions into this class.
+ //----------------------------------------------------------------------
+ void Append(OptionGroup *group);
+
+ //----------------------------------------------------------------------
+ /// Append options from a OptionGroup class.
+ ///
+ /// Append options from \a group that have a usage mask that has any bits
+ /// in "src_mask" set. After the option definition is copied into the
+ /// options definitions in this class, set the usage_mask to "dst_mask".
+ ///
+ /// @param[in] group
+ /// A group of options to take option values from and copy their
+ /// definitions into this class.
+ ///
+ /// @param[in] src_mask
+ /// When copying options from \a group, you might only want some of
+ /// the options to be appended to this group. This mask allows you
+ /// to control which options from \a group get added. It also allows
+ /// you to specify the same options from \a group multiple times
+ /// for different option sets.
+ ///
+ /// @param[in] dst_mask
+ /// Set the usage mask for any copied options to \a dst_mask after
+ /// copying the option definition.
+ //----------------------------------------------------------------------
+ void Append(OptionGroup *group, uint32_t src_mask, uint32_t dst_mask);
+
+ void Finalize();
+
+ bool DidFinalize() { return m_did_finalize; }
+
+ Error SetOptionValue(uint32_t option_idx, const char *option_arg,
ExecutionContext *execution_context) override;
-
- void
- OptionParsingStarting(ExecutionContext *execution_context) override;
-
- Error
- OptionParsingFinished(ExecutionContext *execution_context) override;
-
- const OptionDefinition*
- GetDefinitions() override
- {
- assert (m_did_finalize);
- return &m_option_defs[0];
- }
-
- const OptionGroup*
- GetGroupWithOption (char short_opt);
-
- struct OptionInfo
- {
- OptionInfo (OptionGroup* g, uint32_t i) :
- option_group (g),
- option_index (i)
- {
- }
- OptionGroup* option_group; // The group that this option came from
- uint32_t option_index; // The original option index from the OptionGroup
- };
- typedef std::vector<OptionInfo> OptionInfos;
-
- std::vector<OptionDefinition> m_option_defs;
- OptionInfos m_option_infos;
- bool m_did_finalize;
- };
+
+ void OptionParsingStarting(ExecutionContext *execution_context) override;
+
+ Error OptionParsingFinished(ExecutionContext *execution_context) override;
+
+ const OptionDefinition *GetDefinitions() override {
+ assert(m_did_finalize);
+ return &m_option_defs[0];
+ }
+
+ const OptionGroup *GetGroupWithOption(char short_opt);
+
+ struct OptionInfo {
+ OptionInfo(OptionGroup *g, uint32_t i) : option_group(g), option_index(i) {}
+ OptionGroup *option_group; // The group that this option came from
+ uint32_t option_index; // The original option index from the OptionGroup
+ };
+ typedef std::vector<OptionInfo> OptionInfos;
+
+ std::vector<OptionDefinition> m_option_defs;
+ OptionInfos m_option_infos;
+ bool m_did_finalize;
+};
} // namespace lldb_private
Modified: lldb/trunk/include/lldb/Interpreter/Property.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Interpreter/Property.h?rev=280751&r1=280750&r2=280751&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Interpreter/Property.h (original)
+++ lldb/trunk/include/lldb/Interpreter/Property.h Tue Sep 6 15:57:50 2016
@@ -16,97 +16,65 @@
// Other libraries and framework includes
// Project includes
-#include "lldb/lldb-defines.h"
#include "lldb/Core/ConstString.h"
#include "lldb/Core/Flags.h"
#include "lldb/Interpreter/OptionValue.h"
+#include "lldb/lldb-defines.h"
namespace lldb_private {
- // A structure that can be used to create a global table for all properties.
- // Property class instances can be constructed using one of these.
- struct PropertyDefinition
- {
- const char *name;
- OptionValue::Type type;
- bool global; // false == this setting is a global setting by default
- uintptr_t default_uint_value;
- const char *default_cstr_value;
- OptionEnumValueElement *enum_values;
- const char *description;
- };
-
- class Property
- {
- public:
- Property (const PropertyDefinition &definition);
-
- Property (const ConstString &name,
- const ConstString &desc,
- bool is_global,
- const lldb::OptionValueSP &value_sp);
-
- const ConstString &
- GetName() const
- {
- return m_name;
- }
-
- const char *
- GetDescription () const
- {
- return m_description.GetCString();
- }
-
- const lldb::OptionValueSP &
- GetValue() const
- {
- return m_value_sp;
- }
-
- void
- SetOptionValue (const lldb::OptionValueSP &value_sp)
- {
- m_value_sp = value_sp;
- }
-
-
- bool
- IsValid() const
- {
- return (bool)m_value_sp;
- }
-
- bool
- IsGlobal () const
- {
- return m_is_global;
- }
-
- void
- Dump (const ExecutionContext *exe_ctx,
- Stream &strm,
- uint32_t dump_mask) const;
-
- bool
- DumpQualifiedName(Stream &strm) const;
-
- void
- DumpDescription (CommandInterpreter &interpreter,
- Stream &strm,
- uint32_t output_width,
- bool display_qualified_name) const;
-
- void
- SetValueChangedCallback (OptionValueChangedCallback callback, void *baton);
-
- protected:
- ConstString m_name;
- ConstString m_description;
- lldb::OptionValueSP m_value_sp;
- bool m_is_global;
- };
+// A structure that can be used to create a global table for all properties.
+// Property class instances can be constructed using one of these.
+struct PropertyDefinition {
+ const char *name;
+ OptionValue::Type type;
+ bool global; // false == this setting is a global setting by default
+ uintptr_t default_uint_value;
+ const char *default_cstr_value;
+ OptionEnumValueElement *enum_values;
+ const char *description;
+};
+
+class Property {
+public:
+ Property(const PropertyDefinition &definition);
+
+ Property(const ConstString &name, const ConstString &desc, bool is_global,
+ const lldb::OptionValueSP &value_sp);
+
+ const ConstString &GetName() const { return m_name; }
+
+ const char *GetDescription() const { return m_description.GetCString(); }
+
+ const lldb::OptionValueSP &GetValue() const { return m_value_sp; }
+
+ void SetOptionValue(const lldb::OptionValueSP &value_sp) {
+ m_value_sp = value_sp;
+ }
+
+ bool IsValid() const { return (bool)m_value_sp; }
+
+ bool IsGlobal() const { return m_is_global; }
+
+ void Dump(const ExecutionContext *exe_ctx, Stream &strm,
+ uint32_t dump_mask) const;
+
+ bool DumpQualifiedName(Stream &strm) const;
+
+ void DumpDescription(CommandInterpreter &interpreter, Stream &strm,
+ uint32_t output_width,
+ bool display_qualified_name) const;
+
+ void SetValueChangedCallback(OptionValueChangedCallback callback,
+ void *baton);
+
+protected:
+ ConstString m_name;
+ ConstString m_description;
+ lldb::OptionValueSP m_value_sp;
+ bool m_is_global;
+};
} // namespace lldb_private
-#endif // liblldb_Property_h_
+#endif // liblldb_Property_h_
Modified: lldb/trunk/include/lldb/Interpreter/ScriptInterpreter.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Interpreter/ScriptInterpreter.h?rev=280751&r1=280750&r2=280751&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Interpreter/ScriptInterpreter.h (original)
+++ lldb/trunk/include/lldb/Interpreter/ScriptInterpreter.h Tue Sep 6 15:57:50 2016
@@ -24,518 +24,415 @@
#include "lldb/Utility/PseudoTerminal.h"
namespace lldb_private {
-
-class ScriptInterpreterLocker
-{
+
+class ScriptInterpreterLocker {
public:
-
- ScriptInterpreterLocker() = default;
-
- virtual ~ScriptInterpreterLocker() = default;
+ ScriptInterpreterLocker() = default;
+
+ virtual ~ScriptInterpreterLocker() = default;
private:
- DISALLOW_COPY_AND_ASSIGN (ScriptInterpreterLocker);
+ DISALLOW_COPY_AND_ASSIGN(ScriptInterpreterLocker);
};
-class ScriptInterpreter : public PluginInterface
-{
+class ScriptInterpreter : public PluginInterface {
public:
- typedef enum
- {
- eScriptReturnTypeCharPtr,
- eScriptReturnTypeBool,
- eScriptReturnTypeShortInt,
- eScriptReturnTypeShortIntUnsigned,
- eScriptReturnTypeInt,
- eScriptReturnTypeIntUnsigned,
- eScriptReturnTypeLongInt,
- eScriptReturnTypeLongIntUnsigned,
- eScriptReturnTypeLongLong,
- eScriptReturnTypeLongLongUnsigned,
- eScriptReturnTypeFloat,
- eScriptReturnTypeDouble,
- eScriptReturnTypeChar,
- eScriptReturnTypeCharStrOrNone,
- eScriptReturnTypeOpaqueObject
- } ScriptReturnType;
-
- ScriptInterpreter (CommandInterpreter &interpreter, lldb::ScriptLanguage script_lang);
-
- ~ScriptInterpreter() override;
-
- struct ExecuteScriptOptions
- {
- public:
- ExecuteScriptOptions () :
- m_enable_io(true),
- m_set_lldb_globals(true),
- m_maskout_errors(true)
- {
- }
-
- bool
- GetEnableIO () const
- {
- return m_enable_io;
- }
-
- bool
- GetSetLLDBGlobals () const
- {
- return m_set_lldb_globals;
- }
-
- bool
- GetMaskoutErrors () const
- {
- return m_maskout_errors;
- }
-
- ExecuteScriptOptions&
- SetEnableIO (bool enable)
- {
- m_enable_io = enable;
- return *this;
- }
-
- ExecuteScriptOptions&
- SetSetLLDBGlobals (bool set)
- {
- m_set_lldb_globals = set;
- return *this;
- }
-
- ExecuteScriptOptions&
- SetMaskoutErrors (bool maskout)
- {
- m_maskout_errors = maskout;
- return *this;
- }
-
- private:
- bool m_enable_io;
- bool m_set_lldb_globals;
- bool m_maskout_errors;
- };
-
- virtual bool
- Interrupt()
- {
- return false;
- }
-
- virtual bool
- ExecuteOneLine (const char *command,
- CommandReturnObject *result,
- const ExecuteScriptOptions &options = ExecuteScriptOptions()) = 0;
-
- virtual void
- ExecuteInterpreterLoop () = 0;
-
- virtual bool
- ExecuteOneLineWithReturn (const char *in_string,
- ScriptReturnType return_type,
- void *ret_value,
- const ExecuteScriptOptions &options = ExecuteScriptOptions())
- {
- return true;
- }
-
- virtual Error
- ExecuteMultipleLines (const char *in_string,
- const ExecuteScriptOptions &options = ExecuteScriptOptions())
- {
- Error error;
- error.SetErrorString("not implemented");
- return error;
- }
-
- virtual Error
- ExportFunctionDefinitionToInterpreter (StringList &function_def)
- {
- Error error;
- error.SetErrorString("not implemented");
- return error;
- }
-
- virtual Error
- GenerateBreakpointCommandCallbackData (StringList &input, std::string& output)
- {
- Error error;
- error.SetErrorString("not implemented");
- return error;
- }
-
- virtual bool
- GenerateWatchpointCommandCallbackData (StringList &input, std::string& output)
- {
- return false;
- }
-
- virtual bool
- GenerateTypeScriptFunction(const char* oneliner, std::string& output, const void* name_token = nullptr)
- {
- return false;
- }
-
- virtual bool
- GenerateTypeScriptFunction(StringList &input, std::string& output, const void* name_token = nullptr)
- {
- return false;
- }
-
- virtual bool
- GenerateScriptAliasFunction (StringList &input, std::string& output)
- {
- return false;
- }
-
- virtual bool
- GenerateTypeSynthClass(StringList &input, std::string& output, const void* name_token = nullptr)
- {
- return false;
- }
-
- virtual bool
- GenerateTypeSynthClass(const char* oneliner, std::string& output, const void* name_token = nullptr)
- {
- return false;
- }
-
- virtual StructuredData::ObjectSP
- CreateSyntheticScriptedProvider(const char *class_name, lldb::ValueObjectSP valobj)
- {
- return StructuredData::ObjectSP();
- }
-
- virtual StructuredData::GenericSP
- CreateScriptCommandObject (const char *class_name)
- {
- return StructuredData::GenericSP();
- }
-
- virtual StructuredData::GenericSP
- OSPlugin_CreatePluginObject (const char *class_name,
- lldb::ProcessSP process_sp)
- {
- return StructuredData::GenericSP();
- }
-
- virtual StructuredData::DictionarySP
- OSPlugin_RegisterInfo(StructuredData::ObjectSP os_plugin_object_sp)
- {
- return StructuredData::DictionarySP();
- }
-
- virtual StructuredData::ArraySP
- OSPlugin_ThreadsInfo(StructuredData::ObjectSP os_plugin_object_sp)
- {
- return StructuredData::ArraySP();
- }
-
- virtual StructuredData::StringSP
- OSPlugin_RegisterContextData(StructuredData::ObjectSP os_plugin_object_sp, lldb::tid_t thread_id)
- {
- return StructuredData::StringSP();
- }
-
- virtual StructuredData::DictionarySP
- OSPlugin_CreateThread(StructuredData::ObjectSP os_plugin_object_sp, lldb::tid_t tid, lldb::addr_t context)
- {
- return StructuredData::DictionarySP();
- }
-
- virtual StructuredData::ObjectSP
- CreateScriptedThreadPlan(const char *class_name, lldb::ThreadPlanSP thread_plan_sp)
- {
- return StructuredData::ObjectSP();
- }
-
- virtual bool
- ScriptedThreadPlanExplainsStop(StructuredData::ObjectSP implementor_sp, Event *event, bool &script_error)
- {
- script_error = true;
- return true;
- }
-
- virtual bool
- ScriptedThreadPlanShouldStop(StructuredData::ObjectSP implementor_sp, Event *event, bool &script_error)
- {
- script_error = true;
- return true;
- }
-
- virtual bool
- ScriptedThreadPlanIsStale(StructuredData::ObjectSP implementor_sp, bool &script_error)
- {
- script_error = true;
- return true;
- }
-
- virtual lldb::StateType
- ScriptedThreadPlanGetRunState(StructuredData::ObjectSP implementor_sp, bool &script_error)
- {
- script_error = true;
- return lldb::eStateStepping;
- }
-
- virtual StructuredData::ObjectSP
- LoadPluginModule(const FileSpec &file_spec, lldb_private::Error &error)
- {
- return StructuredData::ObjectSP();
- }
-
- virtual StructuredData::DictionarySP
- GetDynamicSettings(StructuredData::ObjectSP plugin_module_sp, Target *target, const char *setting_name, lldb_private::Error &error)
- {
- return StructuredData::DictionarySP();
- }
-
- virtual Error
- GenerateFunction(const char *signature, const StringList &input)
- {
- Error error;
- error.SetErrorString("unimplemented");
- return error;
- }
-
- virtual void
- CollectDataForBreakpointCommandCallback (std::vector<BreakpointOptions *> &options,
- CommandReturnObject &result);
-
- virtual void
- CollectDataForWatchpointCommandCallback (WatchpointOptions *wp_options,
- CommandReturnObject &result);
-
- /// Set the specified text as the callback for the breakpoint.
- Error
- SetBreakpointCommandCallback (std::vector<BreakpointOptions *> &bp_options_vec,
- const char *callback_text);
-
- virtual Error
- SetBreakpointCommandCallback (BreakpointOptions *bp_options,
- const char *callback_text)
- {
- Error error;
- error.SetErrorString("unimplemented");
- return error;
- }
-
- void
- SetBreakpointCommandCallbackFunction (std::vector<BreakpointOptions *> &bp_options_vec,
- const char *function_name);
-
- /// Set a one-liner as the callback for the breakpoint.
- virtual void
- SetBreakpointCommandCallbackFunction (BreakpointOptions *bp_options,
- const char *function_name)
- {
- }
-
- /// Set a one-liner as the callback for the watchpoint.
- virtual void
- SetWatchpointCommandCallback (WatchpointOptions *wp_options,
- const char *oneliner)
- {
- }
-
- virtual bool
- GetScriptedSummary(const char *function_name, lldb::ValueObjectSP valobj, StructuredData::ObjectSP &callee_wrapper_sp,
- const TypeSummaryOptions &options, std::string &retval)
- {
- return false;
- }
-
- virtual void
- Clear ()
- {
- // Clean up any ref counts to SBObjects that might be in global variables
- }
-
- virtual size_t
- CalculateNumChildren(const StructuredData::ObjectSP &implementor, uint32_t max)
- {
- return 0;
- }
-
- virtual lldb::ValueObjectSP
- GetChildAtIndex(const StructuredData::ObjectSP &implementor, uint32_t idx)
- {
- return lldb::ValueObjectSP();
- }
-
- virtual int
- GetIndexOfChildWithName(const StructuredData::ObjectSP &implementor, const char *child_name)
- {
- return UINT32_MAX;
- }
-
- virtual bool
- UpdateSynthProviderInstance(const StructuredData::ObjectSP &implementor)
- {
- return false;
- }
-
- virtual bool
- MightHaveChildrenSynthProviderInstance(const StructuredData::ObjectSP &implementor)
- {
- return true;
- }
-
- virtual lldb::ValueObjectSP
- GetSyntheticValue(const StructuredData::ObjectSP &implementor)
- {
- return nullptr;
- }
+ typedef enum {
+ eScriptReturnTypeCharPtr,
+ eScriptReturnTypeBool,
+ eScriptReturnTypeShortInt,
+ eScriptReturnTypeShortIntUnsigned,
+ eScriptReturnTypeInt,
+ eScriptReturnTypeIntUnsigned,
+ eScriptReturnTypeLongInt,
+ eScriptReturnTypeLongIntUnsigned,
+ eScriptReturnTypeLongLong,
+ eScriptReturnTypeLongLongUnsigned,
+ eScriptReturnTypeFloat,
+ eScriptReturnTypeDouble,
+ eScriptReturnTypeChar,
+ eScriptReturnTypeCharStrOrNone,
+ eScriptReturnTypeOpaqueObject
+ } ScriptReturnType;
+
+ ScriptInterpreter(CommandInterpreter &interpreter,
+ lldb::ScriptLanguage script_lang);
+
+ ~ScriptInterpreter() override;
+
+ struct ExecuteScriptOptions {
+ public:
+ ExecuteScriptOptions()
+ : m_enable_io(true), m_set_lldb_globals(true), m_maskout_errors(true) {}
+
+ bool GetEnableIO() const { return m_enable_io; }
+
+ bool GetSetLLDBGlobals() const { return m_set_lldb_globals; }
+
+ bool GetMaskoutErrors() const { return m_maskout_errors; }
+
+ ExecuteScriptOptions &SetEnableIO(bool enable) {
+ m_enable_io = enable;
+ return *this;
+ }
+
+ ExecuteScriptOptions &SetSetLLDBGlobals(bool set) {
+ m_set_lldb_globals = set;
+ return *this;
+ }
+
+ ExecuteScriptOptions &SetMaskoutErrors(bool maskout) {
+ m_maskout_errors = maskout;
+ return *this;
+ }
+
+ private:
+ bool m_enable_io;
+ bool m_set_lldb_globals;
+ bool m_maskout_errors;
+ };
+
+ virtual bool Interrupt() { return false; }
+
+ virtual bool ExecuteOneLine(
+ const char *command, CommandReturnObject *result,
+ const ExecuteScriptOptions &options = ExecuteScriptOptions()) = 0;
+
+ virtual void ExecuteInterpreterLoop() = 0;
+
+ virtual bool ExecuteOneLineWithReturn(
+ const char *in_string, ScriptReturnType return_type, void *ret_value,
+ const ExecuteScriptOptions &options = ExecuteScriptOptions()) {
+ return true;
+ }
+
+ virtual Error ExecuteMultipleLines(
+ const char *in_string,
+ const ExecuteScriptOptions &options = ExecuteScriptOptions()) {
+ Error error;
+ error.SetErrorString("not implemented");
+ return error;
+ }
+
+ virtual Error
+ ExportFunctionDefinitionToInterpreter(StringList &function_def) {
+ Error error;
+ error.SetErrorString("not implemented");
+ return error;
+ }
+
+ virtual Error GenerateBreakpointCommandCallbackData(StringList &input,
+ std::string &output) {
+ Error error;
+ error.SetErrorString("not implemented");
+ return error;
+ }
+
+ virtual bool GenerateWatchpointCommandCallbackData(StringList &input,
+ std::string &output) {
+ return false;
+ }
+
+ virtual bool GenerateTypeScriptFunction(const char *oneliner,
+ std::string &output,
+ const void *name_token = nullptr) {
+ return false;
+ }
+
+ virtual bool GenerateTypeScriptFunction(StringList &input,
+ std::string &output,
+ const void *name_token = nullptr) {
+ return false;
+ }
+
+ virtual bool GenerateScriptAliasFunction(StringList &input,
+ std::string &output) {
+ return false;
+ }
+
+ virtual bool GenerateTypeSynthClass(StringList &input, std::string &output,
+ const void *name_token = nullptr) {
+ return false;
+ }
+
+ virtual bool GenerateTypeSynthClass(const char *oneliner, std::string &output,
+ const void *name_token = nullptr) {
+ return false;
+ }
+
+ virtual StructuredData::ObjectSP
+ CreateSyntheticScriptedProvider(const char *class_name,
+ lldb::ValueObjectSP valobj) {
+ return StructuredData::ObjectSP();
+ }
+
+ virtual StructuredData::GenericSP
+ CreateScriptCommandObject(const char *class_name) {
+ return StructuredData::GenericSP();
+ }
+
+ virtual StructuredData::GenericSP
+ OSPlugin_CreatePluginObject(const char *class_name,
+ lldb::ProcessSP process_sp) {
+ return StructuredData::GenericSP();
+ }
+
+ virtual StructuredData::DictionarySP
+ OSPlugin_RegisterInfo(StructuredData::ObjectSP os_plugin_object_sp) {
+ return StructuredData::DictionarySP();
+ }
+
+ virtual StructuredData::ArraySP
+ OSPlugin_ThreadsInfo(StructuredData::ObjectSP os_plugin_object_sp) {
+ return StructuredData::ArraySP();
+ }
+
+ virtual StructuredData::StringSP
+ OSPlugin_RegisterContextData(StructuredData::ObjectSP os_plugin_object_sp,
+ lldb::tid_t thread_id) {
+ return StructuredData::StringSP();
+ }
+
+ virtual StructuredData::DictionarySP
+ OSPlugin_CreateThread(StructuredData::ObjectSP os_plugin_object_sp,
+ lldb::tid_t tid, lldb::addr_t context) {
+ return StructuredData::DictionarySP();
+ }
+
+ virtual StructuredData::ObjectSP
+ CreateScriptedThreadPlan(const char *class_name,
+ lldb::ThreadPlanSP thread_plan_sp) {
+ return StructuredData::ObjectSP();
+ }
+
+ virtual bool
+ ScriptedThreadPlanExplainsStop(StructuredData::ObjectSP implementor_sp,
+ Event *event, bool &script_error) {
+ script_error = true;
+ return true;
+ }
+
+ virtual bool
+ ScriptedThreadPlanShouldStop(StructuredData::ObjectSP implementor_sp,
+ Event *event, bool &script_error) {
+ script_error = true;
+ return true;
+ }
+
+ virtual bool
+ ScriptedThreadPlanIsStale(StructuredData::ObjectSP implementor_sp,
+ bool &script_error) {
+ script_error = true;
+ return true;
+ }
+
+ virtual lldb::StateType
+ ScriptedThreadPlanGetRunState(StructuredData::ObjectSP implementor_sp,
+ bool &script_error) {
+ script_error = true;
+ return lldb::eStateStepping;
+ }
+
+ virtual StructuredData::ObjectSP
+ LoadPluginModule(const FileSpec &file_spec, lldb_private::Error &error) {
+ return StructuredData::ObjectSP();
+ }
+
+ virtual StructuredData::DictionarySP
+ GetDynamicSettings(StructuredData::ObjectSP plugin_module_sp, Target *target,
+ const char *setting_name, lldb_private::Error &error) {
+ return StructuredData::DictionarySP();
+ }
+
+ virtual Error GenerateFunction(const char *signature,
+ const StringList &input) {
+ Error error;
+ error.SetErrorString("unimplemented");
+ return error;
+ }
+
+ virtual void CollectDataForBreakpointCommandCallback(
+ std::vector<BreakpointOptions *> &options, CommandReturnObject &result);
+
+ virtual void
+ CollectDataForWatchpointCommandCallback(WatchpointOptions *wp_options,
+ CommandReturnObject &result);
+
+ /// Set the specified text as the callback for the breakpoint.
+ Error
+ SetBreakpointCommandCallback(std::vector<BreakpointOptions *> &bp_options_vec,
+ const char *callback_text);
+
+ virtual Error SetBreakpointCommandCallback(BreakpointOptions *bp_options,
+ const char *callback_text) {
+ Error error;
+ error.SetErrorString("unimplemented");
+ return error;
+ }
+
+ void SetBreakpointCommandCallbackFunction(
+ std::vector<BreakpointOptions *> &bp_options_vec,
+ const char *function_name);
+
+ /// Set a one-liner as the callback for the breakpoint.
+ virtual void
+ SetBreakpointCommandCallbackFunction(BreakpointOptions *bp_options,
+ const char *function_name) {}
+
+ /// Set a one-liner as the callback for the watchpoint.
+ virtual void SetWatchpointCommandCallback(WatchpointOptions *wp_options,
+ const char *oneliner) {}
+
+ virtual bool GetScriptedSummary(const char *function_name,
+ lldb::ValueObjectSP valobj,
+ StructuredData::ObjectSP &callee_wrapper_sp,
+ const TypeSummaryOptions &options,
+ std::string &retval) {
+ return false;
+ }
+
+ virtual void Clear() {
+ // Clean up any ref counts to SBObjects that might be in global variables
+ }
+
+ virtual size_t
+ CalculateNumChildren(const StructuredData::ObjectSP &implementor,
+ uint32_t max) {
+ return 0;
+ }
+
+ virtual lldb::ValueObjectSP
+ GetChildAtIndex(const StructuredData::ObjectSP &implementor, uint32_t idx) {
+ return lldb::ValueObjectSP();
+ }
+
+ virtual int
+ GetIndexOfChildWithName(const StructuredData::ObjectSP &implementor,
+ const char *child_name) {
+ return UINT32_MAX;
+ }
+
+ virtual bool
+ UpdateSynthProviderInstance(const StructuredData::ObjectSP &implementor) {
+ return false;
+ }
+
+ virtual bool MightHaveChildrenSynthProviderInstance(
+ const StructuredData::ObjectSP &implementor) {
+ return true;
+ }
+
+ virtual lldb::ValueObjectSP
+ GetSyntheticValue(const StructuredData::ObjectSP &implementor) {
+ return nullptr;
+ }
+
+ virtual ConstString
+ GetSyntheticTypeName(const StructuredData::ObjectSP &implementor) {
+ return ConstString();
+ }
+
+ virtual bool
+ RunScriptBasedCommand(const char *impl_function, const char *args,
+ ScriptedCommandSynchronicity synchronicity,
+ lldb_private::CommandReturnObject &cmd_retobj,
+ Error &error,
+ const lldb_private::ExecutionContext &exe_ctx) {
+ return false;
+ }
+
+ virtual bool
+ RunScriptBasedCommand(StructuredData::GenericSP impl_obj_sp, const char *args,
+ ScriptedCommandSynchronicity synchronicity,
+ lldb_private::CommandReturnObject &cmd_retobj,
+ Error &error,
+ const lldb_private::ExecutionContext &exe_ctx) {
+ return false;
+ }
+
+ virtual bool RunScriptFormatKeyword(const char *impl_function,
+ Process *process, std::string &output,
+ Error &error) {
+ error.SetErrorString("unimplemented");
+ return false;
+ }
+
+ virtual bool RunScriptFormatKeyword(const char *impl_function, Thread *thread,
+ std::string &output, Error &error) {
+ error.SetErrorString("unimplemented");
+ return false;
+ }
+
+ virtual bool RunScriptFormatKeyword(const char *impl_function, Target *target,
+ std::string &output, Error &error) {
+ error.SetErrorString("unimplemented");
+ return false;
+ }
+
+ virtual bool RunScriptFormatKeyword(const char *impl_function,
+ StackFrame *frame, std::string &output,
+ Error &error) {
+ error.SetErrorString("unimplemented");
+ return false;
+ }
+
+ virtual bool RunScriptFormatKeyword(const char *impl_function,
+ ValueObject *value, std::string &output,
+ Error &error) {
+ error.SetErrorString("unimplemented");
+ return false;
+ }
+
+ virtual bool GetDocumentationForItem(const char *item, std::string &dest) {
+ dest.clear();
+ return false;
+ }
+
+ virtual bool
+ GetShortHelpForCommandObject(StructuredData::GenericSP cmd_obj_sp,
+ std::string &dest) {
+ dest.clear();
+ return false;
+ }
+
+ virtual uint32_t
+ GetFlagsForCommandObject(StructuredData::GenericSP cmd_obj_sp) {
+ return 0;
+ }
+
+ virtual bool GetLongHelpForCommandObject(StructuredData::GenericSP cmd_obj_sp,
+ std::string &dest) {
+ dest.clear();
+ return false;
+ }
+
+ virtual bool CheckObjectExists(const char *name) { return false; }
+
+ virtual bool
+ LoadScriptingModule(const char *filename, bool can_reload, bool init_session,
+ lldb_private::Error &error,
+ StructuredData::ObjectSP *module_sp = nullptr) {
+ error.SetErrorString("loading unimplemented");
+ return false;
+ }
+
+ virtual bool IsReservedWord(const char *word) { return false; }
+
+ virtual std::unique_ptr<ScriptInterpreterLocker> AcquireInterpreterLock();
+
+ const char *GetScriptInterpreterPtyName();
- virtual ConstString
- GetSyntheticTypeName (const StructuredData::ObjectSP &implementor)
- {
- return ConstString();
- }
-
- virtual bool
- RunScriptBasedCommand (const char* impl_function,
- const char* args,
- ScriptedCommandSynchronicity synchronicity,
- lldb_private::CommandReturnObject& cmd_retobj,
- Error& error,
- const lldb_private::ExecutionContext& exe_ctx)
- {
- return false;
- }
-
- virtual bool
- RunScriptBasedCommand (StructuredData::GenericSP impl_obj_sp,
- const char* args,
- ScriptedCommandSynchronicity synchronicity,
- lldb_private::CommandReturnObject& cmd_retobj,
- Error& error,
- const lldb_private::ExecutionContext& exe_ctx)
- {
- return false;
- }
-
- virtual bool
- RunScriptFormatKeyword (const char* impl_function,
- Process* process,
- std::string& output,
- Error& error)
- {
- error.SetErrorString("unimplemented");
- return false;
- }
-
- virtual bool
- RunScriptFormatKeyword (const char* impl_function,
- Thread* thread,
- std::string& output,
- Error& error)
- {
- error.SetErrorString("unimplemented");
- return false;
- }
-
- virtual bool
- RunScriptFormatKeyword (const char* impl_function,
- Target* target,
- std::string& output,
- Error& error)
- {
- error.SetErrorString("unimplemented");
- return false;
- }
-
- virtual bool
- RunScriptFormatKeyword (const char* impl_function,
- StackFrame* frame,
- std::string& output,
- Error& error)
- {
- error.SetErrorString("unimplemented");
- return false;
- }
-
- virtual bool
- RunScriptFormatKeyword (const char* impl_function,
- ValueObject* value,
- std::string& output,
- Error& error)
- {
- error.SetErrorString("unimplemented");
- return false;
- }
-
- virtual bool
- GetDocumentationForItem (const char* item, std::string& dest)
- {
- dest.clear();
- return false;
- }
-
- virtual bool
- GetShortHelpForCommandObject (StructuredData::GenericSP cmd_obj_sp,
- std::string& dest)
- {
- dest.clear();
- return false;
- }
-
- virtual uint32_t
- GetFlagsForCommandObject (StructuredData::GenericSP cmd_obj_sp)
- {
- return 0;
- }
-
- virtual bool
- GetLongHelpForCommandObject (StructuredData::GenericSP cmd_obj_sp,
- std::string& dest)
- {
- dest.clear();
- return false;
- }
-
- virtual bool
- CheckObjectExists (const char* name)
- {
- return false;
- }
-
- virtual bool
- LoadScriptingModule(const char *filename, bool can_reload, bool init_session, lldb_private::Error &error,
- StructuredData::ObjectSP *module_sp = nullptr)
- {
- error.SetErrorString("loading unimplemented");
- return false;
- }
-
- virtual bool
- IsReservedWord (const char* word)
- {
- return false;
- }
-
- virtual std::unique_ptr<ScriptInterpreterLocker>
- AcquireInterpreterLock ();
-
- const char *
- GetScriptInterpreterPtyName ();
-
- int
- GetMasterFileDescriptor ();
+ int GetMasterFileDescriptor();
- CommandInterpreter &
- GetCommandInterpreter();
+ CommandInterpreter &GetCommandInterpreter();
- static std::string
- LanguageToString (lldb::ScriptLanguage language);
+ static std::string LanguageToString(lldb::ScriptLanguage language);
- virtual void
- ResetOutputFileHandle (FILE *new_fh) { } //By default, do nothing.
+ virtual void ResetOutputFileHandle(FILE *new_fh) {} // By default, do nothing.
protected:
- CommandInterpreter &m_interpreter;
- lldb::ScriptLanguage m_script_lang;
+ CommandInterpreter &m_interpreter;
+ lldb::ScriptLanguage m_script_lang;
};
} // namespace lldb_private
Modified: lldb/trunk/include/lldb/Symbol/ArmUnwindInfo.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Symbol/ArmUnwindInfo.h?rev=280751&r1=280750&r2=280751&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Symbol/ArmUnwindInfo.h (original)
+++ lldb/trunk/include/lldb/Symbol/ArmUnwindInfo.h Tue Sep 6 15:57:50 2016
@@ -29,48 +29,42 @@
namespace lldb_private {
-class ArmUnwindInfo
-{
+class ArmUnwindInfo {
public:
- ArmUnwindInfo(const ObjectFile& objfile,
- lldb::SectionSP& arm_exidx,
- lldb::SectionSP& arm_extab);
+ ArmUnwindInfo(const ObjectFile &objfile, lldb::SectionSP &arm_exidx,
+ lldb::SectionSP &arm_extab);
- ~ArmUnwindInfo();
+ ~ArmUnwindInfo();
- bool
- GetUnwindPlan(Target &target, const Address& addr, UnwindPlan& unwind_plan);
+ bool GetUnwindPlan(Target &target, const Address &addr,
+ UnwindPlan &unwind_plan);
private:
- struct ArmExidxEntry
- {
- ArmExidxEntry(uint32_t f, lldb::addr_t a, uint32_t d);
-
- bool
- operator<(const ArmExidxEntry& other) const;
-
- uint32_t file_address;
- lldb::addr_t address;
- uint32_t data;
- };
-
- const uint8_t*
- GetExceptionHandlingTableEntry(const Address& addr);
-
- uint8_t
- GetByteAtOffset(const uint32_t* data, uint16_t offset) const;
-
- uint64_t
- GetULEB128(const uint32_t* data, uint16_t& offset, uint16_t max_offset) const;
-
- const lldb::ByteOrder m_byte_order;
- lldb::SectionSP m_arm_exidx_sp; // .ARM.exidx section
- lldb::SectionSP m_arm_extab_sp; // .ARM.extab section
- DataExtractor m_arm_exidx_data; // .ARM.exidx section data
- DataExtractor m_arm_extab_data; // .ARM.extab section data
- std::vector<ArmExidxEntry> m_exidx_entries;
+ struct ArmExidxEntry {
+ ArmExidxEntry(uint32_t f, lldb::addr_t a, uint32_t d);
+
+ bool operator<(const ArmExidxEntry &other) const;
+
+ uint32_t file_address;
+ lldb::addr_t address;
+ uint32_t data;
+ };
+
+ const uint8_t *GetExceptionHandlingTableEntry(const Address &addr);
+
+ uint8_t GetByteAtOffset(const uint32_t *data, uint16_t offset) const;
+
+ uint64_t GetULEB128(const uint32_t *data, uint16_t &offset,
+ uint16_t max_offset) const;
+
+ const lldb::ByteOrder m_byte_order;
+ lldb::SectionSP m_arm_exidx_sp; // .ARM.exidx section
+ lldb::SectionSP m_arm_extab_sp; // .ARM.extab section
+ DataExtractor m_arm_exidx_data; // .ARM.exidx section data
+ DataExtractor m_arm_extab_data; // .ARM.extab section data
+ std::vector<ArmExidxEntry> m_exidx_entries;
};
} // namespace lldb_private
-#endif // liblldb_ArmUnwindInfo_h_
+#endif // liblldb_ArmUnwindInfo_h_
Modified: lldb/trunk/include/lldb/Symbol/Block.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Symbol/Block.h?rev=280751&r1=280750&r2=280751&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Symbol/Block.h (original)
+++ lldb/trunk/include/lldb/Symbol/Block.h Tue Sep 6 15:57:50 2016
@@ -16,14 +16,14 @@
// Other libraries and framework includes
// Project includes
-#include "lldb/lldb-private.h"
#include "lldb/Core/AddressRange.h"
#include "lldb/Core/RangeMap.h"
#include "lldb/Core/Stream.h"
#include "lldb/Core/UserID.h"
+#include "lldb/Symbol/CompilerType.h"
#include "lldb/Symbol/LineEntry.h"
#include "lldb/Symbol/SymbolContext.h"
-#include "lldb/Symbol/CompilerType.h"
+#include "lldb/lldb-private.h"
namespace lldb_private {
@@ -45,451 +45,394 @@ namespace lldb_private {
/// InlineFunctionInfo shared pointer object to a block. Inlined
/// functions are represented as named blocks.
//----------------------------------------------------------------------
-class Block :
- public UserID,
- public SymbolContextScope
-{
+class Block : public UserID, public SymbolContextScope {
public:
- typedef RangeArray<uint32_t, uint32_t, 1> RangeList;
- typedef RangeList::Entry Range;
+ typedef RangeArray<uint32_t, uint32_t, 1> RangeList;
+ typedef RangeList::Entry Range;
+
+ //------------------------------------------------------------------
+ /// Construct with a User ID \a uid, \a depth.
+ ///
+ /// Initialize this block with the specified UID \a uid. The
+ /// \a depth in the \a block_list is used to represent the parent,
+ /// sibling, and child block information and also allows for partial
+ /// parsing at the block level.
+ ///
+ /// @param[in] uid
+ /// The UID for a given block. This value is given by the
+ /// SymbolFile plug-in and can be any value that helps the
+ /// SymbolFile plug-in to match this block back to the debug
+ /// information data that it parses for further or more in
+ /// depth parsing. Common values would be the index into a
+ /// table, or an offset into the debug information.
+ ///
+ /// @param[in] depth
+ /// The integer depth of this block in the block list hierarchy.
+ ///
+ /// @param[in] block_list
+ /// The block list that this object belongs to.
+ ///
+ /// @see BlockList
+ //------------------------------------------------------------------
+ Block(lldb::user_id_t uid);
+
+ //------------------------------------------------------------------
+ /// Destructor.
+ //------------------------------------------------------------------
+ ~Block() override;
+
+ //------------------------------------------------------------------
+ /// Add a child to this object.
+ ///
+ /// @param[in] child_block_sp
+ /// A shared pointer to a child block that will get added to
+ /// this block.
+ //------------------------------------------------------------------
+ void AddChild(const lldb::BlockSP &child_block_sp);
+
+ //------------------------------------------------------------------
+ /// Add a new offset range to this block.
+ ///
+ /// @param[in] start_offset
+ /// An offset into this Function's address range that
+ /// describes the start address of a range for this block.
+ ///
+ /// @param[in] end_offset
+ /// An offset into this Function's address range that
+ /// describes the end address of a range for this block.
+ //------------------------------------------------------------------
+ void AddRange(const Range &range);
+
+ void FinalizeRanges();
+
+ //------------------------------------------------------------------
+ /// @copydoc SymbolContextScope::CalculateSymbolContext(SymbolContext*)
+ ///
+ /// @see SymbolContextScope
+ //------------------------------------------------------------------
+ void CalculateSymbolContext(SymbolContext *sc) override;
+
+ lldb::ModuleSP CalculateSymbolContextModule() override;
+
+ CompileUnit *CalculateSymbolContextCompileUnit() override;
+
+ Function *CalculateSymbolContextFunction() override;
+
+ Block *CalculateSymbolContextBlock() override;
+
+ //------------------------------------------------------------------
+ /// Check if an offset is in one of the block offset ranges.
+ ///
+ /// @param[in] range_offset
+ /// An offset into the Function's address range.
+ ///
+ /// @return
+ /// Returns \b true if \a range_offset falls in one of this
+ /// block's ranges, \b false otherwise.
+ //------------------------------------------------------------------
+ bool Contains(lldb::addr_t range_offset) const;
+
+ //------------------------------------------------------------------
+ /// Check if a offset range is in one of the block offset ranges.
+ ///
+ /// @param[in] range
+ /// An offset range into the Function's address range.
+ ///
+ /// @return
+ /// Returns \b true if \a range falls in one of this
+ /// block's ranges, \b false otherwise.
+ //------------------------------------------------------------------
+ bool Contains(const Range &range) const;
+
+ //------------------------------------------------------------------
+ /// Check if this object contains "block" as a child block at any
+ /// depth.
+ ///
+ /// @param[in] block
+ /// A potential child block.
+ ///
+ /// @return
+ /// Returns \b true if \a block is a child of this block, \b
+ /// false otherwise.
+ //------------------------------------------------------------------
+ bool Contains(const Block *block) const;
+
+ //------------------------------------------------------------------
+ /// Dump the block contents.
+ ///
+ /// @param[in] s
+ /// The stream to which to dump the object description.
+ ///
+ /// @param[in] base_addr
+ /// The resolved start address of the Function's address
+ /// range. This should be resolved as the file or load address
+ /// prior to passing the value into this function for dumping.
+ ///
+ /// @param[in] depth
+ /// Limit the number of levels deep that this function should
+ /// print as this block can contain child blocks. Specify
+ /// INT_MAX to dump all child blocks.
+ ///
+ /// @param[in] show_context
+ /// If \b true, variables will dump their context information.
+ //------------------------------------------------------------------
+ void Dump(Stream *s, lldb::addr_t base_addr, int32_t depth,
+ bool show_context) const;
+
+ //------------------------------------------------------------------
+ /// @copydoc SymbolContextScope::DumpSymbolContext(Stream*)
+ ///
+ /// @see SymbolContextScope
+ //------------------------------------------------------------------
+ void DumpSymbolContext(Stream *s) override;
+
+ void DumpAddressRanges(Stream *s, lldb::addr_t base_addr);
+
+ void GetDescription(Stream *s, Function *function,
+ lldb::DescriptionLevel level, Target *target) const;
+
+ //------------------------------------------------------------------
+ /// Get the parent block.
+ ///
+ /// @return
+ /// The parent block pointer, or nullptr if this block has no
+ /// parent.
+ //------------------------------------------------------------------
+ Block *GetParent() const;
+
+ //------------------------------------------------------------------
+ /// Get the inlined block that contains this block.
+ ///
+ /// @return
+ /// If this block contains inlined function info, it will return
+ /// this block, else parent blocks will be searched to see if
+ /// any contain this block. nullptr will be returned if this block
+ /// nor any parent blocks are inlined function blocks.
+ //------------------------------------------------------------------
+ Block *GetContainingInlinedBlock();
+
+ //------------------------------------------------------------------
+ /// Get the inlined parent block for this block.
+ ///
+ /// @return
+ /// The parent block pointer, or nullptr if this block has no
+ /// parent.
+ //------------------------------------------------------------------
+ Block *GetInlinedParent();
+
+ //------------------------------------------------------------------
+ /// Get the sibling block for this block.
+ ///
+ /// @return
+ /// The sibling block pointer, or nullptr if this block has no
+ /// sibling.
+ //------------------------------------------------------------------
+ Block *GetSibling() const;
+
+ //------------------------------------------------------------------
+ /// Get the first child block.
+ ///
+ /// @return
+ /// The first child block pointer, or nullptr if this block has no
+ /// children.
+ //------------------------------------------------------------------
+ Block *GetFirstChild() const {
+ return (m_children.empty() ? nullptr : m_children.front().get());
+ }
+
+ //------------------------------------------------------------------
+ /// Get the variable list for this block only.
+ ///
+ /// @param[in] can_create
+ /// If \b true, the variables can be parsed if they already
+ /// haven't been, else the current state of the block will be
+ /// returned.
+ ///
+ /// @return
+ /// A variable list shared pointer that contains all variables
+ /// for this block.
+ //------------------------------------------------------------------
+ lldb::VariableListSP GetBlockVariableList(bool can_create);
+
+ //------------------------------------------------------------------
+ /// Get the variable list for this block and optionally all child
+ /// blocks if \a get_child_variables is \b true.
+ ///
+ /// @param[in] get_child_variables
+ /// If \b true, all variables from all child blocks will be
+ /// added to the variable list.
+ ///
+ /// @param[in] can_create
+ /// If \b true, the variables can be parsed if they already
+ /// haven't been, else the current state of the block will be
+ /// returned. Passing \b true for this parameter can be used
+ /// to see the current state of what has been parsed up to this
+ /// point.
+ ///
+ /// @param[in] add_inline_child_block_variables
+ /// If this is \b false, no child variables of child blocks
+ /// that are inlined functions will be gotten. If \b true then
+ /// all child variables will be added regardless of whether they
+ /// come from inlined functions or not.
+ ///
+ /// @return
+ /// A variable list shared pointer that contains all variables
+ /// for this block.
+ //------------------------------------------------------------------
+ uint32_t AppendBlockVariables(bool can_create, bool get_child_block_variables,
+ bool stop_if_child_block_is_inlined_function,
+ const std::function<bool(Variable *)> &filter,
+ VariableList *variable_list);
+
+ //------------------------------------------------------------------
+ /// Appends the variables from this block, and optionally from all
+ /// parent blocks, to \a variable_list.
+ ///
+ /// @param[in] can_create
+ /// If \b true, the variables can be parsed if they already
+ /// haven't been, else the current state of the block will be
+ /// returned. Passing \b true for this parameter can be used
+ /// to see the current state of what has been parsed up to this
+ /// point.
+ ///
+ /// @param[in] get_parent_variables
+ /// If \b true, all variables from all parent blocks will be
+ /// added to the variable list.
+ ///
+ /// @param[in] stop_if_block_is_inlined_function
+ /// If \b true, all variables from all parent blocks will be
+ /// added to the variable list until there are no parent blocks
+ /// or the parent block has inlined function info.
+ ///
+ /// @param[in,out] variable_list
+ /// All variables in this block, and optionally all parent
+ /// blocks will be added to this list.
+ ///
+ /// @return
+ /// The number of variable that were appended to \a
+ /// variable_list.
+ //------------------------------------------------------------------
+ uint32_t AppendVariables(bool can_create, bool get_parent_variables,
+ bool stop_if_block_is_inlined_function,
+ const std::function<bool(Variable *)> &filter,
+ VariableList *variable_list);
+
+ //------------------------------------------------------------------
+ /// Get const accessor for any inlined function information.
+ ///
+ /// @return
+ /// A const pointer to any inlined function information, or nullptr
+ /// if this is a regular block.
+ //------------------------------------------------------------------
+ const InlineFunctionInfo *GetInlinedFunctionInfo() const {
+ return m_inlineInfoSP.get();
+ }
+
+ CompilerDeclContext GetDeclContext();
+
+ //------------------------------------------------------------------
+ /// Get the memory cost of this object.
+ ///
+ /// Returns the cost of this object plus any owned objects from the
+ /// ranges, variables, and inline function information.
+ ///
+ /// @return
+ /// The number of bytes that this object occupies in memory.
+ //------------------------------------------------------------------
+ size_t MemorySize() const;
+
+ //------------------------------------------------------------------
+ /// Set accessor for any inlined function information.
+ ///
+ /// @param[in] name
+ /// The method name for the inlined function. This value should
+ /// not be nullptr.
+ ///
+ /// @param[in] mangled
+ /// The mangled method name for the inlined function. This can
+ /// be nullptr if there is no mangled name for an inlined function
+ /// or if the name is the same as \a name.
+ ///
+ /// @param[in] decl_ptr
+ /// A optional pointer to declaration information for the
+ /// inlined function information. This value can be nullptr to
+ /// indicate that no declaration information is available.
+ ///
+ /// @param[in] call_decl_ptr
+ /// Optional calling location declaration information that
+ /// describes from where this inlined function was called.
+ //------------------------------------------------------------------
+ void SetInlinedFunctionInfo(const char *name, const char *mangled,
+ const Declaration *decl_ptr,
+ const Declaration *call_decl_ptr);
+
+ void SetParentScope(SymbolContextScope *parent_scope) {
+ m_parent_scope = parent_scope;
+ }
+
+ //------------------------------------------------------------------
+ /// Set accessor for the variable list.
+ ///
+ /// Called by the SymbolFile plug-ins after they have parsed the
+ /// variable lists and are ready to hand ownership of the list over
+ /// to this object.
+ ///
+ /// @param[in] variable_list_sp
+ /// A shared pointer to a VariableList.
+ //------------------------------------------------------------------
+ void SetVariableList(lldb::VariableListSP &variable_list_sp) {
+ m_variable_list_sp = variable_list_sp;
+ }
+
+ bool BlockInfoHasBeenParsed() const { return m_parsed_block_info; }
+
+ void SetBlockInfoHasBeenParsed(bool b, bool set_children);
+
+ Block *FindBlockByID(lldb::user_id_t block_id);
+
+ size_t GetNumRanges() const { return m_ranges.GetSize(); }
+
+ bool GetRangeContainingOffset(const lldb::addr_t offset, Range &range);
+
+ bool GetRangeContainingAddress(const Address &addr, AddressRange &range);
+
+ bool GetRangeContainingLoadAddress(lldb::addr_t load_addr, Target &target,
+ AddressRange &range);
+
+ uint32_t GetRangeIndexContainingAddress(const Address &addr);
+
+ //------------------------------------------------------------------
+ // Since blocks might have multiple discontiguous address ranges,
+ // we need to be able to get at any of the address ranges in a block.
+ //------------------------------------------------------------------
+ bool GetRangeAtIndex(uint32_t range_idx, AddressRange &range);
+
+ bool GetStartAddress(Address &addr);
- //------------------------------------------------------------------
- /// Construct with a User ID \a uid, \a depth.
- ///
- /// Initialize this block with the specified UID \a uid. The
- /// \a depth in the \a block_list is used to represent the parent,
- /// sibling, and child block information and also allows for partial
- /// parsing at the block level.
- ///
- /// @param[in] uid
- /// The UID for a given block. This value is given by the
- /// SymbolFile plug-in and can be any value that helps the
- /// SymbolFile plug-in to match this block back to the debug
- /// information data that it parses for further or more in
- /// depth parsing. Common values would be the index into a
- /// table, or an offset into the debug information.
- ///
- /// @param[in] depth
- /// The integer depth of this block in the block list hierarchy.
- ///
- /// @param[in] block_list
- /// The block list that this object belongs to.
- ///
- /// @see BlockList
- //------------------------------------------------------------------
- Block (lldb::user_id_t uid);
-
- //------------------------------------------------------------------
- /// Destructor.
- //------------------------------------------------------------------
- ~Block() override;
-
- //------------------------------------------------------------------
- /// Add a child to this object.
- ///
- /// @param[in] child_block_sp
- /// A shared pointer to a child block that will get added to
- /// this block.
- //------------------------------------------------------------------
- void
- AddChild (const lldb::BlockSP &child_block_sp);
-
- //------------------------------------------------------------------
- /// Add a new offset range to this block.
- ///
- /// @param[in] start_offset
- /// An offset into this Function's address range that
- /// describes the start address of a range for this block.
- ///
- /// @param[in] end_offset
- /// An offset into this Function's address range that
- /// describes the end address of a range for this block.
- //------------------------------------------------------------------
- void
- AddRange (const Range& range);
-
- void
- FinalizeRanges ();
-
- //------------------------------------------------------------------
- /// @copydoc SymbolContextScope::CalculateSymbolContext(SymbolContext*)
- ///
- /// @see SymbolContextScope
- //------------------------------------------------------------------
- void
- CalculateSymbolContext(SymbolContext* sc) override;
-
- lldb::ModuleSP
- CalculateSymbolContextModule() override;
-
- CompileUnit *
- CalculateSymbolContextCompileUnit() override;
-
- Function *
- CalculateSymbolContextFunction() override;
-
- Block *
- CalculateSymbolContextBlock() override;
-
- //------------------------------------------------------------------
- /// Check if an offset is in one of the block offset ranges.
- ///
- /// @param[in] range_offset
- /// An offset into the Function's address range.
- ///
- /// @return
- /// Returns \b true if \a range_offset falls in one of this
- /// block's ranges, \b false otherwise.
- //------------------------------------------------------------------
- bool
- Contains (lldb::addr_t range_offset) const;
-
- //------------------------------------------------------------------
- /// Check if a offset range is in one of the block offset ranges.
- ///
- /// @param[in] range
- /// An offset range into the Function's address range.
- ///
- /// @return
- /// Returns \b true if \a range falls in one of this
- /// block's ranges, \b false otherwise.
- //------------------------------------------------------------------
- bool
- Contains (const Range& range) const;
-
- //------------------------------------------------------------------
- /// Check if this object contains "block" as a child block at any
- /// depth.
- ///
- /// @param[in] block
- /// A potential child block.
- ///
- /// @return
- /// Returns \b true if \a block is a child of this block, \b
- /// false otherwise.
- //------------------------------------------------------------------
- bool
- Contains (const Block *block) const;
-
- //------------------------------------------------------------------
- /// Dump the block contents.
- ///
- /// @param[in] s
- /// The stream to which to dump the object description.
- ///
- /// @param[in] base_addr
- /// The resolved start address of the Function's address
- /// range. This should be resolved as the file or load address
- /// prior to passing the value into this function for dumping.
- ///
- /// @param[in] depth
- /// Limit the number of levels deep that this function should
- /// print as this block can contain child blocks. Specify
- /// INT_MAX to dump all child blocks.
- ///
- /// @param[in] show_context
- /// If \b true, variables will dump their context information.
- //------------------------------------------------------------------
- void
- Dump (Stream *s, lldb::addr_t base_addr, int32_t depth, bool show_context) const;
-
- //------------------------------------------------------------------
- /// @copydoc SymbolContextScope::DumpSymbolContext(Stream*)
- ///
- /// @see SymbolContextScope
- //------------------------------------------------------------------
- void
- DumpSymbolContext(Stream *s) override;
-
- void
- DumpAddressRanges (Stream *s,
- lldb::addr_t base_addr);
-
- void
- GetDescription (Stream *s,
- Function *function,
- lldb::DescriptionLevel level,
- Target *target) const;
-
- //------------------------------------------------------------------
- /// Get the parent block.
- ///
- /// @return
- /// The parent block pointer, or nullptr if this block has no
- /// parent.
- //------------------------------------------------------------------
- Block *
- GetParent () const;
-
- //------------------------------------------------------------------
- /// Get the inlined block that contains this block.
- ///
- /// @return
- /// If this block contains inlined function info, it will return
- /// this block, else parent blocks will be searched to see if
- /// any contain this block. nullptr will be returned if this block
- /// nor any parent blocks are inlined function blocks.
- //------------------------------------------------------------------
- Block *
- GetContainingInlinedBlock ();
-
- //------------------------------------------------------------------
- /// Get the inlined parent block for this block.
- ///
- /// @return
- /// The parent block pointer, or nullptr if this block has no
- /// parent.
- //------------------------------------------------------------------
- Block *
- GetInlinedParent ();
-
- //------------------------------------------------------------------
- /// Get the sibling block for this block.
- ///
- /// @return
- /// The sibling block pointer, or nullptr if this block has no
- /// sibling.
- //------------------------------------------------------------------
- Block *
- GetSibling () const;
-
- //------------------------------------------------------------------
- /// Get the first child block.
- ///
- /// @return
- /// The first child block pointer, or nullptr if this block has no
- /// children.
- //------------------------------------------------------------------
- Block *
- GetFirstChild () const
- {
- return (m_children.empty() ? nullptr : m_children.front().get());
- }
-
- //------------------------------------------------------------------
- /// Get the variable list for this block only.
- ///
- /// @param[in] can_create
- /// If \b true, the variables can be parsed if they already
- /// haven't been, else the current state of the block will be
- /// returned.
- ///
- /// @return
- /// A variable list shared pointer that contains all variables
- /// for this block.
- //------------------------------------------------------------------
- lldb::VariableListSP
- GetBlockVariableList (bool can_create);
-
- //------------------------------------------------------------------
- /// Get the variable list for this block and optionally all child
- /// blocks if \a get_child_variables is \b true.
- ///
- /// @param[in] get_child_variables
- /// If \b true, all variables from all child blocks will be
- /// added to the variable list.
- ///
- /// @param[in] can_create
- /// If \b true, the variables can be parsed if they already
- /// haven't been, else the current state of the block will be
- /// returned. Passing \b true for this parameter can be used
- /// to see the current state of what has been parsed up to this
- /// point.
- ///
- /// @param[in] add_inline_child_block_variables
- /// If this is \b false, no child variables of child blocks
- /// that are inlined functions will be gotten. If \b true then
- /// all child variables will be added regardless of whether they
- /// come from inlined functions or not.
- ///
- /// @return
- /// A variable list shared pointer that contains all variables
- /// for this block.
- //------------------------------------------------------------------
- uint32_t
- AppendBlockVariables (bool can_create,
- bool get_child_block_variables,
- bool stop_if_child_block_is_inlined_function,
- const std::function<bool(Variable*)>& filter,
- VariableList *variable_list);
-
- //------------------------------------------------------------------
- /// Appends the variables from this block, and optionally from all
- /// parent blocks, to \a variable_list.
- ///
- /// @param[in] can_create
- /// If \b true, the variables can be parsed if they already
- /// haven't been, else the current state of the block will be
- /// returned. Passing \b true for this parameter can be used
- /// to see the current state of what has been parsed up to this
- /// point.
- ///
- /// @param[in] get_parent_variables
- /// If \b true, all variables from all parent blocks will be
- /// added to the variable list.
- ///
- /// @param[in] stop_if_block_is_inlined_function
- /// If \b true, all variables from all parent blocks will be
- /// added to the variable list until there are no parent blocks
- /// or the parent block has inlined function info.
- ///
- /// @param[in,out] variable_list
- /// All variables in this block, and optionally all parent
- /// blocks will be added to this list.
- ///
- /// @return
- /// The number of variable that were appended to \a
- /// variable_list.
- //------------------------------------------------------------------
- uint32_t
- AppendVariables (bool can_create,
- bool get_parent_variables,
- bool stop_if_block_is_inlined_function,
- const std::function<bool(Variable*)>& filter,
- VariableList *variable_list);
-
- //------------------------------------------------------------------
- /// Get const accessor for any inlined function information.
- ///
- /// @return
- /// A const pointer to any inlined function information, or nullptr
- /// if this is a regular block.
- //------------------------------------------------------------------
- const InlineFunctionInfo*
- GetInlinedFunctionInfo () const
- {
- return m_inlineInfoSP.get();
- }
-
- CompilerDeclContext
- GetDeclContext();
-
- //------------------------------------------------------------------
- /// Get the memory cost of this object.
- ///
- /// Returns the cost of this object plus any owned objects from the
- /// ranges, variables, and inline function information.
- ///
- /// @return
- /// The number of bytes that this object occupies in memory.
- //------------------------------------------------------------------
- size_t
- MemorySize() const;
-
- //------------------------------------------------------------------
- /// Set accessor for any inlined function information.
- ///
- /// @param[in] name
- /// The method name for the inlined function. This value should
- /// not be nullptr.
- ///
- /// @param[in] mangled
- /// The mangled method name for the inlined function. This can
- /// be nullptr if there is no mangled name for an inlined function
- /// or if the name is the same as \a name.
- ///
- /// @param[in] decl_ptr
- /// A optional pointer to declaration information for the
- /// inlined function information. This value can be nullptr to
- /// indicate that no declaration information is available.
- ///
- /// @param[in] call_decl_ptr
- /// Optional calling location declaration information that
- /// describes from where this inlined function was called.
- //------------------------------------------------------------------
- void
- SetInlinedFunctionInfo (const char *name,
- const char *mangled,
- const Declaration *decl_ptr,
- const Declaration *call_decl_ptr);
-
- void
- SetParentScope (SymbolContextScope *parent_scope)
- {
- m_parent_scope = parent_scope;
- }
-
- //------------------------------------------------------------------
- /// Set accessor for the variable list.
- ///
- /// Called by the SymbolFile plug-ins after they have parsed the
- /// variable lists and are ready to hand ownership of the list over
- /// to this object.
- ///
- /// @param[in] variable_list_sp
- /// A shared pointer to a VariableList.
- //------------------------------------------------------------------
- void
- SetVariableList (lldb::VariableListSP& variable_list_sp)
- {
- m_variable_list_sp = variable_list_sp;
- }
-
- bool
- BlockInfoHasBeenParsed() const
- {
- return m_parsed_block_info;
- }
-
- void
- SetBlockInfoHasBeenParsed (bool b, bool set_children);
-
- Block *
- FindBlockByID (lldb::user_id_t block_id);
-
- size_t
- GetNumRanges () const
- {
- return m_ranges.GetSize();
- }
-
- bool
- GetRangeContainingOffset (const lldb::addr_t offset, Range &range);
-
- bool
- GetRangeContainingAddress (const Address& addr, AddressRange &range);
-
- bool
- GetRangeContainingLoadAddress (lldb::addr_t load_addr, Target &target, AddressRange &range);
-
- uint32_t
- GetRangeIndexContainingAddress (const Address& addr);
-
- //------------------------------------------------------------------
- // Since blocks might have multiple discontiguous address ranges,
- // we need to be able to get at any of the address ranges in a block.
- //------------------------------------------------------------------
- bool
- GetRangeAtIndex (uint32_t range_idx,
- AddressRange &range);
-
- bool
- GetStartAddress (Address &addr);
-
- void
- SetDidParseVariables (bool b, bool set_children);
+ void SetDidParseVariables(bool b, bool set_children);
protected:
- typedef std::vector<lldb::BlockSP> collection;
- //------------------------------------------------------------------
- // Member variables.
- //------------------------------------------------------------------
- SymbolContextScope *m_parent_scope;
- collection m_children;
- RangeList m_ranges;
- lldb::InlineFunctionInfoSP m_inlineInfoSP; ///< Inlined function information.
- lldb::VariableListSP m_variable_list_sp; ///< The variable list for all local, static and parameter variables scoped to this block.
- bool m_parsed_block_info:1, ///< Set to true if this block and it's children have all been parsed
- m_parsed_block_variables:1,
- m_parsed_child_blocks:1;
-
- // A parent of child blocks can be asked to find a sibling block given
- // one of its child blocks
- Block *
- GetSiblingForChild (const Block *child_block) const;
+ typedef std::vector<lldb::BlockSP> collection;
+ //------------------------------------------------------------------
+ // Member variables.
+ //------------------------------------------------------------------
+ SymbolContextScope *m_parent_scope;
+ collection m_children;
+ RangeList m_ranges;
+ lldb::InlineFunctionInfoSP m_inlineInfoSP; ///< Inlined function information.
+ lldb::VariableListSP m_variable_list_sp; ///< The variable list for all local,
+ ///static and parameter variables
+ ///scoped to this block.
+ bool m_parsed_block_info : 1, ///< Set to true if this block and it's children
+ ///have all been parsed
+ m_parsed_block_variables : 1, m_parsed_child_blocks : 1;
+
+ // A parent of child blocks can be asked to find a sibling block given
+ // one of its child blocks
+ Block *GetSiblingForChild(const Block *child_block) const;
private:
- DISALLOW_COPY_AND_ASSIGN (Block);
+ DISALLOW_COPY_AND_ASSIGN(Block);
};
} // namespace lldb_private
Modified: lldb/trunk/include/lldb/Symbol/ClangASTContext.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Symbol/ClangASTContext.h?rev=280751&r1=280750&r2=280751&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Symbol/ClangASTContext.h (original)
+++ lldb/trunk/include/lldb/Symbol/ClangASTContext.h Tue Sep 6 15:57:50 2016
@@ -20,13 +20,13 @@
#include <memory>
#include <set>
#include <string>
-#include <vector>
#include <utility>
+#include <vector>
// Other libraries and framework includes
-#include "llvm/ADT/SmallVector.h"
#include "clang/AST/ASTContext.h"
#include "clang/AST/TemplateBase.h"
+#include "llvm/ADT/SmallVector.h"
// Project includes
#include "Plugins/ExpressionParser/Clang/ClangPersistentVariables.h"
@@ -43,1161 +43,934 @@ namespace lldb_private {
class Declaration;
-class ClangASTContext : public TypeSystem
-{
+class ClangASTContext : public TypeSystem {
public:
- typedef void (*CompleteTagDeclCallback)(void *baton, clang::TagDecl *);
- typedef void (*CompleteObjCInterfaceDeclCallback)(void *baton, clang::ObjCInterfaceDecl *);
+ typedef void (*CompleteTagDeclCallback)(void *baton, clang::TagDecl *);
+ typedef void (*CompleteObjCInterfaceDeclCallback)(void *baton,
+ clang::ObjCInterfaceDecl *);
- //------------------------------------------------------------------
- // llvm casting support
- //------------------------------------------------------------------
- static bool classof(const TypeSystem *ts)
- {
- return ts->getKind() == TypeSystem::eKindClang;
- }
+ //------------------------------------------------------------------
+ // llvm casting support
+ //------------------------------------------------------------------
+ static bool classof(const TypeSystem *ts) {
+ return ts->getKind() == TypeSystem::eKindClang;
+ }
- //------------------------------------------------------------------
- // Constructors and Destructors
- //------------------------------------------------------------------
- ClangASTContext(const char *triple = nullptr);
-
- ~ClangASTContext() override;
-
- void
- Finalize() override;
-
- //------------------------------------------------------------------
- // PluginInterface functions
- //------------------------------------------------------------------
- ConstString
- GetPluginName() override;
-
- uint32_t
- GetPluginVersion() override;
-
- static ConstString
- GetPluginNameStatic ();
-
- static lldb::TypeSystemSP
- CreateInstance (lldb::LanguageType language, Module *module, Target *target);
-
- static void
- EnumerateSupportedLanguages(std::set<lldb::LanguageType> &languages_for_types, std::set<lldb::LanguageType> &languages_for_expressions);
-
- static void
- Initialize ();
-
- static void
- Terminate ();
-
- static ClangASTContext*
- GetASTContext (clang::ASTContext* ast_ctx);
-
- clang::ASTContext *
- getASTContext();
-
- void setASTContext(clang::ASTContext* ast_ctx);
-
- clang::Builtin::Context *
- getBuiltinContext();
-
- clang::IdentifierTable *
- getIdentifierTable();
-
- clang::LangOptions *
- getLanguageOptions();
-
- clang::SelectorTable *
- getSelectorTable();
-
- clang::FileManager *
- getFileManager();
-
- clang::SourceManager *
- getSourceManager();
-
- clang::DiagnosticsEngine *
- getDiagnosticsEngine();
-
- clang::DiagnosticConsumer *
- getDiagnosticConsumer();
-
- clang::MangleContext *
- getMangleContext();
-
- std::shared_ptr<clang::TargetOptions> &getTargetOptions();
-
- clang::TargetInfo *
- getTargetInfo();
-
- void
- Clear();
-
- const char *
- GetTargetTriple ();
-
- void
- SetTargetTriple (const char *target_triple);
-
- void
- SetArchitecture (const ArchSpec &arch);
-
- bool
- HasExternalSource ();
-
- void
- SetExternalSource (llvm::IntrusiveRefCntPtr<clang::ExternalASTSource> &ast_source_ap);
-
- void
- RemoveExternalSource ();
-
- bool
- GetCompleteDecl (clang::Decl *decl)
- {
- return ClangASTContext::GetCompleteDecl(getASTContext(), decl);
- }
+ //------------------------------------------------------------------
+ // Constructors and Destructors
+ //------------------------------------------------------------------
+ ClangASTContext(const char *triple = nullptr);
- static void
- DumpDeclHiearchy (clang::Decl *decl);
+ ~ClangASTContext() override;
- static void
- DumpDeclContextHiearchy (clang::DeclContext *decl_ctx);
+ void Finalize() override;
- static bool
- DeclsAreEquivalent (clang::Decl *lhs_decl, clang::Decl *rhs_decl);
+ //------------------------------------------------------------------
+ // PluginInterface functions
+ //------------------------------------------------------------------
+ ConstString GetPluginName() override;
- static bool
- GetCompleteDecl (clang::ASTContext *ast,
- clang::Decl *decl);
-
- void SetMetadataAsUserID (const void *object,
- lldb::user_id_t user_id);
-
- void SetMetadata (const void *object,
- ClangASTMetadata &meta_data)
- {
- SetMetadata(getASTContext(), object, meta_data);
- }
-
- static void
- SetMetadata (clang::ASTContext *ast,
- const void *object,
- ClangASTMetadata &meta_data);
-
- ClangASTMetadata *
- GetMetadata (const void *object)
- {
- return GetMetadata(getASTContext(), object);
- }
-
- static ClangASTMetadata *
- GetMetadata (clang::ASTContext *ast,
- const void *object);
-
- //------------------------------------------------------------------
- // Basic Types
- //------------------------------------------------------------------
- CompilerType
- GetBuiltinTypeForEncodingAndBitSize (lldb::Encoding encoding,
- size_t bit_size) override;
-
- static CompilerType
- GetBuiltinTypeForEncodingAndBitSize (clang::ASTContext *ast,
- lldb::Encoding encoding,
- uint32_t bit_size);
-
- CompilerType
- GetBasicType (lldb::BasicType type);
-
- static CompilerType
- GetBasicType (clang::ASTContext *ast, lldb::BasicType type);
-
- static CompilerType
- GetBasicType (clang::ASTContext *ast, const ConstString &name);
-
- static lldb::BasicType
- GetBasicTypeEnumeration (const ConstString &name);
-
- CompilerType
- GetBuiltinTypeForDWARFEncodingAndBitSize (
- const char *type_name,
- uint32_t dw_ate,
- uint32_t bit_size);
-
- CompilerType
- GetCStringType(bool is_const);
-
- static CompilerType
- GetUnknownAnyType(clang::ASTContext *ast);
-
- CompilerType
- GetUnknownAnyType()
- {
- return ClangASTContext::GetUnknownAnyType(getASTContext());
- }
-
- static clang::DeclContext *
- GetDeclContextForType (clang::QualType type);
-
- static clang::DeclContext *
- GetDeclContextForType (const CompilerType& type);
-
- uint32_t
- GetPointerByteSize () override;
-
- static clang::DeclContext *
- GetTranslationUnitDecl (clang::ASTContext *ast);
-
- clang::DeclContext *
- GetTranslationUnitDecl ()
- {
- return GetTranslationUnitDecl (getASTContext());
- }
-
- static clang::Decl *
- CopyDecl (clang::ASTContext *dest_context,
- clang::ASTContext *source_context,
- clang::Decl *source_decl);
-
- static bool
- AreTypesSame(CompilerType type1,
- CompilerType type2,
- bool ignore_qualifiers = false);
-
- static CompilerType
- GetTypeForDecl (clang::NamedDecl *decl);
-
- static CompilerType
- GetTypeForDecl (clang::TagDecl *decl);
-
- static CompilerType
- GetTypeForDecl (clang::ObjCInterfaceDecl *objc_decl);
-
- template <typename RecordDeclType>
- CompilerType
- GetTypeForIdentifier (const ConstString &type_name)
- {
- CompilerType compiler_type;
-
- if (type_name.GetLength())
- {
- clang::ASTContext *ast = getASTContext();
- if (ast)
- {
- clang::IdentifierInfo &myIdent = ast->Idents.get(type_name.GetCString());
- clang::DeclarationName myName = ast->DeclarationNames.getIdentifier(&myIdent);
-
- clang::DeclContext::lookup_result result = ast->getTranslationUnitDecl()->lookup(myName);
-
- if (!result.empty())
- {
- clang::NamedDecl *named_decl = result[0];
- if (const RecordDeclType *record_decl = llvm::dyn_cast<RecordDeclType>(named_decl))
- compiler_type.SetCompilerType(ast, clang::QualType(record_decl->getTypeForDecl(), 0));
- }
- }
+ uint32_t GetPluginVersion() override;
+
+ static ConstString GetPluginNameStatic();
+
+ static lldb::TypeSystemSP CreateInstance(lldb::LanguageType language,
+ Module *module, Target *target);
+
+ static void EnumerateSupportedLanguages(
+ std::set<lldb::LanguageType> &languages_for_types,
+ std::set<lldb::LanguageType> &languages_for_expressions);
+
+ static void Initialize();
+
+ static void Terminate();
+
+ static ClangASTContext *GetASTContext(clang::ASTContext *ast_ctx);
+
+ clang::ASTContext *getASTContext();
+
+ void setASTContext(clang::ASTContext *ast_ctx);
+
+ clang::Builtin::Context *getBuiltinContext();
+
+ clang::IdentifierTable *getIdentifierTable();
+
+ clang::LangOptions *getLanguageOptions();
+
+ clang::SelectorTable *getSelectorTable();
+
+ clang::FileManager *getFileManager();
+
+ clang::SourceManager *getSourceManager();
+
+ clang::DiagnosticsEngine *getDiagnosticsEngine();
+
+ clang::DiagnosticConsumer *getDiagnosticConsumer();
+
+ clang::MangleContext *getMangleContext();
+
+ std::shared_ptr<clang::TargetOptions> &getTargetOptions();
+
+ clang::TargetInfo *getTargetInfo();
+
+ void Clear();
+
+ const char *GetTargetTriple();
+
+ void SetTargetTriple(const char *target_triple);
+
+ void SetArchitecture(const ArchSpec &arch);
+
+ bool HasExternalSource();
+
+ void SetExternalSource(
+ llvm::IntrusiveRefCntPtr<clang::ExternalASTSource> &ast_source_ap);
+
+ void RemoveExternalSource();
+
+ bool GetCompleteDecl(clang::Decl *decl) {
+ return ClangASTContext::GetCompleteDecl(getASTContext(), decl);
+ }
+
+ static void DumpDeclHiearchy(clang::Decl *decl);
+
+ static void DumpDeclContextHiearchy(clang::DeclContext *decl_ctx);
+
+ static bool DeclsAreEquivalent(clang::Decl *lhs_decl, clang::Decl *rhs_decl);
+
+ static bool GetCompleteDecl(clang::ASTContext *ast, clang::Decl *decl);
+
+ void SetMetadataAsUserID(const void *object, lldb::user_id_t user_id);
+
+ void SetMetadata(const void *object, ClangASTMetadata &meta_data) {
+ SetMetadata(getASTContext(), object, meta_data);
+ }
+
+ static void SetMetadata(clang::ASTContext *ast, const void *object,
+ ClangASTMetadata &meta_data);
+
+ ClangASTMetadata *GetMetadata(const void *object) {
+ return GetMetadata(getASTContext(), object);
+ }
+
+ static ClangASTMetadata *GetMetadata(clang::ASTContext *ast,
+ const void *object);
+
+ //------------------------------------------------------------------
+ // Basic Types
+ //------------------------------------------------------------------
+ CompilerType GetBuiltinTypeForEncodingAndBitSize(lldb::Encoding encoding,
+ size_t bit_size) override;
+
+ static CompilerType GetBuiltinTypeForEncodingAndBitSize(
+ clang::ASTContext *ast, lldb::Encoding encoding, uint32_t bit_size);
+
+ CompilerType GetBasicType(lldb::BasicType type);
+
+ static CompilerType GetBasicType(clang::ASTContext *ast,
+ lldb::BasicType type);
+
+ static CompilerType GetBasicType(clang::ASTContext *ast,
+ const ConstString &name);
+
+ static lldb::BasicType GetBasicTypeEnumeration(const ConstString &name);
+
+ CompilerType GetBuiltinTypeForDWARFEncodingAndBitSize(const char *type_name,
+ uint32_t dw_ate,
+ uint32_t bit_size);
+
+ CompilerType GetCStringType(bool is_const);
+
+ static CompilerType GetUnknownAnyType(clang::ASTContext *ast);
+
+ CompilerType GetUnknownAnyType() {
+ return ClangASTContext::GetUnknownAnyType(getASTContext());
+ }
+
+ static clang::DeclContext *GetDeclContextForType(clang::QualType type);
+
+ static clang::DeclContext *GetDeclContextForType(const CompilerType &type);
+
+ uint32_t GetPointerByteSize() override;
+
+ static clang::DeclContext *GetTranslationUnitDecl(clang::ASTContext *ast);
+
+ clang::DeclContext *GetTranslationUnitDecl() {
+ return GetTranslationUnitDecl(getASTContext());
+ }
+
+ static clang::Decl *CopyDecl(clang::ASTContext *dest_context,
+ clang::ASTContext *source_context,
+ clang::Decl *source_decl);
+
+ static bool AreTypesSame(CompilerType type1, CompilerType type2,
+ bool ignore_qualifiers = false);
+
+ static CompilerType GetTypeForDecl(clang::NamedDecl *decl);
+
+ static CompilerType GetTypeForDecl(clang::TagDecl *decl);
+
+ static CompilerType GetTypeForDecl(clang::ObjCInterfaceDecl *objc_decl);
+
+ template <typename RecordDeclType>
+ CompilerType GetTypeForIdentifier(const ConstString &type_name) {
+ CompilerType compiler_type;
+
+ if (type_name.GetLength()) {
+ clang::ASTContext *ast = getASTContext();
+ if (ast) {
+ clang::IdentifierInfo &myIdent =
+ ast->Idents.get(type_name.GetCString());
+ clang::DeclarationName myName =
+ ast->DeclarationNames.getIdentifier(&myIdent);
+
+ clang::DeclContext::lookup_result result =
+ ast->getTranslationUnitDecl()->lookup(myName);
+
+ if (!result.empty()) {
+ clang::NamedDecl *named_decl = result[0];
+ if (const RecordDeclType *record_decl =
+ llvm::dyn_cast<RecordDeclType>(named_decl))
+ compiler_type.SetCompilerType(
+ ast, clang::QualType(record_decl->getTypeForDecl(), 0));
}
-
- return compiler_type;
+ }
}
-
- CompilerType
- CreateStructForIdentifier (const ConstString &type_name,
- const std::initializer_list< std::pair < const char *, CompilerType > >& type_fields,
- bool packed = false);
-
- CompilerType
- GetOrCreateStructForIdentifier (const ConstString &type_name,
- const std::initializer_list< std::pair < const char *, CompilerType > >& type_fields,
- bool packed = false);
-
- //------------------------------------------------------------------
- // Structure, Unions, Classes
- //------------------------------------------------------------------
-
- static clang::AccessSpecifier
- ConvertAccessTypeToAccessSpecifier (lldb::AccessType access);
-
- static clang::AccessSpecifier
- UnifyAccessSpecifiers (clang::AccessSpecifier lhs, clang::AccessSpecifier rhs);
-
- static uint32_t
- GetNumBaseClasses (const clang::CXXRecordDecl *cxx_record_decl,
- bool omit_empty_base_classes);
-
- CompilerType
- CreateRecordType(clang::DeclContext *decl_ctx,
- lldb::AccessType access_type,
- const char *name,
- int kind,
- lldb::LanguageType language,
- ClangASTMetadata *metadata = nullptr);
-
- class TemplateParameterInfos
- {
- public:
- bool
- IsValid() const
- {
- if (args.empty())
- return false;
- return args.size() == names.size();
- }
- size_t
- GetSize () const
- {
- if (IsValid())
- return args.size();
- return 0;
- }
+ return compiler_type;
+ }
- llvm::SmallVector<const char *, 2> names;
- llvm::SmallVector<clang::TemplateArgument, 2> args;
- };
-
- clang::FunctionTemplateDecl *
- CreateFunctionTemplateDecl (clang::DeclContext *decl_ctx,
- clang::FunctionDecl *func_decl,
- const char *name,
- const TemplateParameterInfos &infos);
-
- void
- CreateFunctionTemplateSpecializationInfo (clang::FunctionDecl *func_decl,
- clang::FunctionTemplateDecl *Template,
- const TemplateParameterInfos &infos);
-
- clang::ClassTemplateDecl *
- CreateClassTemplateDecl (clang::DeclContext *decl_ctx,
- lldb::AccessType access_type,
- const char *class_name,
- int kind,
- const TemplateParameterInfos &infos);
+ CompilerType CreateStructForIdentifier(
+ const ConstString &type_name,
+ const std::initializer_list<std::pair<const char *, CompilerType>>
+ &type_fields,
+ bool packed = false);
- clang::ClassTemplateSpecializationDecl *
- CreateClassTemplateSpecializationDecl (clang::DeclContext *decl_ctx,
- clang::ClassTemplateDecl *class_template_decl,
- int kind,
- const TemplateParameterInfos &infos);
-
- CompilerType
- CreateClassTemplateSpecializationType (clang::ClassTemplateSpecializationDecl *class_template_specialization_decl);
-
- static clang::DeclContext *
- GetAsDeclContext (clang::CXXMethodDecl *cxx_method_decl);
-
- static clang::DeclContext *
- GetAsDeclContext (clang::ObjCMethodDecl *objc_method_decl);
-
- static bool
- CheckOverloadedOperatorKindParameterCount(bool is_method, clang::OverloadedOperatorKind op_kind,
- uint32_t num_params);
-
- bool
- FieldIsBitfield (clang::FieldDecl* field,
- uint32_t& bitfield_bit_size);
-
- static bool
- FieldIsBitfield (clang::ASTContext *ast,
- clang::FieldDecl* field,
- uint32_t& bitfield_bit_size);
-
- static bool
- RecordHasFields (const clang::RecordDecl *record_decl);
-
- CompilerType
- CreateObjCClass(const char *name,
- clang::DeclContext *decl_ctx,
- bool isForwardDecl,
- bool isInternal,
- ClangASTMetadata *metadata = nullptr);
-
- bool
- SetTagTypeKind (clang::QualType type, int kind) const;
-
- bool
- SetDefaultAccessForRecordFields (clang::RecordDecl* record_decl,
- int default_accessibility,
- int *assigned_accessibilities,
- size_t num_assigned_accessibilities);
-
- // Returns a mask containing bits from the ClangASTContext::eTypeXXX enumerations
-
- //------------------------------------------------------------------
- // Namespace Declarations
- //------------------------------------------------------------------
-
- clang::NamespaceDecl *
- GetUniqueNamespaceDeclaration (const char *name,
- clang::DeclContext *decl_ctx);
+ CompilerType GetOrCreateStructForIdentifier(
+ const ConstString &type_name,
+ const std::initializer_list<std::pair<const char *, CompilerType>>
+ &type_fields,
+ bool packed = false);
- static clang::NamespaceDecl *
- GetUniqueNamespaceDeclaration (clang::ASTContext *ast,
- const char *name,
- clang::DeclContext *decl_ctx);
+ //------------------------------------------------------------------
+ // Structure, Unions, Classes
+ //------------------------------------------------------------------
- //------------------------------------------------------------------
- // Function Types
- //------------------------------------------------------------------
-
- clang::FunctionDecl *
- CreateFunctionDeclaration (clang::DeclContext *decl_ctx,
- const char *name,
- const CompilerType &function_Type,
- int storage,
- bool is_inline);
-
- static CompilerType
- CreateFunctionType (clang::ASTContext *ast,
- const CompilerType &result_type,
- const CompilerType *args,
- unsigned num_args,
- bool is_variadic,
- unsigned type_quals);
-
- CompilerType
- CreateFunctionType (const CompilerType &result_type,
- const CompilerType *args,
- unsigned num_args,
- bool is_variadic,
- unsigned type_quals)
- {
- return ClangASTContext::CreateFunctionType(getASTContext(),
- result_type,
- args,
- num_args,
- is_variadic,
- type_quals);
- }
-
- clang::ParmVarDecl *
- CreateParameterDeclaration (const char *name,
- const CompilerType ¶m_type,
- int storage);
-
- void
- SetFunctionParameters (clang::FunctionDecl *function_decl,
- clang::ParmVarDecl **params,
- unsigned num_params);
-
- CompilerType
- CreateBlockPointerType (const CompilerType &function_type);
-
- //------------------------------------------------------------------
- // Array Types
- //------------------------------------------------------------------
-
- CompilerType
- CreateArrayType (const CompilerType &element_type,
- size_t element_count,
- bool is_vector);
-
- //------------------------------------------------------------------
- // Enumeration Types
- //------------------------------------------------------------------
- CompilerType
- CreateEnumerationType (const char *name,
- clang::DeclContext *decl_ctx,
- const Declaration &decl,
- const CompilerType &integer_qual_type);
-
- //------------------------------------------------------------------
- // Integer type functions
- //------------------------------------------------------------------
-
- static CompilerType
- GetIntTypeFromBitSize (clang::ASTContext *ast,
- size_t bit_size, bool is_signed);
-
- CompilerType
- GetPointerSizedIntType (bool is_signed)
- {
- return GetPointerSizedIntType (getASTContext(), is_signed);
+ static clang::AccessSpecifier
+ ConvertAccessTypeToAccessSpecifier(lldb::AccessType access);
+
+ static clang::AccessSpecifier
+ UnifyAccessSpecifiers(clang::AccessSpecifier lhs, clang::AccessSpecifier rhs);
+
+ static uint32_t GetNumBaseClasses(const clang::CXXRecordDecl *cxx_record_decl,
+ bool omit_empty_base_classes);
+
+ CompilerType CreateRecordType(clang::DeclContext *decl_ctx,
+ lldb::AccessType access_type, const char *name,
+ int kind, lldb::LanguageType language,
+ ClangASTMetadata *metadata = nullptr);
+
+ class TemplateParameterInfos {
+ public:
+ bool IsValid() const {
+ if (args.empty())
+ return false;
+ return args.size() == names.size();
}
-
- static CompilerType
- GetPointerSizedIntType (clang::ASTContext *ast, bool is_signed);
-
- //------------------------------------------------------------------
- // Floating point functions
- //------------------------------------------------------------------
-
- static CompilerType
- GetFloatTypeFromBitSize (clang::ASTContext *ast,
- size_t bit_size);
-
- //------------------------------------------------------------------
- // TypeSystem methods
- //------------------------------------------------------------------
- DWARFASTParser *
- GetDWARFParser() override;
- PDBASTParser *
- GetPDBParser();
-
- //------------------------------------------------------------------
- // ClangASTContext callbacks for external source lookups.
- //------------------------------------------------------------------
- static void
- CompleteTagDecl (void *baton, clang::TagDecl *);
-
- static void
- CompleteObjCInterfaceDecl (void *baton, clang::ObjCInterfaceDecl *);
-
- static bool
- LayoutRecordType(void *baton,
- const clang::RecordDecl *record_decl,
- uint64_t &size,
- uint64_t &alignment,
- llvm::DenseMap<const clang::FieldDecl *, uint64_t> &field_offsets,
- llvm::DenseMap<const clang::CXXRecordDecl *, clang::CharUnits> &base_offsets,
- llvm::DenseMap<const clang::CXXRecordDecl *, clang::CharUnits> &vbase_offsets);
-
- //----------------------------------------------------------------------
- // CompilerDecl override functions
- //----------------------------------------------------------------------
- ConstString
- DeclGetName (void *opaque_decl) override;
-
- ConstString
- DeclGetMangledName (void *opaque_decl) override;
-
- CompilerDeclContext
- DeclGetDeclContext (void *opaque_decl) override;
-
- CompilerType
- DeclGetFunctionReturnType(void *opaque_decl) override;
-
- size_t
- DeclGetFunctionNumArguments(void *opaque_decl) override;
-
- CompilerType
- DeclGetFunctionArgumentType (void *opaque_decl, size_t arg_idx) override;
-
- //----------------------------------------------------------------------
- // CompilerDeclContext override functions
- //----------------------------------------------------------------------
-
- std::vector<CompilerDecl>
- DeclContextFindDeclByName (void *opaque_decl_ctx,
- ConstString name,
- const bool ignore_using_decls) override;
-
- bool
- DeclContextIsStructUnionOrClass (void *opaque_decl_ctx) override;
-
- ConstString
- DeclContextGetName (void *opaque_decl_ctx) override;
-
- ConstString
- DeclContextGetScopeQualifiedName (void *opaque_decl_ctx) override;
-
- bool
- DeclContextIsClassMethod (void *opaque_decl_ctx,
- lldb::LanguageType *language_ptr,
- bool *is_instance_method_ptr,
- ConstString *language_object_name_ptr) override;
-
- //----------------------------------------------------------------------
- // Clang specific clang::DeclContext functions
- //----------------------------------------------------------------------
-
- static clang::DeclContext *
- DeclContextGetAsDeclContext (const CompilerDeclContext &dc);
-
- static clang::ObjCMethodDecl *
- DeclContextGetAsObjCMethodDecl (const CompilerDeclContext &dc);
-
- static clang::CXXMethodDecl *
- DeclContextGetAsCXXMethodDecl (const CompilerDeclContext &dc);
-
- static clang::FunctionDecl *
- DeclContextGetAsFunctionDecl (const CompilerDeclContext &dc);
-
- static clang::NamespaceDecl *
- DeclContextGetAsNamespaceDecl (const CompilerDeclContext &dc);
-
- static ClangASTMetadata *
- DeclContextGetMetaData (const CompilerDeclContext &dc, const void *object);
-
- static clang::ASTContext *
- DeclContextGetClangASTContext (const CompilerDeclContext &dc);
-
- //----------------------------------------------------------------------
- // Tests
- //----------------------------------------------------------------------
-
- bool
- IsArrayType (lldb::opaque_compiler_type_t type,
- CompilerType *element_type,
- uint64_t *size,
- bool *is_incomplete) override;
-
- bool
- IsVectorType (lldb::opaque_compiler_type_t type,
- CompilerType *element_type,
- uint64_t *size) override;
-
- bool
- IsAggregateType (lldb::opaque_compiler_type_t type) override;
-
- bool
- IsAnonymousType (lldb::opaque_compiler_type_t type) override;
-
- bool
- IsBeingDefined (lldb::opaque_compiler_type_t type) override;
-
- bool
- IsCharType (lldb::opaque_compiler_type_t type) override;
-
- bool
- IsCompleteType (lldb::opaque_compiler_type_t type) override;
-
- bool
- IsConst(lldb::opaque_compiler_type_t type) override;
-
- bool
- IsCStringType (lldb::opaque_compiler_type_t type, uint32_t &length) override;
-
- static bool
- IsCXXClassType (const CompilerType& type);
-
- bool
- IsDefined(lldb::opaque_compiler_type_t type) override;
-
- bool
- IsFloatingPointType (lldb::opaque_compiler_type_t type, uint32_t &count, bool &is_complex) override;
-
- bool
- IsFunctionType (lldb::opaque_compiler_type_t type, bool *is_variadic_ptr) override;
-
- uint32_t
- IsHomogeneousAggregate (lldb::opaque_compiler_type_t type, CompilerType* base_type_ptr) override;
-
- size_t
- GetNumberOfFunctionArguments (lldb::opaque_compiler_type_t type) override;
-
- CompilerType
- GetFunctionArgumentAtIndex (lldb::opaque_compiler_type_t type, const size_t index) override;
-
- bool
- IsFunctionPointerType (lldb::opaque_compiler_type_t type) override;
-
- bool
- IsBlockPointerType (lldb::opaque_compiler_type_t type, CompilerType *function_pointer_type_ptr) override;
-
- bool
- IsIntegerType (lldb::opaque_compiler_type_t type, bool &is_signed) override;
-
- bool
- IsEnumerationType (lldb::opaque_compiler_type_t type, bool &is_signed) override;
-
- static bool
- IsObjCClassType (const CompilerType& type);
-
- static bool
- IsObjCClassTypeAndHasIVars (const CompilerType& type, bool check_superclass);
-
- static bool
- IsObjCObjectOrInterfaceType (const CompilerType& type);
-
- static bool
- IsObjCObjectPointerType(const CompilerType& type, CompilerType *target_type = nullptr);
-
- bool
- IsPolymorphicClass (lldb::opaque_compiler_type_t type) override;
-
- static bool
- IsClassType(lldb::opaque_compiler_type_t type);
-
- static bool
- IsEnumType(lldb::opaque_compiler_type_t type);
-
- bool
- IsPossibleDynamicType(lldb::opaque_compiler_type_t type,
- CompilerType *target_type, // Can pass nullptr
- bool check_cplusplus,
- bool check_objc) override;
-
- bool
- IsRuntimeGeneratedType (lldb::opaque_compiler_type_t type) override;
-
- bool
- IsPointerType (lldb::opaque_compiler_type_t type, CompilerType *pointee_type) override;
-
- bool
- IsPointerOrReferenceType (lldb::opaque_compiler_type_t type, CompilerType *pointee_type) override;
-
- bool
- IsReferenceType (lldb::opaque_compiler_type_t type, CompilerType *pointee_type, bool* is_rvalue) override;
-
- bool
- IsScalarType (lldb::opaque_compiler_type_t type) override;
-
- bool
- IsTypedefType (lldb::opaque_compiler_type_t type) override;
-
- bool
- IsVoidType (lldb::opaque_compiler_type_t type) override;
-
- bool
- SupportsLanguage (lldb::LanguageType language) override;
-
- static bool
- GetCXXClassName (const CompilerType& type, std::string &class_name);
-
- static bool
- GetObjCClassName (const CompilerType& type, std::string &class_name);
-
- //----------------------------------------------------------------------
- // Type Completion
- //----------------------------------------------------------------------
-
- bool
- GetCompleteType (lldb::opaque_compiler_type_t type) override;
-
- //----------------------------------------------------------------------
- // Accessors
- //----------------------------------------------------------------------
-
- ConstString
- GetTypeName (lldb::opaque_compiler_type_t type) override;
-
- uint32_t
- GetTypeInfo (lldb::opaque_compiler_type_t type, CompilerType *pointee_or_element_compiler_type) override;
-
- lldb::LanguageType
- GetMinimumLanguage (lldb::opaque_compiler_type_t type) override;
-
- lldb::TypeClass
- GetTypeClass (lldb::opaque_compiler_type_t type) override;
-
- unsigned
- GetTypeQualifiers(lldb::opaque_compiler_type_t type) override;
-
- //----------------------------------------------------------------------
- // Creating related types
- //----------------------------------------------------------------------
-
- // Using the current type, create a new typedef to that type using "typedef_name"
- // as the name and "decl_ctx" as the decl context.
- static CompilerType
- CreateTypedefType (const CompilerType& type,
- const char *typedef_name,
- const CompilerDeclContext &compiler_decl_ctx);
-
- CompilerType
- GetArrayElementType (lldb::opaque_compiler_type_t type, uint64_t *stride) override;
-
- CompilerType
- GetArrayType (lldb::opaque_compiler_type_t type, uint64_t size) override;
-
- CompilerType
- GetCanonicalType (lldb::opaque_compiler_type_t type) override;
-
- CompilerType
- GetFullyUnqualifiedType (lldb::opaque_compiler_type_t type) override;
-
- // Returns -1 if this isn't a function of if the function doesn't have a prototype
- // Returns a value >= 0 if there is a prototype.
- int
- GetFunctionArgumentCount (lldb::opaque_compiler_type_t type) override;
-
- CompilerType
- GetFunctionArgumentTypeAtIndex (lldb::opaque_compiler_type_t type, size_t idx) override;
-
- CompilerType
- GetFunctionReturnType (lldb::opaque_compiler_type_t type) override;
-
- size_t
- GetNumMemberFunctions (lldb::opaque_compiler_type_t type) override;
-
- TypeMemberFunctionImpl
- GetMemberFunctionAtIndex (lldb::opaque_compiler_type_t type, size_t idx) override;
-
- CompilerType
- GetNonReferenceType (lldb::opaque_compiler_type_t type) override;
-
- CompilerType
- GetPointeeType (lldb::opaque_compiler_type_t type) override;
-
- CompilerType
- GetPointerType (lldb::opaque_compiler_type_t type) override;
-
- CompilerType
- GetLValueReferenceType (lldb::opaque_compiler_type_t type) override;
-
- CompilerType
- GetRValueReferenceType (lldb::opaque_compiler_type_t type) override;
-
- CompilerType
- AddConstModifier (lldb::opaque_compiler_type_t type) override;
-
- CompilerType
- AddVolatileModifier (lldb::opaque_compiler_type_t type) override;
-
- CompilerType
- AddRestrictModifier (lldb::opaque_compiler_type_t type) override;
-
- CompilerType
- CreateTypedef (lldb::opaque_compiler_type_t type, const char *name, const CompilerDeclContext &decl_ctx) override;
-
- // If the current object represents a typedef type, get the underlying type
- CompilerType
- GetTypedefedType (lldb::opaque_compiler_type_t type) override;
-
- //----------------------------------------------------------------------
- // Create related types using the current type's AST
- //----------------------------------------------------------------------
- CompilerType
- GetBasicTypeFromAST (lldb::BasicType basic_type) override;
-
- //----------------------------------------------------------------------
- // Exploring the type
- //----------------------------------------------------------------------
-
- uint64_t
- GetByteSize (lldb::opaque_compiler_type_t type, ExecutionContextScope *exe_scope)
- {
- return (GetBitSize (type, exe_scope) + 7) / 8;
+
+ size_t GetSize() const {
+ if (IsValid())
+ return args.size();
+ return 0;
}
-
- uint64_t
- GetBitSize (lldb::opaque_compiler_type_t type, ExecutionContextScope *exe_scope) override;
-
- lldb::Encoding
- GetEncoding (lldb::opaque_compiler_type_t type, uint64_t &count) override;
-
- lldb::Format
- GetFormat (lldb::opaque_compiler_type_t type) override;
-
- size_t
- GetTypeBitAlign (lldb::opaque_compiler_type_t type) override;
-
- uint32_t
- GetNumChildren (lldb::opaque_compiler_type_t type, bool omit_empty_base_classes) override;
-
- CompilerType
- GetBuiltinTypeByName (const ConstString &name) override;
-
- lldb::BasicType
- GetBasicTypeEnumeration (lldb::opaque_compiler_type_t type) override;
-
- static lldb::BasicType
- GetBasicTypeEnumeration (lldb::opaque_compiler_type_t type, const ConstString &name);
-
- void
- ForEachEnumerator (lldb::opaque_compiler_type_t type, std::function <bool (const CompilerType &integer_type, const ConstString &name, const llvm::APSInt &value)> const &callback) override;
-
- uint32_t
- GetNumFields (lldb::opaque_compiler_type_t type) override;
-
- CompilerType
- GetFieldAtIndex (lldb::opaque_compiler_type_t type,
- size_t idx,
- std::string& name,
- uint64_t *bit_offset_ptr,
- uint32_t *bitfield_bit_size_ptr,
- bool *is_bitfield_ptr) override;
-
- uint32_t
- GetNumDirectBaseClasses (lldb::opaque_compiler_type_t type) override;
-
- uint32_t
- GetNumVirtualBaseClasses (lldb::opaque_compiler_type_t type) override;
-
- CompilerType
- GetDirectBaseClassAtIndex (lldb::opaque_compiler_type_t type,
- size_t idx,
- uint32_t *bit_offset_ptr) override;
-
- CompilerType
- GetVirtualBaseClassAtIndex (lldb::opaque_compiler_type_t type,
- size_t idx,
- uint32_t *bit_offset_ptr) override;
-
- static uint32_t
- GetNumPointeeChildren (clang::QualType type);
-
- CompilerType
- GetChildCompilerTypeAtIndex (lldb::opaque_compiler_type_t type,
- ExecutionContext *exe_ctx,
- size_t idx,
- bool transparent_pointers,
- bool omit_empty_base_classes,
- bool ignore_array_bounds,
- std::string& child_name,
- uint32_t &child_byte_size,
- int32_t &child_byte_offset,
- uint32_t &child_bitfield_bit_size,
- uint32_t &child_bitfield_bit_offset,
- bool &child_is_base_class,
- bool &child_is_deref_of_parent,
- ValueObject *valobj,
- uint64_t &language_flags) override;
-
- // Lookup a child given a name. This function will match base class names
- // and member member names in "clang_type" only, not descendants.
- uint32_t
- GetIndexOfChildWithName (lldb::opaque_compiler_type_t type,
+
+ llvm::SmallVector<const char *, 2> names;
+ llvm::SmallVector<clang::TemplateArgument, 2> args;
+ };
+
+ clang::FunctionTemplateDecl *
+ CreateFunctionTemplateDecl(clang::DeclContext *decl_ctx,
+ clang::FunctionDecl *func_decl, const char *name,
+ const TemplateParameterInfos &infos);
+
+ void CreateFunctionTemplateSpecializationInfo(
+ clang::FunctionDecl *func_decl, clang::FunctionTemplateDecl *Template,
+ const TemplateParameterInfos &infos);
+
+ clang::ClassTemplateDecl *
+ CreateClassTemplateDecl(clang::DeclContext *decl_ctx,
+ lldb::AccessType access_type, const char *class_name,
+ int kind, const TemplateParameterInfos &infos);
+
+ clang::ClassTemplateSpecializationDecl *CreateClassTemplateSpecializationDecl(
+ clang::DeclContext *decl_ctx,
+ clang::ClassTemplateDecl *class_template_decl, int kind,
+ const TemplateParameterInfos &infos);
+
+ CompilerType
+ CreateClassTemplateSpecializationType(clang::ClassTemplateSpecializationDecl *
+ class_template_specialization_decl);
+
+ static clang::DeclContext *
+ GetAsDeclContext(clang::CXXMethodDecl *cxx_method_decl);
+
+ static clang::DeclContext *
+ GetAsDeclContext(clang::ObjCMethodDecl *objc_method_decl);
+
+ static bool CheckOverloadedOperatorKindParameterCount(
+ bool is_method, clang::OverloadedOperatorKind op_kind,
+ uint32_t num_params);
+
+ bool FieldIsBitfield(clang::FieldDecl *field, uint32_t &bitfield_bit_size);
+
+ static bool FieldIsBitfield(clang::ASTContext *ast, clang::FieldDecl *field,
+ uint32_t &bitfield_bit_size);
+
+ static bool RecordHasFields(const clang::RecordDecl *record_decl);
+
+ CompilerType CreateObjCClass(const char *name, clang::DeclContext *decl_ctx,
+ bool isForwardDecl, bool isInternal,
+ ClangASTMetadata *metadata = nullptr);
+
+ bool SetTagTypeKind(clang::QualType type, int kind) const;
+
+ bool SetDefaultAccessForRecordFields(clang::RecordDecl *record_decl,
+ int default_accessibility,
+ int *assigned_accessibilities,
+ size_t num_assigned_accessibilities);
+
+ // Returns a mask containing bits from the ClangASTContext::eTypeXXX
+ // enumerations
+
+ //------------------------------------------------------------------
+ // Namespace Declarations
+ //------------------------------------------------------------------
+
+ clang::NamespaceDecl *
+ GetUniqueNamespaceDeclaration(const char *name, clang::DeclContext *decl_ctx);
+
+ static clang::NamespaceDecl *
+ GetUniqueNamespaceDeclaration(clang::ASTContext *ast, const char *name,
+ clang::DeclContext *decl_ctx);
+
+ //------------------------------------------------------------------
+ // Function Types
+ //------------------------------------------------------------------
+
+ clang::FunctionDecl *
+ CreateFunctionDeclaration(clang::DeclContext *decl_ctx, const char *name,
+ const CompilerType &function_Type, int storage,
+ bool is_inline);
+
+ static CompilerType CreateFunctionType(clang::ASTContext *ast,
+ const CompilerType &result_type,
+ const CompilerType *args,
+ unsigned num_args, bool is_variadic,
+ unsigned type_quals);
+
+ CompilerType CreateFunctionType(const CompilerType &result_type,
+ const CompilerType *args, unsigned num_args,
+ bool is_variadic, unsigned type_quals) {
+ return ClangASTContext::CreateFunctionType(
+ getASTContext(), result_type, args, num_args, is_variadic, type_quals);
+ }
+
+ clang::ParmVarDecl *CreateParameterDeclaration(const char *name,
+ const CompilerType ¶m_type,
+ int storage);
+
+ void SetFunctionParameters(clang::FunctionDecl *function_decl,
+ clang::ParmVarDecl **params, unsigned num_params);
+
+ CompilerType CreateBlockPointerType(const CompilerType &function_type);
+
+ //------------------------------------------------------------------
+ // Array Types
+ //------------------------------------------------------------------
+
+ CompilerType CreateArrayType(const CompilerType &element_type,
+ size_t element_count, bool is_vector);
+
+ //------------------------------------------------------------------
+ // Enumeration Types
+ //------------------------------------------------------------------
+ CompilerType CreateEnumerationType(const char *name,
+ clang::DeclContext *decl_ctx,
+ const Declaration &decl,
+ const CompilerType &integer_qual_type);
+
+ //------------------------------------------------------------------
+ // Integer type functions
+ //------------------------------------------------------------------
+
+ static CompilerType GetIntTypeFromBitSize(clang::ASTContext *ast,
+ size_t bit_size, bool is_signed);
+
+ CompilerType GetPointerSizedIntType(bool is_signed) {
+ return GetPointerSizedIntType(getASTContext(), is_signed);
+ }
+
+ static CompilerType GetPointerSizedIntType(clang::ASTContext *ast,
+ bool is_signed);
+
+ //------------------------------------------------------------------
+ // Floating point functions
+ //------------------------------------------------------------------
+
+ static CompilerType GetFloatTypeFromBitSize(clang::ASTContext *ast,
+ size_t bit_size);
+
+ //------------------------------------------------------------------
+ // TypeSystem methods
+ //------------------------------------------------------------------
+ DWARFASTParser *GetDWARFParser() override;
+ PDBASTParser *GetPDBParser();
+
+ //------------------------------------------------------------------
+ // ClangASTContext callbacks for external source lookups.
+ //------------------------------------------------------------------
+ static void CompleteTagDecl(void *baton, clang::TagDecl *);
+
+ static void CompleteObjCInterfaceDecl(void *baton,
+ clang::ObjCInterfaceDecl *);
+
+ static bool LayoutRecordType(
+ void *baton, const clang::RecordDecl *record_decl, uint64_t &size,
+ uint64_t &alignment,
+ llvm::DenseMap<const clang::FieldDecl *, uint64_t> &field_offsets,
+ llvm::DenseMap<const clang::CXXRecordDecl *, clang::CharUnits>
+ &base_offsets,
+ llvm::DenseMap<const clang::CXXRecordDecl *, clang::CharUnits>
+ &vbase_offsets);
+
+ //----------------------------------------------------------------------
+ // CompilerDecl override functions
+ //----------------------------------------------------------------------
+ ConstString DeclGetName(void *opaque_decl) override;
+
+ ConstString DeclGetMangledName(void *opaque_decl) override;
+
+ CompilerDeclContext DeclGetDeclContext(void *opaque_decl) override;
+
+ CompilerType DeclGetFunctionReturnType(void *opaque_decl) override;
+
+ size_t DeclGetFunctionNumArguments(void *opaque_decl) override;
+
+ CompilerType DeclGetFunctionArgumentType(void *opaque_decl,
+ size_t arg_idx) override;
+
+ //----------------------------------------------------------------------
+ // CompilerDeclContext override functions
+ //----------------------------------------------------------------------
+
+ std::vector<CompilerDecl>
+ DeclContextFindDeclByName(void *opaque_decl_ctx, ConstString name,
+ const bool ignore_using_decls) override;
+
+ bool DeclContextIsStructUnionOrClass(void *opaque_decl_ctx) override;
+
+ ConstString DeclContextGetName(void *opaque_decl_ctx) override;
+
+ ConstString DeclContextGetScopeQualifiedName(void *opaque_decl_ctx) override;
+
+ bool DeclContextIsClassMethod(void *opaque_decl_ctx,
+ lldb::LanguageType *language_ptr,
+ bool *is_instance_method_ptr,
+ ConstString *language_object_name_ptr) override;
+
+ //----------------------------------------------------------------------
+ // Clang specific clang::DeclContext functions
+ //----------------------------------------------------------------------
+
+ static clang::DeclContext *
+ DeclContextGetAsDeclContext(const CompilerDeclContext &dc);
+
+ static clang::ObjCMethodDecl *
+ DeclContextGetAsObjCMethodDecl(const CompilerDeclContext &dc);
+
+ static clang::CXXMethodDecl *
+ DeclContextGetAsCXXMethodDecl(const CompilerDeclContext &dc);
+
+ static clang::FunctionDecl *
+ DeclContextGetAsFunctionDecl(const CompilerDeclContext &dc);
+
+ static clang::NamespaceDecl *
+ DeclContextGetAsNamespaceDecl(const CompilerDeclContext &dc);
+
+ static ClangASTMetadata *DeclContextGetMetaData(const CompilerDeclContext &dc,
+ const void *object);
+
+ static clang::ASTContext *
+ DeclContextGetClangASTContext(const CompilerDeclContext &dc);
+
+ //----------------------------------------------------------------------
+ // Tests
+ //----------------------------------------------------------------------
+
+ bool IsArrayType(lldb::opaque_compiler_type_t type,
+ CompilerType *element_type, uint64_t *size,
+ bool *is_incomplete) override;
+
+ bool IsVectorType(lldb::opaque_compiler_type_t type,
+ CompilerType *element_type, uint64_t *size) override;
+
+ bool IsAggregateType(lldb::opaque_compiler_type_t type) override;
+
+ bool IsAnonymousType(lldb::opaque_compiler_type_t type) override;
+
+ bool IsBeingDefined(lldb::opaque_compiler_type_t type) override;
+
+ bool IsCharType(lldb::opaque_compiler_type_t type) override;
+
+ bool IsCompleteType(lldb::opaque_compiler_type_t type) override;
+
+ bool IsConst(lldb::opaque_compiler_type_t type) override;
+
+ bool IsCStringType(lldb::opaque_compiler_type_t type,
+ uint32_t &length) override;
+
+ static bool IsCXXClassType(const CompilerType &type);
+
+ bool IsDefined(lldb::opaque_compiler_type_t type) override;
+
+ bool IsFloatingPointType(lldb::opaque_compiler_type_t type, uint32_t &count,
+ bool &is_complex) override;
+
+ bool IsFunctionType(lldb::opaque_compiler_type_t type,
+ bool *is_variadic_ptr) override;
+
+ uint32_t IsHomogeneousAggregate(lldb::opaque_compiler_type_t type,
+ CompilerType *base_type_ptr) override;
+
+ size_t
+ GetNumberOfFunctionArguments(lldb::opaque_compiler_type_t type) override;
+
+ CompilerType GetFunctionArgumentAtIndex(lldb::opaque_compiler_type_t type,
+ const size_t index) override;
+
+ bool IsFunctionPointerType(lldb::opaque_compiler_type_t type) override;
+
+ bool IsBlockPointerType(lldb::opaque_compiler_type_t type,
+ CompilerType *function_pointer_type_ptr) override;
+
+ bool IsIntegerType(lldb::opaque_compiler_type_t type,
+ bool &is_signed) override;
+
+ bool IsEnumerationType(lldb::opaque_compiler_type_t type,
+ bool &is_signed) override;
+
+ static bool IsObjCClassType(const CompilerType &type);
+
+ static bool IsObjCClassTypeAndHasIVars(const CompilerType &type,
+ bool check_superclass);
+
+ static bool IsObjCObjectOrInterfaceType(const CompilerType &type);
+
+ static bool IsObjCObjectPointerType(const CompilerType &type,
+ CompilerType *target_type = nullptr);
+
+ bool IsPolymorphicClass(lldb::opaque_compiler_type_t type) override;
+
+ static bool IsClassType(lldb::opaque_compiler_type_t type);
+
+ static bool IsEnumType(lldb::opaque_compiler_type_t type);
+
+ bool IsPossibleDynamicType(lldb::opaque_compiler_type_t type,
+ CompilerType *target_type, // Can pass nullptr
+ bool check_cplusplus, bool check_objc) override;
+
+ bool IsRuntimeGeneratedType(lldb::opaque_compiler_type_t type) override;
+
+ bool IsPointerType(lldb::opaque_compiler_type_t type,
+ CompilerType *pointee_type) override;
+
+ bool IsPointerOrReferenceType(lldb::opaque_compiler_type_t type,
+ CompilerType *pointee_type) override;
+
+ bool IsReferenceType(lldb::opaque_compiler_type_t type,
+ CompilerType *pointee_type, bool *is_rvalue) override;
+
+ bool IsScalarType(lldb::opaque_compiler_type_t type) override;
+
+ bool IsTypedefType(lldb::opaque_compiler_type_t type) override;
+
+ bool IsVoidType(lldb::opaque_compiler_type_t type) override;
+
+ bool SupportsLanguage(lldb::LanguageType language) override;
+
+ static bool GetCXXClassName(const CompilerType &type,
+ std::string &class_name);
+
+ static bool GetObjCClassName(const CompilerType &type,
+ std::string &class_name);
+
+ //----------------------------------------------------------------------
+ // Type Completion
+ //----------------------------------------------------------------------
+
+ bool GetCompleteType(lldb::opaque_compiler_type_t type) override;
+
+ //----------------------------------------------------------------------
+ // Accessors
+ //----------------------------------------------------------------------
+
+ ConstString GetTypeName(lldb::opaque_compiler_type_t type) override;
+
+ uint32_t GetTypeInfo(lldb::opaque_compiler_type_t type,
+ CompilerType *pointee_or_element_compiler_type) override;
+
+ lldb::LanguageType
+ GetMinimumLanguage(lldb::opaque_compiler_type_t type) override;
+
+ lldb::TypeClass GetTypeClass(lldb::opaque_compiler_type_t type) override;
+
+ unsigned GetTypeQualifiers(lldb::opaque_compiler_type_t type) override;
+
+ //----------------------------------------------------------------------
+ // Creating related types
+ //----------------------------------------------------------------------
+
+ // Using the current type, create a new typedef to that type using
+ // "typedef_name"
+ // as the name and "decl_ctx" as the decl context.
+ static CompilerType
+ CreateTypedefType(const CompilerType &type, const char *typedef_name,
+ const CompilerDeclContext &compiler_decl_ctx);
+
+ CompilerType GetArrayElementType(lldb::opaque_compiler_type_t type,
+ uint64_t *stride) override;
+
+ CompilerType GetArrayType(lldb::opaque_compiler_type_t type,
+ uint64_t size) override;
+
+ CompilerType GetCanonicalType(lldb::opaque_compiler_type_t type) override;
+
+ CompilerType
+ GetFullyUnqualifiedType(lldb::opaque_compiler_type_t type) override;
+
+ // Returns -1 if this isn't a function of if the function doesn't have a
+ // prototype
+ // Returns a value >= 0 if there is a prototype.
+ int GetFunctionArgumentCount(lldb::opaque_compiler_type_t type) override;
+
+ CompilerType GetFunctionArgumentTypeAtIndex(lldb::opaque_compiler_type_t type,
+ size_t idx) override;
+
+ CompilerType
+ GetFunctionReturnType(lldb::opaque_compiler_type_t type) override;
+
+ size_t GetNumMemberFunctions(lldb::opaque_compiler_type_t type) override;
+
+ TypeMemberFunctionImpl
+ GetMemberFunctionAtIndex(lldb::opaque_compiler_type_t type,
+ size_t idx) override;
+
+ CompilerType GetNonReferenceType(lldb::opaque_compiler_type_t type) override;
+
+ CompilerType GetPointeeType(lldb::opaque_compiler_type_t type) override;
+
+ CompilerType GetPointerType(lldb::opaque_compiler_type_t type) override;
+
+ CompilerType
+ GetLValueReferenceType(lldb::opaque_compiler_type_t type) override;
+
+ CompilerType
+ GetRValueReferenceType(lldb::opaque_compiler_type_t type) override;
+
+ CompilerType AddConstModifier(lldb::opaque_compiler_type_t type) override;
+
+ CompilerType AddVolatileModifier(lldb::opaque_compiler_type_t type) override;
+
+ CompilerType AddRestrictModifier(lldb::opaque_compiler_type_t type) override;
+
+ CompilerType CreateTypedef(lldb::opaque_compiler_type_t type,
const char *name,
- bool omit_empty_base_classes) override;
-
- // Lookup a child member given a name. This function will match member names
- // only and will descend into "clang_type" children in search for the first
- // member in this class, or any base class that matches "name".
- // TODO: Return all matches for a given name by returning a vector<vector<uint32_t>>
- // so we catch all names that match a given child name, not just the first.
- size_t
- GetIndexOfChildMemberWithName (lldb::opaque_compiler_type_t type,
+ const CompilerDeclContext &decl_ctx) override;
+
+ // If the current object represents a typedef type, get the underlying type
+ CompilerType GetTypedefedType(lldb::opaque_compiler_type_t type) override;
+
+ //----------------------------------------------------------------------
+ // Create related types using the current type's AST
+ //----------------------------------------------------------------------
+ CompilerType GetBasicTypeFromAST(lldb::BasicType basic_type) override;
+
+ //----------------------------------------------------------------------
+ // Exploring the type
+ //----------------------------------------------------------------------
+
+ uint64_t GetByteSize(lldb::opaque_compiler_type_t type,
+ ExecutionContextScope *exe_scope) {
+ return (GetBitSize(type, exe_scope) + 7) / 8;
+ }
+
+ uint64_t GetBitSize(lldb::opaque_compiler_type_t type,
+ ExecutionContextScope *exe_scope) override;
+
+ lldb::Encoding GetEncoding(lldb::opaque_compiler_type_t type,
+ uint64_t &count) override;
+
+ lldb::Format GetFormat(lldb::opaque_compiler_type_t type) override;
+
+ size_t GetTypeBitAlign(lldb::opaque_compiler_type_t type) override;
+
+ uint32_t GetNumChildren(lldb::opaque_compiler_type_t type,
+ bool omit_empty_base_classes) override;
+
+ CompilerType GetBuiltinTypeByName(const ConstString &name) override;
+
+ lldb::BasicType
+ GetBasicTypeEnumeration(lldb::opaque_compiler_type_t type) override;
+
+ static lldb::BasicType
+ GetBasicTypeEnumeration(lldb::opaque_compiler_type_t type,
+ const ConstString &name);
+
+ void ForEachEnumerator(
+ lldb::opaque_compiler_type_t type,
+ std::function<bool(const CompilerType &integer_type,
+ const ConstString &name,
+ const llvm::APSInt &value)> const &callback) override;
+
+ uint32_t GetNumFields(lldb::opaque_compiler_type_t type) override;
+
+ CompilerType GetFieldAtIndex(lldb::opaque_compiler_type_t type, size_t idx,
+ std::string &name, uint64_t *bit_offset_ptr,
+ uint32_t *bitfield_bit_size_ptr,
+ bool *is_bitfield_ptr) override;
+
+ uint32_t GetNumDirectBaseClasses(lldb::opaque_compiler_type_t type) override;
+
+ uint32_t GetNumVirtualBaseClasses(lldb::opaque_compiler_type_t type) override;
+
+ CompilerType GetDirectBaseClassAtIndex(lldb::opaque_compiler_type_t type,
+ size_t idx,
+ uint32_t *bit_offset_ptr) override;
+
+ CompilerType GetVirtualBaseClassAtIndex(lldb::opaque_compiler_type_t type,
+ size_t idx,
+ uint32_t *bit_offset_ptr) override;
+
+ static uint32_t GetNumPointeeChildren(clang::QualType type);
+
+ CompilerType GetChildCompilerTypeAtIndex(
+ lldb::opaque_compiler_type_t type, ExecutionContext *exe_ctx, size_t idx,
+ bool transparent_pointers, bool omit_empty_base_classes,
+ bool ignore_array_bounds, std::string &child_name,
+ uint32_t &child_byte_size, int32_t &child_byte_offset,
+ uint32_t &child_bitfield_bit_size, uint32_t &child_bitfield_bit_offset,
+ bool &child_is_base_class, bool &child_is_deref_of_parent,
+ ValueObject *valobj, uint64_t &language_flags) override;
+
+ // Lookup a child given a name. This function will match base class names
+ // and member member names in "clang_type" only, not descendants.
+ uint32_t GetIndexOfChildWithName(lldb::opaque_compiler_type_t type,
const char *name,
- bool omit_empty_base_classes,
- std::vector<uint32_t>& child_indexes) override;
-
- size_t
- GetNumTemplateArguments (lldb::opaque_compiler_type_t type) override;
-
- CompilerType
- GetTemplateArgument (lldb::opaque_compiler_type_t type,
- size_t idx,
- lldb::TemplateArgumentKind &kind) override;
-
- CompilerType
- GetTypeForFormatters (void* type) override;
-
-#define LLDB_INVALID_DECL_LEVEL UINT32_MAX
- // LLDB_INVALID_DECL_LEVEL is returned by CountDeclLevels if
- // child_decl_ctx could not be found in decl_ctx.
- uint32_t
- CountDeclLevels (clang::DeclContext *frame_decl_ctx,
- clang::DeclContext *child_decl_ctx,
- ConstString *child_name = nullptr,
- CompilerType *child_type = nullptr);
-
- //----------------------------------------------------------------------
- // Modifying RecordType
- //----------------------------------------------------------------------
- static clang::FieldDecl *
- AddFieldToRecordType (const CompilerType& type,
- const char *name,
- const CompilerType &field_type,
- lldb::AccessType access,
- uint32_t bitfield_bit_size);
-
- static void
- BuildIndirectFields (const CompilerType& type);
-
- static void
- SetIsPacked (const CompilerType& type);
-
- static clang::VarDecl *
- AddVariableToRecordType (const CompilerType& type,
- const char *name,
- const CompilerType &var_type,
- lldb::AccessType access);
-
- clang::CXXMethodDecl *
- AddMethodToCXXRecordType (lldb::opaque_compiler_type_t type,
- const char *name,
- const CompilerType &method_type,
- lldb::AccessType access,
- bool is_virtual,
- bool is_static,
- bool is_inline,
- bool is_explicit,
- bool is_attr_used,
- bool is_artificial);
-
- // C++ Base Classes
- clang::CXXBaseSpecifier *
- CreateBaseClassSpecifier (lldb::opaque_compiler_type_t type,
- lldb::AccessType access,
- bool is_virtual,
- bool base_of_class);
-
- static void
- DeleteBaseClassSpecifiers (clang::CXXBaseSpecifier **base_classes,
- unsigned num_base_classes);
-
- bool
- SetBaseClassesForClassType (lldb::opaque_compiler_type_t type,
- clang::CXXBaseSpecifier const * const *base_classes,
- unsigned num_base_classes);
-
- static bool
- SetObjCSuperClass (const CompilerType& type,
- const CompilerType &superclass_compiler_type);
-
- static bool
- AddObjCClassProperty (const CompilerType& type,
- const char *property_name,
- const CompilerType &property_compiler_type,
- clang::ObjCIvarDecl *ivar_decl,
- const char *property_setter_name,
- const char *property_getter_name,
- uint32_t property_attributes,
- ClangASTMetadata *metadata);
-
- static clang::ObjCMethodDecl *
- AddMethodToObjCObjectType (const CompilerType& type,
- const char *name, // the full symbol name as seen in the symbol table (lldb::opaque_compiler_type_t type, "-[NString stringWithCString:]")
- const CompilerType &method_compiler_type,
- lldb::AccessType access,
- bool is_artificial,
- bool is_variadic);
-
- static bool
- SetHasExternalStorage (lldb::opaque_compiler_type_t type, bool has_extern);
-
- static bool
- GetHasExternalStorage (const CompilerType &type);
- //------------------------------------------------------------------
- // Tag Declarations
- //------------------------------------------------------------------
- static bool
- StartTagDeclarationDefinition (const CompilerType &type);
-
- static bool
- CompleteTagDeclarationDefinition (const CompilerType &type);
-
- //----------------------------------------------------------------------
- // Modifying Enumeration types
- //----------------------------------------------------------------------
- bool
- AddEnumerationValueToEnumerationType (lldb::opaque_compiler_type_t type,
- const CompilerType &enumerator_qual_type,
- const Declaration &decl,
- const char *name,
- int64_t enum_value,
- uint32_t enum_value_bit_size);
-
- CompilerType
- GetEnumerationIntegerType (lldb::opaque_compiler_type_t type);
-
- //------------------------------------------------------------------
- // Pointers & References
- //------------------------------------------------------------------
-
- // Call this function using the class type when you want to make a
- // member pointer type to pointee_type.
- static CompilerType
- CreateMemberPointerType (const CompilerType& type, const CompilerType &pointee_type);
-
- // Converts "s" to a floating point value and place resulting floating
- // point bytes in the "dst" buffer.
- size_t
- ConvertStringToFloatValue (lldb::opaque_compiler_type_t type,
- const char *s,
- uint8_t *dst,
- size_t dst_size) override;
-
- //----------------------------------------------------------------------
- // Dumping types
- //----------------------------------------------------------------------
- void
- DumpValue (lldb::opaque_compiler_type_t type,
- ExecutionContext *exe_ctx,
- Stream *s,
- lldb::Format format,
- const DataExtractor &data,
- lldb::offset_t data_offset,
- size_t data_byte_size,
- uint32_t bitfield_bit_size,
- uint32_t bitfield_bit_offset,
- bool show_types,
- bool show_summary,
- bool verbose,
- uint32_t depth) override;
-
- bool
- DumpTypeValue (lldb::opaque_compiler_type_t type,
- Stream *s,
- lldb::Format format,
- const DataExtractor &data,
- lldb::offset_t data_offset,
- size_t data_byte_size,
- uint32_t bitfield_bit_size,
- uint32_t bitfield_bit_offset,
- ExecutionContextScope *exe_scope) override;
-
- void
- DumpSummary (lldb::opaque_compiler_type_t type,
- ExecutionContext *exe_ctx,
- Stream *s,
- const DataExtractor &data,
- lldb::offset_t data_offset,
- size_t data_byte_size) override;
-
- void
- DumpTypeDescription (lldb::opaque_compiler_type_t type) override; // Dump to stdout
-
- void
- DumpTypeDescription (lldb::opaque_compiler_type_t type, Stream *s) override;
-
- static void
- DumpTypeName (const CompilerType &type);
-
- static clang::EnumDecl *
- GetAsEnumDecl (const CompilerType& type);
-
- static clang::RecordDecl *
- GetAsRecordDecl (const CompilerType& type);
-
- static clang::TagDecl *
- GetAsTagDecl (const CompilerType& type);
-
- clang::CXXRecordDecl *
- GetAsCXXRecordDecl (lldb::opaque_compiler_type_t type);
-
- static clang::ObjCInterfaceDecl *
- GetAsObjCInterfaceDecl (const CompilerType& type);
-
- clang::ClassTemplateDecl *
- ParseClassTemplateDecl (clang::DeclContext *decl_ctx,
- lldb::AccessType access_type,
- const char *parent_name,
- int tag_decl_kind,
- const ClangASTContext::TemplateParameterInfos &template_param_infos);
-
- clang::BlockDecl *
- CreateBlockDeclaration (clang::DeclContext *ctx);
-
- clang::UsingDirectiveDecl *
- CreateUsingDirectiveDeclaration (clang::DeclContext *decl_ctx, clang::NamespaceDecl *ns_decl);
-
- clang::UsingDecl *
- CreateUsingDeclaration (clang::DeclContext *current_decl_ctx, clang::NamedDecl *target);
-
- clang::VarDecl *
- CreateVariableDeclaration (clang::DeclContext *decl_context, const char *name, clang::QualType type);
-
- static lldb::opaque_compiler_type_t
- GetOpaqueCompilerType(clang::ASTContext *ast, lldb::BasicType basic_type);
-
- static clang::QualType
- GetQualType(lldb::opaque_compiler_type_t type)
- {
- if (type)
- return clang::QualType::getFromOpaquePtr(type);
- return clang::QualType();
- }
+ bool omit_empty_base_classes) override;
- static clang::QualType
- GetCanonicalQualType(lldb::opaque_compiler_type_t type)
- {
- if (type)
- return clang::QualType::getFromOpaquePtr(type).getCanonicalType();
- return clang::QualType();
- }
+ // Lookup a child member given a name. This function will match member names
+ // only and will descend into "clang_type" children in search for the first
+ // member in this class, or any base class that matches "name".
+ // TODO: Return all matches for a given name by returning a
+ // vector<vector<uint32_t>>
+ // so we catch all names that match a given child name, not just the first.
+ size_t
+ GetIndexOfChildMemberWithName(lldb::opaque_compiler_type_t type,
+ const char *name, bool omit_empty_base_classes,
+ std::vector<uint32_t> &child_indexes) override;
+
+ size_t GetNumTemplateArguments(lldb::opaque_compiler_type_t type) override;
+
+ CompilerType GetTemplateArgument(lldb::opaque_compiler_type_t type,
+ size_t idx,
+ lldb::TemplateArgumentKind &kind) override;
+
+ CompilerType GetTypeForFormatters(void *type) override;
+
+#define LLDB_INVALID_DECL_LEVEL UINT32_MAX
+ // LLDB_INVALID_DECL_LEVEL is returned by CountDeclLevels if
+ // child_decl_ctx could not be found in decl_ctx.
+ uint32_t CountDeclLevels(clang::DeclContext *frame_decl_ctx,
+ clang::DeclContext *child_decl_ctx,
+ ConstString *child_name = nullptr,
+ CompilerType *child_type = nullptr);
+
+ //----------------------------------------------------------------------
+ // Modifying RecordType
+ //----------------------------------------------------------------------
+ static clang::FieldDecl *AddFieldToRecordType(const CompilerType &type,
+ const char *name,
+ const CompilerType &field_type,
+ lldb::AccessType access,
+ uint32_t bitfield_bit_size);
+
+ static void BuildIndirectFields(const CompilerType &type);
+
+ static void SetIsPacked(const CompilerType &type);
+
+ static clang::VarDecl *AddVariableToRecordType(const CompilerType &type,
+ const char *name,
+ const CompilerType &var_type,
+ lldb::AccessType access);
+
+ clang::CXXMethodDecl *
+ AddMethodToCXXRecordType(lldb::opaque_compiler_type_t type, const char *name,
+ const CompilerType &method_type,
+ lldb::AccessType access, bool is_virtual,
+ bool is_static, bool is_inline, bool is_explicit,
+ bool is_attr_used, bool is_artificial);
+
+ // C++ Base Classes
+ clang::CXXBaseSpecifier *
+ CreateBaseClassSpecifier(lldb::opaque_compiler_type_t type,
+ lldb::AccessType access, bool is_virtual,
+ bool base_of_class);
+
+ static void DeleteBaseClassSpecifiers(clang::CXXBaseSpecifier **base_classes,
+ unsigned num_base_classes);
+
+ bool
+ SetBaseClassesForClassType(lldb::opaque_compiler_type_t type,
+ clang::CXXBaseSpecifier const *const *base_classes,
+ unsigned num_base_classes);
+
+ static bool SetObjCSuperClass(const CompilerType &type,
+ const CompilerType &superclass_compiler_type);
+
+ static bool AddObjCClassProperty(const CompilerType &type,
+ const char *property_name,
+ const CompilerType &property_compiler_type,
+ clang::ObjCIvarDecl *ivar_decl,
+ const char *property_setter_name,
+ const char *property_getter_name,
+ uint32_t property_attributes,
+ ClangASTMetadata *metadata);
+
+ static clang::ObjCMethodDecl *AddMethodToObjCObjectType(
+ const CompilerType &type,
+ const char *name, // the full symbol name as seen in the symbol table
+ // (lldb::opaque_compiler_type_t type, "-[NString
+ // stringWithCString:]")
+ const CompilerType &method_compiler_type, lldb::AccessType access,
+ bool is_artificial, bool is_variadic);
+
+ static bool SetHasExternalStorage(lldb::opaque_compiler_type_t type,
+ bool has_extern);
+
+ static bool GetHasExternalStorage(const CompilerType &type);
+ //------------------------------------------------------------------
+ // Tag Declarations
+ //------------------------------------------------------------------
+ static bool StartTagDeclarationDefinition(const CompilerType &type);
+
+ static bool CompleteTagDeclarationDefinition(const CompilerType &type);
+
+ //----------------------------------------------------------------------
+ // Modifying Enumeration types
+ //----------------------------------------------------------------------
+ bool AddEnumerationValueToEnumerationType(
+ lldb::opaque_compiler_type_t type,
+ const CompilerType &enumerator_qual_type, const Declaration &decl,
+ const char *name, int64_t enum_value, uint32_t enum_value_bit_size);
+
+ CompilerType GetEnumerationIntegerType(lldb::opaque_compiler_type_t type);
+
+ //------------------------------------------------------------------
+ // Pointers & References
+ //------------------------------------------------------------------
+
+ // Call this function using the class type when you want to make a
+ // member pointer type to pointee_type.
+ static CompilerType CreateMemberPointerType(const CompilerType &type,
+ const CompilerType &pointee_type);
+
+ // Converts "s" to a floating point value and place resulting floating
+ // point bytes in the "dst" buffer.
+ size_t ConvertStringToFloatValue(lldb::opaque_compiler_type_t type,
+ const char *s, uint8_t *dst,
+ size_t dst_size) override;
+
+ //----------------------------------------------------------------------
+ // Dumping types
+ //----------------------------------------------------------------------
+ void DumpValue(lldb::opaque_compiler_type_t type, ExecutionContext *exe_ctx,
+ Stream *s, lldb::Format format, const DataExtractor &data,
+ lldb::offset_t data_offset, size_t data_byte_size,
+ uint32_t bitfield_bit_size, uint32_t bitfield_bit_offset,
+ bool show_types, bool show_summary, bool verbose,
+ uint32_t depth) override;
+
+ bool DumpTypeValue(lldb::opaque_compiler_type_t type, Stream *s,
+ lldb::Format format, const DataExtractor &data,
+ lldb::offset_t data_offset, size_t data_byte_size,
+ uint32_t bitfield_bit_size, uint32_t bitfield_bit_offset,
+ ExecutionContextScope *exe_scope) override;
+
+ void DumpSummary(lldb::opaque_compiler_type_t type, ExecutionContext *exe_ctx,
+ Stream *s, const DataExtractor &data,
+ lldb::offset_t data_offset, size_t data_byte_size) override;
+
+ void DumpTypeDescription(
+ lldb::opaque_compiler_type_t type) override; // Dump to stdout
+
+ void DumpTypeDescription(lldb::opaque_compiler_type_t type,
+ Stream *s) override;
+
+ static void DumpTypeName(const CompilerType &type);
+
+ static clang::EnumDecl *GetAsEnumDecl(const CompilerType &type);
+
+ static clang::RecordDecl *GetAsRecordDecl(const CompilerType &type);
+
+ static clang::TagDecl *GetAsTagDecl(const CompilerType &type);
+
+ clang::CXXRecordDecl *GetAsCXXRecordDecl(lldb::opaque_compiler_type_t type);
+
+ static clang::ObjCInterfaceDecl *
+ GetAsObjCInterfaceDecl(const CompilerType &type);
+
+ clang::ClassTemplateDecl *ParseClassTemplateDecl(
+ clang::DeclContext *decl_ctx, lldb::AccessType access_type,
+ const char *parent_name, int tag_decl_kind,
+ const ClangASTContext::TemplateParameterInfos &template_param_infos);
+
+ clang::BlockDecl *CreateBlockDeclaration(clang::DeclContext *ctx);
+
+ clang::UsingDirectiveDecl *
+ CreateUsingDirectiveDeclaration(clang::DeclContext *decl_ctx,
+ clang::NamespaceDecl *ns_decl);
+
+ clang::UsingDecl *CreateUsingDeclaration(clang::DeclContext *current_decl_ctx,
+ clang::NamedDecl *target);
+
+ clang::VarDecl *CreateVariableDeclaration(clang::DeclContext *decl_context,
+ const char *name,
+ clang::QualType type);
+
+ static lldb::opaque_compiler_type_t
+ GetOpaqueCompilerType(clang::ASTContext *ast, lldb::BasicType basic_type);
+
+ static clang::QualType GetQualType(lldb::opaque_compiler_type_t type) {
+ if (type)
+ return clang::QualType::getFromOpaquePtr(type);
+ return clang::QualType();
+ }
+
+ static clang::QualType
+ GetCanonicalQualType(lldb::opaque_compiler_type_t type) {
+ if (type)
+ return clang::QualType::getFromOpaquePtr(type).getCanonicalType();
+ return clang::QualType();
+ }
- clang::DeclarationName
- GetDeclarationName(const char *name, const CompilerType &function_clang_type);
+ clang::DeclarationName
+ GetDeclarationName(const char *name, const CompilerType &function_clang_type);
protected:
- //------------------------------------------------------------------
- // Classes that inherit from ClangASTContext can see and modify these
- //------------------------------------------------------------------
- // clang-format off
+ //------------------------------------------------------------------
+ // Classes that inherit from ClangASTContext can see and modify these
+ //------------------------------------------------------------------
+ // clang-format off
std::string m_target_triple;
std::unique_ptr<clang::ASTContext> m_ast_ap;
std::unique_ptr<clang::LangOptions> m_language_options_ap;
@@ -1221,43 +994,46 @@ protected:
uint32_t m_pointer_byte_size;
bool m_ast_owned;
bool m_can_evaluate_expressions;
- // clang-format on
+ // clang-format on
private:
- //------------------------------------------------------------------
- // For ClangASTContext only
- //------------------------------------------------------------------
- ClangASTContext(const ClangASTContext&);
- const ClangASTContext& operator=(const ClangASTContext&);
+ //------------------------------------------------------------------
+ // For ClangASTContext only
+ //------------------------------------------------------------------
+ ClangASTContext(const ClangASTContext &);
+ const ClangASTContext &operator=(const ClangASTContext &);
};
-class ClangASTContextForExpressions : public ClangASTContext
-{
+class ClangASTContextForExpressions : public ClangASTContext {
public:
- ClangASTContextForExpressions (Target &target);
-
- ~ClangASTContextForExpressions() override = default;
-
- UserExpression *
- GetUserExpression (const char *expr,
- const char *expr_prefix,
- lldb::LanguageType language,
- Expression::ResultType desired_type,
- const EvaluateExpressionOptions &options) override;
-
- FunctionCaller *
- GetFunctionCaller (const CompilerType &return_type,
- const Address& function_address,
- const ValueList &arg_value_list,
- const char *name) override;
-
- UtilityFunction *
- GetUtilityFunction(const char *text, const char *name) override;
-
- PersistentExpressionState *
- GetPersistentExpressionState() override;
+ ClangASTContextForExpressions(Target &target);
+
+ ~ClangASTContextForExpressions() override = default;
+
+ UserExpression *
+ GetUserExpression(const char *expr, const char *expr_prefix,
+ lldb::LanguageType language,
+ Expression::ResultType desired_type,
+ const EvaluateExpressionOptions &options) override;
+
+ FunctionCaller *GetFunctionCaller(const CompilerType &return_type,
+ const Address &function_address,
+ const ValueList &arg_value_list,
+ const char *name) override;
+
+ UtilityFunction *GetUtilityFunction(const char *text,
+ const char *name) override;
+
+ PersistentExpressionState *GetPersistentExpressionState() override;
+
private:
- lldb::TargetWP m_target_wp;
- lldb::ClangPersistentVariablesUP m_persistent_variables; ///< These are the persistent variables associated with this process for the expression parser.
+ lldb::TargetWP m_target_wp;
+ lldb::ClangPersistentVariablesUP m_persistent_variables; ///< These are the
+ ///persistent
+ ///variables
+ ///associated with
+ ///this process for
+ ///the expression
+ ///parser.
};
} // namespace lldb_private
Modified: lldb/trunk/include/lldb/Symbol/ClangASTImporter.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Symbol/ClangASTImporter.h?rev=280751&r1=280750&r2=280751&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Symbol/ClangASTImporter.h (original)
+++ lldb/trunk/include/lldb/Symbol/ClangASTImporter.h Tue Sep 6 15:57:50 2016
@@ -26,399 +26,325 @@
#include "clang/Basic/FileSystemOptions.h"
// Project includes
-#include "lldb/lldb-types.h"
#include "lldb/Symbol/CompilerDeclContext.h"
+#include "lldb/lldb-types.h"
#include "llvm/ADT/DenseMap.h"
namespace lldb_private {
-
-class ClangASTMetrics
-{
+
+class ClangASTMetrics {
public:
- static void DumpCounters (Log *log);
- static void ClearLocalCounters ()
- {
- local_counters = { 0, 0, 0, 0, 0, 0 };
- }
-
- static void RegisterVisibleQuery ()
- {
- ++global_counters.m_visible_query_count;
- ++local_counters.m_visible_query_count;
- }
-
- static void RegisterLexicalQuery ()
- {
- ++global_counters.m_lexical_query_count;
- ++local_counters.m_lexical_query_count;
- }
-
- static void RegisterLLDBImport ()
- {
- ++global_counters.m_lldb_import_count;
- ++local_counters.m_lldb_import_count;
- }
-
- static void RegisterClangImport ()
- {
- ++global_counters.m_clang_import_count;
- ++local_counters.m_clang_import_count;
- }
-
- static void RegisterDeclCompletion ()
- {
- ++global_counters.m_decls_completed_count;
- ++local_counters.m_decls_completed_count;
- }
-
- static void RegisterRecordLayout ()
- {
- ++global_counters.m_record_layout_count;
- ++local_counters.m_record_layout_count;
- }
-
+ static void DumpCounters(Log *log);
+ static void ClearLocalCounters() { local_counters = {0, 0, 0, 0, 0, 0}; }
+
+ static void RegisterVisibleQuery() {
+ ++global_counters.m_visible_query_count;
+ ++local_counters.m_visible_query_count;
+ }
+
+ static void RegisterLexicalQuery() {
+ ++global_counters.m_lexical_query_count;
+ ++local_counters.m_lexical_query_count;
+ }
+
+ static void RegisterLLDBImport() {
+ ++global_counters.m_lldb_import_count;
+ ++local_counters.m_lldb_import_count;
+ }
+
+ static void RegisterClangImport() {
+ ++global_counters.m_clang_import_count;
+ ++local_counters.m_clang_import_count;
+ }
+
+ static void RegisterDeclCompletion() {
+ ++global_counters.m_decls_completed_count;
+ ++local_counters.m_decls_completed_count;
+ }
+
+ static void RegisterRecordLayout() {
+ ++global_counters.m_record_layout_count;
+ ++local_counters.m_record_layout_count;
+ }
+
private:
- struct Counters
- {
- uint64_t m_visible_query_count;
- uint64_t m_lexical_query_count;
- uint64_t m_lldb_import_count;
- uint64_t m_clang_import_count;
- uint64_t m_decls_completed_count;
- uint64_t m_record_layout_count;
- };
-
- static Counters global_counters;
- static Counters local_counters;
-
- static void DumpCounters (Log *log, Counters &counters);
+ struct Counters {
+ uint64_t m_visible_query_count;
+ uint64_t m_lexical_query_count;
+ uint64_t m_lldb_import_count;
+ uint64_t m_clang_import_count;
+ uint64_t m_decls_completed_count;
+ uint64_t m_record_layout_count;
+ };
+
+ static Counters global_counters;
+ static Counters local_counters;
+
+ static void DumpCounters(Log *log, Counters &counters);
};
-class ClangASTImporter
-{
+class ClangASTImporter {
public:
- struct LayoutInfo
- {
- LayoutInfo() : bit_size(0), alignment(0), field_offsets(), base_offsets(), vbase_offsets() {}
- uint64_t bit_size;
- uint64_t alignment;
- llvm::DenseMap<const clang::FieldDecl *, uint64_t> field_offsets;
- llvm::DenseMap<const clang::CXXRecordDecl *, clang::CharUnits> base_offsets;
- llvm::DenseMap<const clang::CXXRecordDecl *, clang::CharUnits> vbase_offsets;
- };
-
- ClangASTImporter () :
- m_file_manager(clang::FileSystemOptions())
- {
- }
-
- clang::QualType
- CopyType (clang::ASTContext *dst_ctx,
- clang::ASTContext *src_ctx,
- clang::QualType type);
-
- lldb::opaque_compiler_type_t
- CopyType (clang::ASTContext *dst_ctx,
- clang::ASTContext *src_ctx,
- lldb::opaque_compiler_type_t type);
-
- CompilerType
- CopyType (ClangASTContext &dst,
- const CompilerType &src_type);
-
- clang::Decl *
- CopyDecl (clang::ASTContext *dst_ctx,
- clang::ASTContext *src_ctx,
- clang::Decl *decl);
-
- lldb::opaque_compiler_type_t
- DeportType (clang::ASTContext *dst_ctx,
- clang::ASTContext *src_ctx,
- lldb::opaque_compiler_type_t type);
-
- clang::Decl *
- DeportDecl (clang::ASTContext *dst_ctx,
- clang::ASTContext *src_ctx,
- clang::Decl *decl);
+ struct LayoutInfo {
+ LayoutInfo()
+ : bit_size(0), alignment(0), field_offsets(), base_offsets(),
+ vbase_offsets() {}
+ uint64_t bit_size;
+ uint64_t alignment;
+ llvm::DenseMap<const clang::FieldDecl *, uint64_t> field_offsets;
+ llvm::DenseMap<const clang::CXXRecordDecl *, clang::CharUnits> base_offsets;
+ llvm::DenseMap<const clang::CXXRecordDecl *, clang::CharUnits>
+ vbase_offsets;
+ };
- void
- InsertRecordDecl(clang::RecordDecl *decl, const LayoutInfo &layout);
+ ClangASTImporter() : m_file_manager(clang::FileSystemOptions()) {}
- bool
- LayoutRecordType(const clang::RecordDecl *record_decl, uint64_t &bit_size, uint64_t &alignment,
- llvm::DenseMap<const clang::FieldDecl *, uint64_t> &field_offsets,
- llvm::DenseMap<const clang::CXXRecordDecl *, clang::CharUnits> &base_offsets,
- llvm::DenseMap<const clang::CXXRecordDecl *, clang::CharUnits> &vbase_offsets);
+ clang::QualType CopyType(clang::ASTContext *dst_ctx,
+ clang::ASTContext *src_ctx, clang::QualType type);
- bool
- CanImport(const CompilerType &type);
+ lldb::opaque_compiler_type_t CopyType(clang::ASTContext *dst_ctx,
+ clang::ASTContext *src_ctx,
+ lldb::opaque_compiler_type_t type);
- bool
- Import(const CompilerType &type);
+ CompilerType CopyType(ClangASTContext &dst, const CompilerType &src_type);
- bool
- CompleteType(const CompilerType &compiler_type);
+ clang::Decl *CopyDecl(clang::ASTContext *dst_ctx, clang::ASTContext *src_ctx,
+ clang::Decl *decl);
- void
- CompleteDecl(clang::Decl *decl);
+ lldb::opaque_compiler_type_t DeportType(clang::ASTContext *dst_ctx,
+ clang::ASTContext *src_ctx,
+ lldb::opaque_compiler_type_t type);
- bool
- CompleteTagDecl (clang::TagDecl *decl);
-
- bool
- CompleteTagDeclWithOrigin (clang::TagDecl *decl, clang::TagDecl *origin);
-
- bool
- CompleteObjCInterfaceDecl (clang::ObjCInterfaceDecl *interface_decl);
-
- bool
- CompleteAndFetchChildren (clang::QualType type);
-
- bool
- RequireCompleteType (clang::QualType type);
-
- bool
- ResolveDeclOrigin (const clang::Decl *decl, clang::Decl **original_decl, clang::ASTContext **original_ctx)
- {
- DeclOrigin origin = GetDeclOrigin(decl);
-
- if (original_decl)
- *original_decl = origin.decl;
-
- if (original_ctx)
- *original_ctx = origin.ctx;
-
- return origin.Valid();
- }
-
- void
- SetDeclOrigin (const clang::Decl *decl, clang::Decl *original_decl);
-
- ClangASTMetadata *
- GetDeclMetadata (const clang::Decl *decl);
-
- //
- // Namespace maps
- //
-
- typedef std::vector < std::pair<lldb::ModuleSP, CompilerDeclContext> > NamespaceMap;
- typedef std::shared_ptr<NamespaceMap> NamespaceMapSP;
-
- void RegisterNamespaceMap (const clang::NamespaceDecl *decl,
- NamespaceMapSP &namespace_map);
-
- NamespaceMapSP GetNamespaceMap (const clang::NamespaceDecl *decl);
-
- void BuildNamespaceMap (const clang::NamespaceDecl *decl);
-
- //
- // Completers for maps
- //
-
- class MapCompleter
- {
- public:
- virtual ~MapCompleter ();
-
- virtual void CompleteNamespaceMap (NamespaceMapSP &namespace_map,
- const ConstString &name,
- NamespaceMapSP &parent_map) const = 0;
- };
-
- void InstallMapCompleter (clang::ASTContext *dst_ctx, MapCompleter &completer)
- {
- ASTContextMetadataSP context_md;
- ContextMetadataMap::iterator context_md_iter = m_metadata_map.find(dst_ctx);
-
- if (context_md_iter == m_metadata_map.end())
- {
- context_md = ASTContextMetadataSP(new ASTContextMetadata(dst_ctx));
- m_metadata_map[dst_ctx] = context_md;
- }
- else
- {
- context_md = context_md_iter->second;
- }
-
- context_md->m_map_completer = &completer;
+ clang::Decl *DeportDecl(clang::ASTContext *dst_ctx,
+ clang::ASTContext *src_ctx, clang::Decl *decl);
+
+ void InsertRecordDecl(clang::RecordDecl *decl, const LayoutInfo &layout);
+
+ bool LayoutRecordType(
+ const clang::RecordDecl *record_decl, uint64_t &bit_size,
+ uint64_t &alignment,
+ llvm::DenseMap<const clang::FieldDecl *, uint64_t> &field_offsets,
+ llvm::DenseMap<const clang::CXXRecordDecl *, clang::CharUnits>
+ &base_offsets,
+ llvm::DenseMap<const clang::CXXRecordDecl *, clang::CharUnits>
+ &vbase_offsets);
+
+ bool CanImport(const CompilerType &type);
+
+ bool Import(const CompilerType &type);
+
+ bool CompleteType(const CompilerType &compiler_type);
+
+ void CompleteDecl(clang::Decl *decl);
+
+ bool CompleteTagDecl(clang::TagDecl *decl);
+
+ bool CompleteTagDeclWithOrigin(clang::TagDecl *decl, clang::TagDecl *origin);
+
+ bool CompleteObjCInterfaceDecl(clang::ObjCInterfaceDecl *interface_decl);
+
+ bool CompleteAndFetchChildren(clang::QualType type);
+
+ bool RequireCompleteType(clang::QualType type);
+
+ bool ResolveDeclOrigin(const clang::Decl *decl, clang::Decl **original_decl,
+ clang::ASTContext **original_ctx) {
+ DeclOrigin origin = GetDeclOrigin(decl);
+
+ if (original_decl)
+ *original_decl = origin.decl;
+
+ if (original_ctx)
+ *original_ctx = origin.ctx;
+
+ return origin.Valid();
+ }
+
+ void SetDeclOrigin(const clang::Decl *decl, clang::Decl *original_decl);
+
+ ClangASTMetadata *GetDeclMetadata(const clang::Decl *decl);
+
+ //
+ // Namespace maps
+ //
+
+ typedef std::vector<std::pair<lldb::ModuleSP, CompilerDeclContext>>
+ NamespaceMap;
+ typedef std::shared_ptr<NamespaceMap> NamespaceMapSP;
+
+ void RegisterNamespaceMap(const clang::NamespaceDecl *decl,
+ NamespaceMapSP &namespace_map);
+
+ NamespaceMapSP GetNamespaceMap(const clang::NamespaceDecl *decl);
+
+ void BuildNamespaceMap(const clang::NamespaceDecl *decl);
+
+ //
+ // Completers for maps
+ //
+
+ class MapCompleter {
+ public:
+ virtual ~MapCompleter();
+
+ virtual void CompleteNamespaceMap(NamespaceMapSP &namespace_map,
+ const ConstString &name,
+ NamespaceMapSP &parent_map) const = 0;
+ };
+
+ void InstallMapCompleter(clang::ASTContext *dst_ctx,
+ MapCompleter &completer) {
+ ASTContextMetadataSP context_md;
+ ContextMetadataMap::iterator context_md_iter = m_metadata_map.find(dst_ctx);
+
+ if (context_md_iter == m_metadata_map.end()) {
+ context_md = ASTContextMetadataSP(new ASTContextMetadata(dst_ctx));
+ m_metadata_map[dst_ctx] = context_md;
+ } else {
+ context_md = context_md_iter->second;
}
-
- void ForgetDestination (clang::ASTContext *dst_ctx);
- void ForgetSource (clang::ASTContext *dst_ctx, clang::ASTContext *src_ctx);
+
+ context_md->m_map_completer = &completer;
+ }
+
+ void ForgetDestination(clang::ASTContext *dst_ctx);
+ void ForgetSource(clang::ASTContext *dst_ctx, clang::ASTContext *src_ctx);
private:
- struct DeclOrigin
- {
- DeclOrigin () :
- ctx(nullptr),
- decl(nullptr)
- {
- }
-
- DeclOrigin (clang::ASTContext *_ctx,
- clang::Decl *_decl) :
- ctx(_ctx),
- decl(_decl)
- {
- }
-
- DeclOrigin (const DeclOrigin &rhs)
- {
- ctx = rhs.ctx;
- decl = rhs.decl;
- }
-
- void operator= (const DeclOrigin &rhs)
- {
- ctx = rhs.ctx;
- decl = rhs.decl;
- }
-
- bool
- Valid ()
- {
- return (ctx != nullptr || decl != nullptr);
- }
-
- clang::ASTContext *ctx;
- clang::Decl *decl;
- };
-
- typedef std::map<const clang::Decl *, DeclOrigin> OriginMap;
-
- class Minion : public clang::ASTImporter
- {
- public:
- Minion (ClangASTImporter &master,
- clang::ASTContext *target_ctx,
- clang::ASTContext *source_ctx) :
- clang::ASTImporter(*target_ctx,
- master.m_file_manager,
- *source_ctx,
- master.m_file_manager,
- true /*minimal*/),
- m_decls_to_deport(nullptr),
- m_decls_already_deported(nullptr),
- m_master(master),
- m_source_ctx(source_ctx)
- {
- }
-
- // A call to "InitDeportWorkQueues" puts the minion into deport mode.
- // In deport mode, every copied Decl that could require completion is
- // recorded and placed into the decls_to_deport set.
- //
- // A call to "ExecuteDeportWorkQueues" completes all the Decls that
- // are in decls_to_deport, adding any Decls it sees along the way that
- // it hasn't already deported. It proceeds until decls_to_deport is
- // empty.
- //
- // These calls must be paired. Leaving a minion in deport mode or
- // trying to start deport minion with a new pair of queues will result
- // in an assertion failure.
-
- void InitDeportWorkQueues (std::set<clang::NamedDecl *> *decls_to_deport,
- std::set<clang::NamedDecl *> *decls_already_deported);
- void ExecuteDeportWorkQueues ();
-
- void ImportDefinitionTo (clang::Decl *to, clang::Decl *from);
-
- clang::Decl *Imported(clang::Decl *from, clang::Decl *to) override;
-
- clang::Decl *GetOriginalDecl(clang::Decl *To) override;
-
- std::set<clang::NamedDecl *> *m_decls_to_deport;
- std::set<clang::NamedDecl *> *m_decls_already_deported;
- ClangASTImporter &m_master;
- clang::ASTContext *m_source_ctx;
- };
-
- typedef std::shared_ptr<Minion> MinionSP;
- typedef std::map<clang::ASTContext *, MinionSP> MinionMap;
- typedef std::map<const clang::NamespaceDecl *, NamespaceMapSP> NamespaceMetaMap;
-
- struct ASTContextMetadata
- {
- ASTContextMetadata(clang::ASTContext *dst_ctx) :
- m_dst_ctx (dst_ctx),
- m_minions (),
- m_origins (),
- m_namespace_maps (),
- m_map_completer (nullptr)
- {
- }
-
- clang::ASTContext *m_dst_ctx;
- MinionMap m_minions;
- OriginMap m_origins;
-
- NamespaceMetaMap m_namespace_maps;
- MapCompleter *m_map_completer;
- };
-
- typedef std::shared_ptr<ASTContextMetadata> ASTContextMetadataSP;
- typedef std::map<const clang::ASTContext *, ASTContextMetadataSP> ContextMetadataMap;
-
- ContextMetadataMap m_metadata_map;
-
- ASTContextMetadataSP
- GetContextMetadata (clang::ASTContext *dst_ctx)
- {
- ContextMetadataMap::iterator context_md_iter = m_metadata_map.find(dst_ctx);
-
- if (context_md_iter == m_metadata_map.end())
- {
- ASTContextMetadataSP context_md = ASTContextMetadataSP(new ASTContextMetadata(dst_ctx));
- m_metadata_map[dst_ctx] = context_md;
- return context_md;
- }
- else
- {
- return context_md_iter->second;
- }
+ struct DeclOrigin {
+ DeclOrigin() : ctx(nullptr), decl(nullptr) {}
+
+ DeclOrigin(clang::ASTContext *_ctx, clang::Decl *_decl)
+ : ctx(_ctx), decl(_decl) {}
+
+ DeclOrigin(const DeclOrigin &rhs) {
+ ctx = rhs.ctx;
+ decl = rhs.decl;
}
-
- ASTContextMetadataSP
- MaybeGetContextMetadata (clang::ASTContext *dst_ctx)
- {
- ContextMetadataMap::iterator context_md_iter = m_metadata_map.find(dst_ctx);
-
- if (context_md_iter != m_metadata_map.end())
- return context_md_iter->second;
- else
- return ASTContextMetadataSP();
+
+ void operator=(const DeclOrigin &rhs) {
+ ctx = rhs.ctx;
+ decl = rhs.decl;
+ }
+
+ bool Valid() { return (ctx != nullptr || decl != nullptr); }
+
+ clang::ASTContext *ctx;
+ clang::Decl *decl;
+ };
+
+ typedef std::map<const clang::Decl *, DeclOrigin> OriginMap;
+
+ class Minion : public clang::ASTImporter {
+ public:
+ Minion(ClangASTImporter &master, clang::ASTContext *target_ctx,
+ clang::ASTContext *source_ctx)
+ : clang::ASTImporter(*target_ctx, master.m_file_manager, *source_ctx,
+ master.m_file_manager, true /*minimal*/),
+ m_decls_to_deport(nullptr), m_decls_already_deported(nullptr),
+ m_master(master), m_source_ctx(source_ctx) {}
+
+ // A call to "InitDeportWorkQueues" puts the minion into deport mode.
+ // In deport mode, every copied Decl that could require completion is
+ // recorded and placed into the decls_to_deport set.
+ //
+ // A call to "ExecuteDeportWorkQueues" completes all the Decls that
+ // are in decls_to_deport, adding any Decls it sees along the way that
+ // it hasn't already deported. It proceeds until decls_to_deport is
+ // empty.
+ //
+ // These calls must be paired. Leaving a minion in deport mode or
+ // trying to start deport minion with a new pair of queues will result
+ // in an assertion failure.
+
+ void
+ InitDeportWorkQueues(std::set<clang::NamedDecl *> *decls_to_deport,
+ std::set<clang::NamedDecl *> *decls_already_deported);
+ void ExecuteDeportWorkQueues();
+
+ void ImportDefinitionTo(clang::Decl *to, clang::Decl *from);
+
+ clang::Decl *Imported(clang::Decl *from, clang::Decl *to) override;
+
+ clang::Decl *GetOriginalDecl(clang::Decl *To) override;
+
+ std::set<clang::NamedDecl *> *m_decls_to_deport;
+ std::set<clang::NamedDecl *> *m_decls_already_deported;
+ ClangASTImporter &m_master;
+ clang::ASTContext *m_source_ctx;
+ };
+
+ typedef std::shared_ptr<Minion> MinionSP;
+ typedef std::map<clang::ASTContext *, MinionSP> MinionMap;
+ typedef std::map<const clang::NamespaceDecl *, NamespaceMapSP>
+ NamespaceMetaMap;
+
+ struct ASTContextMetadata {
+ ASTContextMetadata(clang::ASTContext *dst_ctx)
+ : m_dst_ctx(dst_ctx), m_minions(), m_origins(), m_namespace_maps(),
+ m_map_completer(nullptr) {}
+
+ clang::ASTContext *m_dst_ctx;
+ MinionMap m_minions;
+ OriginMap m_origins;
+
+ NamespaceMetaMap m_namespace_maps;
+ MapCompleter *m_map_completer;
+ };
+
+ typedef std::shared_ptr<ASTContextMetadata> ASTContextMetadataSP;
+ typedef std::map<const clang::ASTContext *, ASTContextMetadataSP>
+ ContextMetadataMap;
+
+ ContextMetadataMap m_metadata_map;
+
+ ASTContextMetadataSP GetContextMetadata(clang::ASTContext *dst_ctx) {
+ ContextMetadataMap::iterator context_md_iter = m_metadata_map.find(dst_ctx);
+
+ if (context_md_iter == m_metadata_map.end()) {
+ ASTContextMetadataSP context_md =
+ ASTContextMetadataSP(new ASTContextMetadata(dst_ctx));
+ m_metadata_map[dst_ctx] = context_md;
+ return context_md;
+ } else {
+ return context_md_iter->second;
}
-
- MinionSP
- GetMinion (clang::ASTContext *dst_ctx, clang::ASTContext *src_ctx)
- {
- ASTContextMetadataSP context_md = GetContextMetadata(dst_ctx);
-
- MinionMap &minions = context_md->m_minions;
- MinionMap::iterator minion_iter = minions.find(src_ctx);
-
- if (minion_iter == minions.end())
- {
- MinionSP minion = MinionSP(new Minion(*this, dst_ctx, src_ctx));
- minions[src_ctx] = minion;
- return minion;
- }
- else
- {
- return minion_iter->second;
- }
+ }
+
+ ASTContextMetadataSP MaybeGetContextMetadata(clang::ASTContext *dst_ctx) {
+ ContextMetadataMap::iterator context_md_iter = m_metadata_map.find(dst_ctx);
+
+ if (context_md_iter != m_metadata_map.end())
+ return context_md_iter->second;
+ else
+ return ASTContextMetadataSP();
+ }
+
+ MinionSP GetMinion(clang::ASTContext *dst_ctx, clang::ASTContext *src_ctx) {
+ ASTContextMetadataSP context_md = GetContextMetadata(dst_ctx);
+
+ MinionMap &minions = context_md->m_minions;
+ MinionMap::iterator minion_iter = minions.find(src_ctx);
+
+ if (minion_iter == minions.end()) {
+ MinionSP minion = MinionSP(new Minion(*this, dst_ctx, src_ctx));
+ minions[src_ctx] = minion;
+ return minion;
+ } else {
+ return minion_iter->second;
}
-
- DeclOrigin
- GetDeclOrigin (const clang::Decl *decl);
-
- clang::FileManager m_file_manager;
- typedef llvm::DenseMap<const clang::RecordDecl *, LayoutInfo> RecordDeclToLayoutMap;
+ }
+
+ DeclOrigin GetDeclOrigin(const clang::Decl *decl);
- RecordDeclToLayoutMap m_record_decl_to_layout_map;
+ clang::FileManager m_file_manager;
+ typedef llvm::DenseMap<const clang::RecordDecl *, LayoutInfo>
+ RecordDeclToLayoutMap;
+
+ RecordDeclToLayoutMap m_record_decl_to_layout_map;
};
-
+
} // namespace lldb_private
#endif // liblldb_ClangASTImporter_h_
Modified: lldb/trunk/include/lldb/Symbol/ClangExternalASTSourceCallbacks.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Symbol/ClangExternalASTSourceCallbacks.h?rev=280751&r1=280750&r2=280751&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Symbol/ClangExternalASTSourceCallbacks.h (original)
+++ lldb/trunk/include/lldb/Symbol/ClangExternalASTSourceCallbacks.h Tue Sep 6 15:57:50 2016
@@ -15,139 +15,131 @@
// C++ Includes
// Other libraries and framework includes
-#include "llvm/ADT/DenseMap.h"
#include "clang/AST/CharUnits.h"
+#include "llvm/ADT/DenseMap.h"
// Project includes
-#include "lldb/lldb-enumerations.h"
#include "lldb/Core/ClangForward.h"
-#include "lldb/Symbol/CompilerType.h"
#include "lldb/Symbol/ClangExternalASTSourceCommon.h"
+#include "lldb/Symbol/CompilerType.h"
+#include "lldb/lldb-enumerations.h"
namespace lldb_private {
-class ClangExternalASTSourceCallbacks : public ClangExternalASTSourceCommon
-{
+class ClangExternalASTSourceCallbacks : public ClangExternalASTSourceCommon {
public:
- typedef void (*CompleteTagDeclCallback)(void *baton, clang::TagDecl *);
- typedef void (*CompleteObjCInterfaceDeclCallback)(void *baton, clang::ObjCInterfaceDecl *);
- typedef void (*FindExternalVisibleDeclsByNameCallback)(void *baton, const clang::DeclContext *DC, clang::DeclarationName Name, llvm::SmallVectorImpl <clang::NamedDecl *> *results);
- typedef bool (*LayoutRecordTypeCallback)(
- void *baton, const clang::RecordDecl *Record, uint64_t &Size, uint64_t &Alignment,
- llvm::DenseMap<const clang::FieldDecl *, uint64_t> &FieldOffsets,
- llvm::DenseMap<const clang::CXXRecordDecl *, clang::CharUnits> &BaseOffsets,
- llvm::DenseMap<const clang::CXXRecordDecl *, clang::CharUnits> &VirtualBaseOffsets);
-
- ClangExternalASTSourceCallbacks (CompleteTagDeclCallback tag_decl_callback,
- CompleteObjCInterfaceDeclCallback objc_decl_callback,
- FindExternalVisibleDeclsByNameCallback find_by_name_callback,
- LayoutRecordTypeCallback layout_record_type_callback,
- void *callback_baton) :
- m_callback_tag_decl (tag_decl_callback),
- m_callback_objc_decl (objc_decl_callback),
- m_callback_find_by_name (find_by_name_callback),
- m_callback_layout_record_type (layout_record_type_callback),
- m_callback_baton (callback_baton)
- {
- }
-
- //------------------------------------------------------------------
- // clang::ExternalASTSource
- //------------------------------------------------------------------
-
- clang::Decl *
- GetExternalDecl(uint32_t ID) override
- {
- // This method only needs to be implemented if the AST source ever
- // passes back decl sets as VisibleDeclaration objects.
- return nullptr;
- }
-
- clang::Stmt *
- GetExternalDeclStmt(uint64_t Offset) override
- {
- // This operation is meant to be used via a LazyOffsetPtr. It only
- // needs to be implemented if the AST source uses methods like
- // FunctionDecl::setLazyBody when building decls.
- return nullptr;
- }
-
- clang::Selector
- GetExternalSelector(uint32_t ID) override
- {
- // This operation only needs to be implemented if the AST source
- // returns non-zero for GetNumKnownSelectors().
- return clang::Selector();
- }
-
- uint32_t
- GetNumExternalSelectors() override
- {
- return 0;
- }
-
- clang::CXXBaseSpecifier *
- GetExternalCXXBaseSpecifiers(uint64_t Offset) override
- {
- return nullptr;
- }
-
- virtual void
- MaterializeVisibleDecls (const clang::DeclContext *decl_ctx)
- {
- }
-
- void
- FindExternalLexicalDecls(const clang::DeclContext *DC,
- llvm::function_ref<bool(clang::Decl::Kind)> IsKindWeWant,
- llvm::SmallVectorImpl<clang::Decl *> &Result) override;
-
- bool FindExternalVisibleDeclsByName(const clang::DeclContext *decl_ctx, clang::DeclarationName decl_name) override;
-
- void CompleteType(clang::TagDecl *tag_decl) override;
-
- void CompleteType(clang::ObjCInterfaceDecl *objc_decl) override;
-
- bool layoutRecordType(const clang::RecordDecl *Record, uint64_t &Size, uint64_t &Alignment,
- llvm::DenseMap<const clang::FieldDecl *, uint64_t> &FieldOffsets,
- llvm::DenseMap<const clang::CXXRecordDecl *, clang::CharUnits> &BaseOffsets,
- llvm::DenseMap<const clang::CXXRecordDecl *, clang::CharUnits> &VirtualBaseOffsets) override;
-
- void
- SetExternalSourceCallbacks (CompleteTagDeclCallback tag_decl_callback,
- CompleteObjCInterfaceDeclCallback objc_decl_callback,
- FindExternalVisibleDeclsByNameCallback find_by_name_callback,
- LayoutRecordTypeCallback layout_record_type_callback,
- void *callback_baton)
- {
- m_callback_tag_decl = tag_decl_callback;
- m_callback_objc_decl = objc_decl_callback;
- m_callback_find_by_name = find_by_name_callback;
- m_callback_layout_record_type = layout_record_type_callback;
- m_callback_baton = callback_baton;
- }
-
- void
- RemoveExternalSourceCallbacks (void *callback_baton)
- {
- if (callback_baton == m_callback_baton)
- {
- m_callback_tag_decl = nullptr;
- m_callback_objc_decl = nullptr;
- m_callback_find_by_name = nullptr;
- m_callback_layout_record_type = nullptr;
- }
+ typedef void (*CompleteTagDeclCallback)(void *baton, clang::TagDecl *);
+ typedef void (*CompleteObjCInterfaceDeclCallback)(void *baton,
+ clang::ObjCInterfaceDecl *);
+ typedef void (*FindExternalVisibleDeclsByNameCallback)(
+ void *baton, const clang::DeclContext *DC, clang::DeclarationName Name,
+ llvm::SmallVectorImpl<clang::NamedDecl *> *results);
+ typedef bool (*LayoutRecordTypeCallback)(
+ void *baton, const clang::RecordDecl *Record, uint64_t &Size,
+ uint64_t &Alignment,
+ llvm::DenseMap<const clang::FieldDecl *, uint64_t> &FieldOffsets,
+ llvm::DenseMap<const clang::CXXRecordDecl *, clang::CharUnits>
+ &BaseOffsets,
+ llvm::DenseMap<const clang::CXXRecordDecl *, clang::CharUnits>
+ &VirtualBaseOffsets);
+
+ ClangExternalASTSourceCallbacks(
+ CompleteTagDeclCallback tag_decl_callback,
+ CompleteObjCInterfaceDeclCallback objc_decl_callback,
+ FindExternalVisibleDeclsByNameCallback find_by_name_callback,
+ LayoutRecordTypeCallback layout_record_type_callback,
+ void *callback_baton)
+ : m_callback_tag_decl(tag_decl_callback),
+ m_callback_objc_decl(objc_decl_callback),
+ m_callback_find_by_name(find_by_name_callback),
+ m_callback_layout_record_type(layout_record_type_callback),
+ m_callback_baton(callback_baton) {}
+
+ //------------------------------------------------------------------
+ // clang::ExternalASTSource
+ //------------------------------------------------------------------
+
+ clang::Decl *GetExternalDecl(uint32_t ID) override {
+ // This method only needs to be implemented if the AST source ever
+ // passes back decl sets as VisibleDeclaration objects.
+ return nullptr;
+ }
+
+ clang::Stmt *GetExternalDeclStmt(uint64_t Offset) override {
+ // This operation is meant to be used via a LazyOffsetPtr. It only
+ // needs to be implemented if the AST source uses methods like
+ // FunctionDecl::setLazyBody when building decls.
+ return nullptr;
+ }
+
+ clang::Selector GetExternalSelector(uint32_t ID) override {
+ // This operation only needs to be implemented if the AST source
+ // returns non-zero for GetNumKnownSelectors().
+ return clang::Selector();
+ }
+
+ uint32_t GetNumExternalSelectors() override { return 0; }
+
+ clang::CXXBaseSpecifier *
+ GetExternalCXXBaseSpecifiers(uint64_t Offset) override {
+ return nullptr;
+ }
+
+ virtual void MaterializeVisibleDecls(const clang::DeclContext *decl_ctx) {}
+
+ void FindExternalLexicalDecls(
+ const clang::DeclContext *DC,
+ llvm::function_ref<bool(clang::Decl::Kind)> IsKindWeWant,
+ llvm::SmallVectorImpl<clang::Decl *> &Result) override;
+
+ bool
+ FindExternalVisibleDeclsByName(const clang::DeclContext *decl_ctx,
+ clang::DeclarationName decl_name) override;
+
+ void CompleteType(clang::TagDecl *tag_decl) override;
+
+ void CompleteType(clang::ObjCInterfaceDecl *objc_decl) override;
+
+ bool layoutRecordType(
+ const clang::RecordDecl *Record, uint64_t &Size, uint64_t &Alignment,
+ llvm::DenseMap<const clang::FieldDecl *, uint64_t> &FieldOffsets,
+ llvm::DenseMap<const clang::CXXRecordDecl *, clang::CharUnits>
+ &BaseOffsets,
+ llvm::DenseMap<const clang::CXXRecordDecl *, clang::CharUnits>
+ &VirtualBaseOffsets) override;
+
+ void SetExternalSourceCallbacks(
+ CompleteTagDeclCallback tag_decl_callback,
+ CompleteObjCInterfaceDeclCallback objc_decl_callback,
+ FindExternalVisibleDeclsByNameCallback find_by_name_callback,
+ LayoutRecordTypeCallback layout_record_type_callback,
+ void *callback_baton) {
+ m_callback_tag_decl = tag_decl_callback;
+ m_callback_objc_decl = objc_decl_callback;
+ m_callback_find_by_name = find_by_name_callback;
+ m_callback_layout_record_type = layout_record_type_callback;
+ m_callback_baton = callback_baton;
+ }
+
+ void RemoveExternalSourceCallbacks(void *callback_baton) {
+ if (callback_baton == m_callback_baton) {
+ m_callback_tag_decl = nullptr;
+ m_callback_objc_decl = nullptr;
+ m_callback_find_by_name = nullptr;
+ m_callback_layout_record_type = nullptr;
}
+ }
protected:
- //------------------------------------------------------------------
- // Classes that inherit from ClangExternalASTSourceCallbacks can see and modify these
- //------------------------------------------------------------------
- CompleteTagDeclCallback m_callback_tag_decl;
- CompleteObjCInterfaceDeclCallback m_callback_objc_decl;
- FindExternalVisibleDeclsByNameCallback m_callback_find_by_name;
- LayoutRecordTypeCallback m_callback_layout_record_type;
- void * m_callback_baton;
+ //------------------------------------------------------------------
+ // Classes that inherit from ClangExternalASTSourceCallbacks can see and
+ // modify these
+ //------------------------------------------------------------------
+ CompleteTagDeclCallback m_callback_tag_decl;
+ CompleteObjCInterfaceDeclCallback m_callback_objc_decl;
+ FindExternalVisibleDeclsByNameCallback m_callback_find_by_name;
+ LayoutRecordTypeCallback m_callback_layout_record_type;
+ void *m_callback_baton;
};
} // namespace lldb_private
Modified: lldb/trunk/include/lldb/Symbol/ClangExternalASTSourceCommon.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Symbol/ClangExternalASTSourceCommon.h?rev=280751&r1=280750&r2=280751&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Symbol/ClangExternalASTSourceCommon.h (original)
+++ lldb/trunk/include/lldb/Symbol/ClangExternalASTSourceCommon.h Tue Sep 6 15:57:50 2016
@@ -10,7 +10,7 @@
#ifndef liblldb_ClangExternalASTSourceCommon_h
#define liblldb_ClangExternalASTSourceCommon_h
-// Clang headers like to use NDEBUG inside of them to enable/disable debug
+// Clang headers like to use NDEBUG inside of them to enable/disable debug
// related features using "#ifndef NDEBUG" preprocessor blocks to do one thing
// or another. This is bad because it means that if clang was built in release
// mode, it assumes that you are building in release mode which is not always
@@ -40,150 +40,107 @@
#include "clang/AST/ExternalASTSource.h"
// Project includes
+#include "lldb/Core/dwarf.h"
#include "lldb/lldb-defines.h"
#include "lldb/lldb-enumerations.h"
-#include "lldb/Core/dwarf.h"
namespace lldb_private {
-class ClangASTMetadata
-{
+class ClangASTMetadata {
public:
- ClangASTMetadata () :
- m_user_id(0),
- m_union_is_user_id(false),
- m_union_is_isa_ptr(false),
- m_has_object_ptr(false),
- m_is_self (false),
- m_is_dynamic_cxx (true)
- {
- }
+ ClangASTMetadata()
+ : m_user_id(0), m_union_is_user_id(false), m_union_is_isa_ptr(false),
+ m_has_object_ptr(false), m_is_self(false), m_is_dynamic_cxx(true) {}
+
+ bool GetIsDynamicCXXType() const { return m_is_dynamic_cxx; }
+
+ void SetIsDynamicCXXType(bool b) { m_is_dynamic_cxx = b; }
+
+ void SetUserID(lldb::user_id_t user_id) {
+ m_user_id = user_id;
+ m_union_is_user_id = true;
+ m_union_is_isa_ptr = false;
+ }
+
+ lldb::user_id_t GetUserID() const {
+ if (m_union_is_user_id)
+ return m_user_id;
+ else
+ return LLDB_INVALID_UID;
+ }
+
+ void SetISAPtr(uint64_t isa_ptr) {
+ m_isa_ptr = isa_ptr;
+ m_union_is_user_id = false;
+ m_union_is_isa_ptr = true;
+ }
+
+ uint64_t GetISAPtr() const {
+ if (m_union_is_isa_ptr)
+ return m_isa_ptr;
+ else
+ return 0;
+ }
+
+ void SetObjectPtrName(const char *name) {
+ m_has_object_ptr = true;
+ if (strcmp(name, "self") == 0)
+ m_is_self = true;
+ else if (strcmp(name, "this") == 0)
+ m_is_self = false;
+ else
+ m_has_object_ptr = false;
+ }
+
+ lldb::LanguageType GetObjectPtrLanguage() const {
+ if (m_has_object_ptr) {
+ if (m_is_self)
+ return lldb::eLanguageTypeObjC;
+ else
+ return lldb::eLanguageTypeC_plus_plus;
+ }
+ return lldb::eLanguageTypeUnknown;
+ }
+
+ const char *GetObjectPtrName() const {
+ if (m_has_object_ptr) {
+ if (m_is_self)
+ return "self";
+ else
+ return "this";
+ } else
+ return nullptr;
+ }
- bool
- GetIsDynamicCXXType () const
- {
- return m_is_dynamic_cxx;
- }
+ bool HasObjectPtr() const { return m_has_object_ptr; }
- void
- SetIsDynamicCXXType (bool b)
- {
- m_is_dynamic_cxx = b;
- }
+ void Dump(Stream *s);
- void
- SetUserID (lldb::user_id_t user_id)
- {
- m_user_id = user_id;
- m_union_is_user_id = true;
- m_union_is_isa_ptr = false;
- }
-
- lldb::user_id_t
- GetUserID () const
- {
- if (m_union_is_user_id)
- return m_user_id;
- else
- return LLDB_INVALID_UID;
- }
-
- void
- SetISAPtr (uint64_t isa_ptr)
- {
- m_isa_ptr = isa_ptr;
- m_union_is_user_id = false;
- m_union_is_isa_ptr = true;
- }
-
- uint64_t
- GetISAPtr () const
- {
- if (m_union_is_isa_ptr)
- return m_isa_ptr;
- else
- return 0;
- }
-
- void
- SetObjectPtrName(const char *name)
- {
- m_has_object_ptr = true;
- if (strcmp (name, "self") == 0)
- m_is_self = true;
- else if (strcmp (name, "this") == 0)
- m_is_self = false;
- else
- m_has_object_ptr = false;
- }
-
- lldb::LanguageType
- GetObjectPtrLanguage () const
- {
- if (m_has_object_ptr)
- {
- if (m_is_self)
- return lldb::eLanguageTypeObjC;
- else
- return lldb::eLanguageTypeC_plus_plus;
- }
- return lldb::eLanguageTypeUnknown;
- }
-
- const char *
- GetObjectPtrName() const
- {
- if (m_has_object_ptr)
- {
- if (m_is_self)
- return "self";
- else
- return "this";
- }
- else
- return nullptr;
- }
-
- bool
- HasObjectPtr() const
- {
- return m_has_object_ptr;
- }
-
- void
- Dump (Stream *s);
-
private:
- union
- {
- lldb::user_id_t m_user_id;
- uint64_t m_isa_ptr;
- };
-
- bool m_union_is_user_id : 1,
- m_union_is_isa_ptr : 1,
- m_has_object_ptr : 1,
- m_is_self : 1,
- m_is_dynamic_cxx : 1;
+ union {
+ lldb::user_id_t m_user_id;
+ uint64_t m_isa_ptr;
+ };
+
+ bool m_union_is_user_id : 1, m_union_is_isa_ptr : 1, m_has_object_ptr : 1,
+ m_is_self : 1, m_is_dynamic_cxx : 1;
};
-class ClangExternalASTSourceCommon : public clang::ExternalASTSource
-{
+class ClangExternalASTSourceCommon : public clang::ExternalASTSource {
public:
- ClangExternalASTSourceCommon();
- ~ClangExternalASTSourceCommon() override;
+ ClangExternalASTSourceCommon();
+ ~ClangExternalASTSourceCommon() override;
+
+ ClangASTMetadata *GetMetadata(const void *object);
+ void SetMetadata(const void *object, ClangASTMetadata &metadata);
+ bool HasMetadata(const void *object);
+
+ static ClangExternalASTSourceCommon *Lookup(clang::ExternalASTSource *source);
+
+private:
+ typedef llvm::DenseMap<const void *, ClangASTMetadata> MetadataMap;
- ClangASTMetadata *GetMetadata(const void *object);
- void SetMetadata(const void *object, ClangASTMetadata &metadata);
- bool HasMetadata(const void *object);
-
- static ClangExternalASTSourceCommon *
- Lookup(clang::ExternalASTSource *source);
-
-private:
- typedef llvm::DenseMap<const void *, ClangASTMetadata> MetadataMap;
-
- MetadataMap m_metadata;
+ MetadataMap m_metadata;
};
} // namespace lldb_private
Modified: lldb/trunk/include/lldb/Symbol/ClangUtil.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Symbol/ClangUtil.h?rev=280751&r1=280750&r2=280751&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Symbol/ClangUtil.h (original)
+++ lldb/trunk/include/lldb/Symbol/ClangUtil.h Tue Sep 6 15:57:50 2016
@@ -16,21 +16,15 @@
#include "lldb/Symbol/CompilerType.h"
-namespace lldb_private
-{
-struct ClangUtil
-{
- static bool
- IsClangType(const CompilerType &ct);
+namespace lldb_private {
+struct ClangUtil {
+ static bool IsClangType(const CompilerType &ct);
- static clang::QualType
- GetQualType(const CompilerType &ct);
+ static clang::QualType GetQualType(const CompilerType &ct);
- static clang::QualType
- GetCanonicalQualType(const CompilerType &ct);
+ static clang::QualType GetCanonicalQualType(const CompilerType &ct);
- static CompilerType
- RemoveFastQualifiers(const CompilerType &ct);
+ static CompilerType RemoveFastQualifiers(const CompilerType &ct);
};
}
Modified: lldb/trunk/include/lldb/Symbol/CompactUnwindInfo.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Symbol/CompactUnwindInfo.h?rev=280751&r1=280750&r2=280751&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Symbol/CompactUnwindInfo.h (original)
+++ lldb/trunk/include/lldb/Symbol/CompactUnwindInfo.h Tue Sep 6 15:57:50 2016
@@ -21,141 +21,156 @@
namespace lldb_private {
-// Compact Unwind info is an unwind format used on Darwin. The unwind instructions
-// for typical compiler-generated functions can be expressed in a 32-bit encoding.
-// The format includes a two-level index so the unwind information for a function
+// Compact Unwind info is an unwind format used on Darwin. The unwind
+// instructions
+// for typical compiler-generated functions can be expressed in a 32-bit
+// encoding.
+// The format includes a two-level index so the unwind information for a
+// function
// can be found by two binary searches in the section. It can represent both
// stack frames that use a frame-pointer register and frameless functions, on
-// i386/x86_64 for instance. When a function is too complex to be represented in
+// i386/x86_64 for instance. When a function is too complex to be represented
+// in
// the compact unwind format, it calls out to eh_frame unwind instructions.
-// On Mac OS X / iOS, a function will have either a compact unwind representation
-// or an eh_frame representation. If lldb is going to benefit from the compiler's
-// description about saved register locations, it must be able to read both
+// On Mac OS X / iOS, a function will have either a compact unwind
+// representation
+// or an eh_frame representation. If lldb is going to benefit from the
+// compiler's
+// description about saved register locations, it must be able to read both
// sources of information.
-class CompactUnwindInfo
-{
+class CompactUnwindInfo {
public:
+ CompactUnwindInfo(ObjectFile &objfile, lldb::SectionSP §ion);
- CompactUnwindInfo (ObjectFile& objfile,
- lldb::SectionSP& section);
+ ~CompactUnwindInfo();
- ~CompactUnwindInfo();
+ bool GetUnwindPlan(Target &target, Address addr, UnwindPlan &unwind_plan);
- bool
- GetUnwindPlan (Target &target, Address addr, UnwindPlan& unwind_plan);
-
- bool
- IsValid (const lldb::ProcessSP &process_sp);
+ bool IsValid(const lldb::ProcessSP &process_sp);
private:
+ // The top level index entries of the compact unwind info
+ // (internal representation of struct
+ // unwind_info_section_header_index_entry)
+ // There are relatively few of these (one per 500/1000 functions, depending on
+ // format) so
+ // creating them on first scan will not be too costly.
+ struct UnwindIndex {
+ uint32_t function_offset; // The offset of the first function covered by
+ // this index
+ uint32_t second_level; // The offset (inside unwind_info sect) to the second
+ // level page for this index
+ // (either UNWIND_SECOND_LEVEL_REGULAR or UNWIND_SECOND_LEVEL_COMPRESSED)
+ uint32_t lsda_array_start; // The offset (inside unwind_info sect) LSDA
+ // array for this index
+ uint32_t lsda_array_end; // The offset to the LSDA array for the NEXT index
+ bool sentinal_entry; // There is an empty index at the end which provides
+ // the upper bound of
+ // function addresses that are described
+
+ UnwindIndex()
+ : function_offset(0), second_level(0), lsda_array_start(0),
+ lsda_array_end(0), sentinal_entry(false) {}
+
+ bool operator<(const CompactUnwindInfo::UnwindIndex &rhs) const {
+ return function_offset < rhs.function_offset;
+ }
+
+ bool operator==(const CompactUnwindInfo::UnwindIndex &rhs) const {
+ return function_offset == rhs.function_offset;
+ }
+ };
+
+ // An internal object used to store the information we retrieve about a
+ // function --
+ // the encoding bits and possibly the LSDA/personality function.
+ struct FunctionInfo {
+ uint32_t encoding; // compact encoding 32-bit value for this function
+ Address lsda_address; // the address of the LSDA data for this function
+ Address personality_ptr_address; // the address where the personality
+ // routine addr can be found
-
- // The top level index entries of the compact unwind info
- // (internal representation of struct unwind_info_section_header_index_entry)
- // There are relatively few of these (one per 500/1000 functions, depending on format) so
- // creating them on first scan will not be too costly.
- struct UnwindIndex
- {
- uint32_t function_offset; // The offset of the first function covered by this index
- uint32_t second_level; // The offset (inside unwind_info sect) to the second level page for this index
- // (either UNWIND_SECOND_LEVEL_REGULAR or UNWIND_SECOND_LEVEL_COMPRESSED)
- uint32_t lsda_array_start;// The offset (inside unwind_info sect) LSDA array for this index
- uint32_t lsda_array_end; // The offset to the LSDA array for the NEXT index
- bool sentinal_entry; // There is an empty index at the end which provides the upper bound of
- // function addresses that are described
-
- UnwindIndex() :
- function_offset (0),
- second_level (0),
- lsda_array_start(0),
- lsda_array_end(0),
- sentinal_entry (false)
- { }
-
- bool
- operator< (const CompactUnwindInfo::UnwindIndex& rhs) const
- {
- return function_offset < rhs.function_offset;
- }
-
- bool
- operator== (const CompactUnwindInfo::UnwindIndex& rhs) const
- {
- return function_offset == rhs.function_offset;
- }
-
- };
-
- // An internal object used to store the information we retrieve about a function --
- // the encoding bits and possibly the LSDA/personality function.
- struct FunctionInfo
- {
- uint32_t encoding; // compact encoding 32-bit value for this function
- Address lsda_address; // the address of the LSDA data for this function
- Address personality_ptr_address; // the address where the personality routine addr can be found
-
- uint32_t valid_range_offset_start; // first offset that this encoding is valid for (start of the function)
- uint32_t valid_range_offset_end; // the offset of the start of the next function
- FunctionInfo () : encoding(0), lsda_address(), personality_ptr_address(), valid_range_offset_start(0), valid_range_offset_end(0) { }
- };
-
- struct UnwindHeader
- {
- uint32_t version;
- uint32_t common_encodings_array_offset;
- uint32_t common_encodings_array_count;
- uint32_t personality_array_offset;
- uint32_t personality_array_count;
-
- UnwindHeader () : common_encodings_array_offset (0), common_encodings_array_count (0), personality_array_offset (0), personality_array_count (0) { }
- };
-
- void
- ScanIndex(const lldb::ProcessSP &process_sp);
-
- bool
- GetCompactUnwindInfoForFunction (Target &target, Address address, FunctionInfo &unwind_info);
-
- lldb::offset_t
- BinarySearchRegularSecondPage (uint32_t entry_page_offset, uint32_t entry_count, uint32_t function_offset, uint32_t *entry_func_start_offset, uint32_t *entry_func_end_offset);
-
- uint32_t
- BinarySearchCompressedSecondPage (uint32_t entry_page_offset, uint32_t entry_count, uint32_t function_offset_to_find, uint32_t function_offset_base, uint32_t *entry_func_start_offset, uint32_t *entry_func_end_offset);
-
+ uint32_t valid_range_offset_start; // first offset that this encoding is
+ // valid for (start of the function)
uint32_t
- GetLSDAForFunctionOffset (uint32_t lsda_offset, uint32_t lsda_count, uint32_t function_offset);
-
- bool
- CreateUnwindPlan_x86_64 (Target &target, FunctionInfo &function_info, UnwindPlan &unwind_plan, Address pc_or_function_start);
-
- bool
- CreateUnwindPlan_i386 (Target &target, FunctionInfo &function_info, UnwindPlan &unwind_plan, Address pc_or_function_start);
-
- bool
- CreateUnwindPlan_arm64 (Target &target, FunctionInfo &function_info, UnwindPlan &unwind_plan, Address pc_or_function_start);
-
- bool
- CreateUnwindPlan_armv7 (Target &target, FunctionInfo &function_info, UnwindPlan &unwind_plan, Address pc_or_function_start);
-
- ObjectFile &m_objfile;
- lldb::SectionSP m_section_sp;
- lldb::DataBufferSP m_section_contents_if_encrypted; // if the binary is encrypted, read the sect contents
- // out of live memory and cache them here
- std::mutex m_mutex;
- std::vector<UnwindIndex> m_indexes;
-
- LazyBool m_indexes_computed; // eLazyBoolYes once we've tried to parse the unwind info
- // eLazyBoolNo means we cannot parse the unwind info & should not retry
- // eLazyBoolCalculate means we haven't tried to parse it yet
-
- DataExtractor m_unwindinfo_data;
- bool m_unwindinfo_data_computed; // true once we've mapped in the unwindinfo data
+ valid_range_offset_end; // the offset of the start of the next function
+ FunctionInfo()
+ : encoding(0), lsda_address(), personality_ptr_address(),
+ valid_range_offset_start(0), valid_range_offset_end(0) {}
+ };
+
+ struct UnwindHeader {
+ uint32_t version;
+ uint32_t common_encodings_array_offset;
+ uint32_t common_encodings_array_count;
+ uint32_t personality_array_offset;
+ uint32_t personality_array_count;
+
+ UnwindHeader()
+ : common_encodings_array_offset(0), common_encodings_array_count(0),
+ personality_array_offset(0), personality_array_count(0) {}
+ };
+
+ void ScanIndex(const lldb::ProcessSP &process_sp);
+
+ bool GetCompactUnwindInfoForFunction(Target &target, Address address,
+ FunctionInfo &unwind_info);
+
+ lldb::offset_t
+ BinarySearchRegularSecondPage(uint32_t entry_page_offset,
+ uint32_t entry_count, uint32_t function_offset,
+ uint32_t *entry_func_start_offset,
+ uint32_t *entry_func_end_offset);
+
+ uint32_t BinarySearchCompressedSecondPage(uint32_t entry_page_offset,
+ uint32_t entry_count,
+ uint32_t function_offset_to_find,
+ uint32_t function_offset_base,
+ uint32_t *entry_func_start_offset,
+ uint32_t *entry_func_end_offset);
+
+ uint32_t GetLSDAForFunctionOffset(uint32_t lsda_offset, uint32_t lsda_count,
+ uint32_t function_offset);
+
+ bool CreateUnwindPlan_x86_64(Target &target, FunctionInfo &function_info,
+ UnwindPlan &unwind_plan,
+ Address pc_or_function_start);
+
+ bool CreateUnwindPlan_i386(Target &target, FunctionInfo &function_info,
+ UnwindPlan &unwind_plan,
+ Address pc_or_function_start);
+
+ bool CreateUnwindPlan_arm64(Target &target, FunctionInfo &function_info,
+ UnwindPlan &unwind_plan,
+ Address pc_or_function_start);
+
+ bool CreateUnwindPlan_armv7(Target &target, FunctionInfo &function_info,
+ UnwindPlan &unwind_plan,
+ Address pc_or_function_start);
+
+ ObjectFile &m_objfile;
+ lldb::SectionSP m_section_sp;
+ lldb::DataBufferSP m_section_contents_if_encrypted; // if the binary is
+ // encrypted, read the
+ // sect contents
+ // out of live memory and cache them here
+ std::mutex m_mutex;
+ std::vector<UnwindIndex> m_indexes;
+
+ LazyBool m_indexes_computed; // eLazyBoolYes once we've tried to parse the
+ // unwind info
+ // eLazyBoolNo means we cannot parse the unwind info & should not retry
+ // eLazyBoolCalculate means we haven't tried to parse it yet
+
+ DataExtractor m_unwindinfo_data;
+ bool m_unwindinfo_data_computed; // true once we've mapped in the unwindinfo
+ // data
- UnwindHeader m_unwind_header;
+ UnwindHeader m_unwind_header;
};
} // namespace lldb_private
-#endif // liblldb_CompactUnwindInfo_h_
+#endif // liblldb_CompactUnwindInfo_h_
Modified: lldb/trunk/include/lldb/Symbol/CompileUnit.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Symbol/CompileUnit.h?rev=280751&r1=280750&r2=280751&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Symbol/CompileUnit.h (original)
+++ lldb/trunk/include/lldb/Symbol/CompileUnit.h Tue Sep 6 15:57:50 2016
@@ -10,13 +10,13 @@
#ifndef liblldb_CompUnit_h_
#define liblldb_CompUnit_h_
-#include "lldb/lldb-enumerations.h"
-#include "lldb/Symbol/DebugMacros.h"
-#include "lldb/Symbol/Function.h"
#include "lldb/Core/FileSpecList.h"
#include "lldb/Core/ModuleChild.h"
#include "lldb/Core/Stream.h"
#include "lldb/Core/UserID.h"
+#include "lldb/Symbol/DebugMacros.h"
+#include "lldb/Symbol/Function.h"
+#include "lldb/lldb-enumerations.h"
namespace lldb_private {
//----------------------------------------------------------------------
@@ -32,445 +32,433 @@ namespace lldb_private {
/// variables, support file list (include files and inlined source
/// files), and a line table.
//----------------------------------------------------------------------
-class CompileUnit :
- public std::enable_shared_from_this<CompileUnit>,
- public ModuleChild,
- public FileSpec,
- public UserID,
- public SymbolContextScope
-{
+class CompileUnit : public std::enable_shared_from_this<CompileUnit>,
+ public ModuleChild,
+ public FileSpec,
+ public UserID,
+ public SymbolContextScope {
public:
- //------------------------------------------------------------------
- /// Construct with a module, path, UID and language.
- ///
- /// Initialize the compile unit given the owning \a module, a path
- /// to convert into a FileSpec, the SymbolFile plug-in supplied
- /// \a uid, and the source language type.
- ///
- /// @param[in] module
- /// The parent module that owns this compile unit. This value
- /// must be a valid pointer value.
- ///
- /// @param[in] user_data
- /// User data where the SymbolFile parser can store data.
- ///
- /// @param[in] pathname
- /// The path to the source file for this compile unit.
- ///
- /// @param[in] uid
- /// The user ID of the compile unit. This value is supplied by
- /// the SymbolFile plug-in and should be a value that allows
- /// the SymbolFile plug-in to easily locate and parse additional
- /// information for the compile unit.
- ///
- /// @param[in] language
- /// A language enumeration type that describes the main language
- /// of this compile unit.
- ///
- /// @param[in] is_optimized
- /// A value that can initialized with eLazyBoolYes, eLazyBoolNo
- /// or eLazyBoolCalculate. If set to eLazyBoolCalculate, then
- /// an extra call into SymbolVendor will be made to calculate if
- /// the compile unit is optimized will be made when
- /// CompileUnit::GetIsOptimized() is called.
- ///
- /// @see lldb::LanguageType
- //------------------------------------------------------------------
- CompileUnit(const lldb::ModuleSP &module_sp, void *user_data, const char *pathname, lldb::user_id_t uid,
- lldb::LanguageType language, lldb_private::LazyBool is_optimized);
-
- //------------------------------------------------------------------
- /// Construct with a module, file spec, UID and language.
- ///
- /// Initialize the compile unit given the owning \a module, a path
- /// to convert into a FileSpec, the SymbolFile plug-in supplied
- /// \a uid, and the source language type.
- ///
- /// @param[in] module
- /// The parent module that owns this compile unit. This value
- /// must be a valid pointer value.
- ///
- /// @param[in] user_data
- /// User data where the SymbolFile parser can store data.
- ///
- /// @param[in] file_spec
- /// The file specification for the source file of this compile
- /// unit.
- ///
- /// @param[in] uid
- /// The user ID of the compile unit. This value is supplied by
- /// the SymbolFile plug-in and should be a value that allows
- /// the plug-in to easily locate and parse
- /// additional information for the compile unit.
- ///
- /// @param[in] language
- /// A language enumeration type that describes the main language
- /// of this compile unit.
- ///
- /// @param[in] is_optimized
- /// A value that can initialized with eLazyBoolYes, eLazyBoolNo
- /// or eLazyBoolCalculate. If set to eLazyBoolCalculate, then
- /// an extra call into SymbolVendor will be made to calculate if
- /// the compile unit is optimized will be made when
- /// CompileUnit::GetIsOptimized() is called.
- ///
- /// @see lldb::LanguageType
- //------------------------------------------------------------------
- CompileUnit(const lldb::ModuleSP &module_sp, void *user_data, const FileSpec &file_spec, lldb::user_id_t uid,
- lldb::LanguageType language, lldb_private::LazyBool is_optimized);
-
- //------------------------------------------------------------------
- /// Destructor
- //------------------------------------------------------------------
- ~CompileUnit() override;
-
- //------------------------------------------------------------------
- /// Add a function to this compile unit.
- ///
- /// Typically called by the SymbolFile plug-ins as they partially
- /// parse the debug information.
- ///
- /// @param[in] function_sp
- /// A shared pointer to the Function object.
- //------------------------------------------------------------------
- void
- AddFunction(lldb::FunctionSP& function_sp);
-
- //------------------------------------------------------------------
- /// @copydoc SymbolContextScope::CalculateSymbolContext(SymbolContext*)
- ///
- /// @see SymbolContextScope
- //------------------------------------------------------------------
- void
- CalculateSymbolContext(SymbolContext* sc) override;
-
- lldb::ModuleSP
- CalculateSymbolContextModule() override;
-
- CompileUnit *
- CalculateSymbolContextCompileUnit() override;
-
- //------------------------------------------------------------------
- /// @copydoc SymbolContextScope::DumpSymbolContext(Stream*)
- ///
- /// @see SymbolContextScope
- //------------------------------------------------------------------
- void
- DumpSymbolContext(Stream *s) override;
-
- lldb::LanguageType
- GetLanguage();
-
- void
- SetLanguage(lldb::LanguageType language)
- {
- m_flags.Set(flagsParsedLanguage);
- m_language = language;
- }
-
- void
- GetDescription(Stream *s, lldb::DescriptionLevel level) const;
-
- //------------------------------------------------------------------
- /// Get a shared pointer to a function in this compile unit by
- /// index.
- ///
- /// Typically called when iterating though all functions in a
- /// compile unit after all functions have been parsed. This provides
- /// raw access to the function shared pointer list and will not
- /// cause the SymbolFile plug-in to parse any unparsed functions.
- ///
- /// @param[in] idx
- /// An index into the function list.
- ///
- /// @return
- /// A shared pointer to a function that might contain a NULL
- /// Function class pointer.
- //------------------------------------------------------------------
- lldb::FunctionSP
- GetFunctionAtIndex (size_t idx);
-
- //------------------------------------------------------------------
- /// Dump the compile unit contents to the stream \a s.
- ///
- /// @param[in] s
- /// The stream to which to dump the object description.
- ///
- /// @param[in] show_context
- /// If \b true, variables will dump their symbol context
- /// information.
- //------------------------------------------------------------------
- void
- Dump (Stream *s, bool show_context) const;
-
- //------------------------------------------------------------------
- /// Find the line entry by line and optional inlined file spec.
- ///
- /// Finds the first line entry that has an index greater than
- /// \a start_idx that matches \a line. If \a file_spec_ptr
- /// is NULL, then the search matches line entries whose file matches
- /// the file for the compile unit. If \a file_spec_ptr is
- /// not NULL, line entries must match the specified file spec (for
- /// inlined line table entries).
- ///
- /// Multiple calls to this function can find all entries that match
- /// a given file and line by starting with \a start_idx equal to zero,
- /// and calling this function back with the return value + 1.
- ///
- /// @param[in] start_idx
- /// The zero based index at which to start looking for matches.
- ///
- /// @param[in] line
- /// The line number to search for.
- ///
- /// @param[in] file_spec_ptr
- /// If non-NULL search for entries that match this file spec,
- /// else if NULL, search for line entries that match the compile
- /// unit file.
- ///
- /// @param[in] exact
- /// If \btrue match only if there is a line table entry for this line number.
- /// If \bfalse, find the line table entry equal to or after this line number.
- ///
- /// @param[out] line_entry
- /// If non-NULL, a copy of the line entry that was found.
- ///
- /// @return
- /// The zero based index of a matching line entry, or UINT32_MAX
- /// if no matching line entry is found.
- //------------------------------------------------------------------
- uint32_t
- FindLineEntry (uint32_t start_idx,
- uint32_t line,
- const FileSpec* file_spec_ptr,
- bool exact,
- LineEntry *line_entry);
-
- //------------------------------------------------------------------
- /// Get the line table for the compile unit.
- ///
- /// Called by clients and the SymbolFile plug-in. The SymbolFile
- /// plug-ins use this function to determine if the line table has
- /// be parsed yet. Clients use this function to get the line table
- /// from a compile unit.
- ///
- /// @return
- /// The line table object pointer, or NULL if this line table
- /// hasn't been parsed yet.
- //------------------------------------------------------------------
- LineTable*
- GetLineTable ();
-
- DebugMacros*
- GetDebugMacros ();
-
- //------------------------------------------------------------------
- /// Get the compile unit's support file list.
- ///
- /// The support file list is used by the line table, and any objects
- /// that have valid Declaration objects.
- ///
- /// @return
- /// A support file list object.
- //------------------------------------------------------------------
- FileSpecList&
- GetSupportFiles ();
-
- //------------------------------------------------------------------
- /// Get the compile unit's imported module list.
- ///
- /// This reports all the imports that the compile unit made,
- /// including the current module.
- ///
- /// @return
- /// A list of imported module names.
- //------------------------------------------------------------------
- const std::vector<ConstString> &
- GetImportedModules ();
-
- //------------------------------------------------------------------
- /// Get the SymbolFile plug-in user data.
- ///
- /// SymbolFile plug-ins can store user data to internal state or
- /// objects to quickly allow them to parse more information for a
- /// given object.
- ///
- /// @return
- /// The user data stored with the CompileUnit when it was
- /// constructed.
- //------------------------------------------------------------------
- void *
- GetUserData () const;
-
- //------------------------------------------------------------------
- /// Get the variable list for a compile unit.
- ///
- /// Called by clients to get the variable list for a compile unit.
- /// The variable list will contain all global and static variables
- /// that were defined at the compile unit level.
- ///
- /// @param[in] can_create
- /// If \b true, the variable list will be parsed on demand. If
- /// \b false, the current variable list will be returned even
- /// if it contains a NULL VariableList object (typically
- /// called by dumping routines that want to display only what
- /// has currently been parsed).
- ///
- /// @return
- /// A shared pointer to a variable list, that can contain NULL
- /// VariableList pointer if there are no global or static
- /// variables.
- //------------------------------------------------------------------
- lldb::VariableListSP
- GetVariableList (bool can_create);
-
- //------------------------------------------------------------------
- /// Finds a function by user ID.
- ///
- /// Typically used by SymbolFile plug-ins when partially parsing
- /// the debug information to see if the function has been parsed
- /// yet.
- ///
- /// @param[in] uid
- /// The user ID of the function to find. This value is supplied
- /// by the SymbolFile plug-in and should be a value that
- /// allows the plug-in to easily locate and parse additional
- /// information in the function.
- ///
- /// @return
- /// A shared pointer to the function object that might contain
- /// a NULL Function pointer.
- //------------------------------------------------------------------
- lldb::FunctionSP
- FindFunctionByUID (lldb::user_id_t uid);
-
- //------------------------------------------------------------------
- /// Set the line table for the compile unit.
- ///
- /// Called by the SymbolFile plug-in when if first parses the line
- /// table and hands ownership of the line table to this object. The
- /// compile unit owns the line table object and will delete the
- /// object when it is deleted.
- ///
- /// @param[in] line_table
- /// A line table object pointer that this object now owns.
- //------------------------------------------------------------------
- void
- SetLineTable(LineTable* line_table);
-
- void
- SetDebugMacros(const DebugMacrosSP &debug_macros);
-
- //------------------------------------------------------------------
- /// Set accessor for the variable list.
- ///
- /// Called by the SymbolFile plug-ins after they have parsed the
- /// variable lists and are ready to hand ownership of the list over
- /// to this object.
- ///
- /// @param[in] variable_list_sp
- /// A shared pointer to a VariableList.
- //------------------------------------------------------------------
- void
- SetVariableList (lldb::VariableListSP& variable_list_sp);
-
- //------------------------------------------------------------------
- /// Resolve symbol contexts by file and line.
- ///
- /// Given a file in \a file_spec, and a line number, find all
- /// instances and append them to the supplied symbol context list
- /// \a sc_list.
- ///
- /// @param[in] file_spec
- /// A file specification. If \a file_spec contains no directory
- /// information, only the basename will be used when matching
- /// contexts. If the directory in \a file_spec is valid, a
- /// complete file specification match will be performed.
- ///
- /// @param[in] line
- /// The line number to match against the compile unit's line
- /// tables.
- ///
- /// @param[in] check_inlines
- /// If \b true this function will also match any inline
- /// file and line matches. If \b false, the compile unit's
- /// file specification must match \a file_spec for any matches
- /// to be returned.
- ///
- /// @param[in] exact
- /// If true, only resolve the context if \a line exists in the line table.
- /// If false, resolve the context to the closest line greater than \a line
- /// in the line table.
- ///
- /// @param[in] resolve_scope
- /// For each matching line entry, this bitfield indicates what
- /// values within each SymbolContext that gets added to \a
- /// sc_list will be resolved. See the SymbolContext::Scope
- /// enumeration for a list of all available bits that can be
- /// resolved. Only SymbolContext entries that can be resolved
- /// using a LineEntry base address will be able to be resolved.
- ///
- /// @param[out] sc_list
- /// A SymbolContext list class that will get any matching
- /// entries appended to.
- ///
- /// @return
- /// The number of new matches that were added to \a sc_list.
- ///
- /// @see enum SymbolContext::Scope
- //------------------------------------------------------------------
- uint32_t
- ResolveSymbolContext (const FileSpec& file_spec,
- uint32_t line,
- bool check_inlines,
- bool exact,
- uint32_t resolve_scope,
- SymbolContextList &sc_list);
-
-
- //------------------------------------------------------------------
- /// Get whether compiler optimizations were enabled for this compile unit
- ///
- /// "optimized" means that the debug experience may be difficult
- /// for the user to understand. Variables may not be available when
- /// the developer would expect them, stepping through the source lines
- /// in the function may appear strange, etc.
- ///
- /// @return
- /// Returns 'true' if this compile unit was compiled with
- /// optimization. 'false' indicates that either the optimization
- /// is unknown, or this compile unit was built without optimization.
- //------------------------------------------------------------------
- bool
- GetIsOptimized ();
+ //------------------------------------------------------------------
+ /// Construct with a module, path, UID and language.
+ ///
+ /// Initialize the compile unit given the owning \a module, a path
+ /// to convert into a FileSpec, the SymbolFile plug-in supplied
+ /// \a uid, and the source language type.
+ ///
+ /// @param[in] module
+ /// The parent module that owns this compile unit. This value
+ /// must be a valid pointer value.
+ ///
+ /// @param[in] user_data
+ /// User data where the SymbolFile parser can store data.
+ ///
+ /// @param[in] pathname
+ /// The path to the source file for this compile unit.
+ ///
+ /// @param[in] uid
+ /// The user ID of the compile unit. This value is supplied by
+ /// the SymbolFile plug-in and should be a value that allows
+ /// the SymbolFile plug-in to easily locate and parse additional
+ /// information for the compile unit.
+ ///
+ /// @param[in] language
+ /// A language enumeration type that describes the main language
+ /// of this compile unit.
+ ///
+ /// @param[in] is_optimized
+ /// A value that can initialized with eLazyBoolYes, eLazyBoolNo
+ /// or eLazyBoolCalculate. If set to eLazyBoolCalculate, then
+ /// an extra call into SymbolVendor will be made to calculate if
+ /// the compile unit is optimized will be made when
+ /// CompileUnit::GetIsOptimized() is called.
+ ///
+ /// @see lldb::LanguageType
+ //------------------------------------------------------------------
+ CompileUnit(const lldb::ModuleSP &module_sp, void *user_data,
+ const char *pathname, lldb::user_id_t uid,
+ lldb::LanguageType language, lldb_private::LazyBool is_optimized);
+
+ //------------------------------------------------------------------
+ /// Construct with a module, file spec, UID and language.
+ ///
+ /// Initialize the compile unit given the owning \a module, a path
+ /// to convert into a FileSpec, the SymbolFile plug-in supplied
+ /// \a uid, and the source language type.
+ ///
+ /// @param[in] module
+ /// The parent module that owns this compile unit. This value
+ /// must be a valid pointer value.
+ ///
+ /// @param[in] user_data
+ /// User data where the SymbolFile parser can store data.
+ ///
+ /// @param[in] file_spec
+ /// The file specification for the source file of this compile
+ /// unit.
+ ///
+ /// @param[in] uid
+ /// The user ID of the compile unit. This value is supplied by
+ /// the SymbolFile plug-in and should be a value that allows
+ /// the plug-in to easily locate and parse
+ /// additional information for the compile unit.
+ ///
+ /// @param[in] language
+ /// A language enumeration type that describes the main language
+ /// of this compile unit.
+ ///
+ /// @param[in] is_optimized
+ /// A value that can initialized with eLazyBoolYes, eLazyBoolNo
+ /// or eLazyBoolCalculate. If set to eLazyBoolCalculate, then
+ /// an extra call into SymbolVendor will be made to calculate if
+ /// the compile unit is optimized will be made when
+ /// CompileUnit::GetIsOptimized() is called.
+ ///
+ /// @see lldb::LanguageType
+ //------------------------------------------------------------------
+ CompileUnit(const lldb::ModuleSP &module_sp, void *user_data,
+ const FileSpec &file_spec, lldb::user_id_t uid,
+ lldb::LanguageType language, lldb_private::LazyBool is_optimized);
+
+ //------------------------------------------------------------------
+ /// Destructor
+ //------------------------------------------------------------------
+ ~CompileUnit() override;
+
+ //------------------------------------------------------------------
+ /// Add a function to this compile unit.
+ ///
+ /// Typically called by the SymbolFile plug-ins as they partially
+ /// parse the debug information.
+ ///
+ /// @param[in] function_sp
+ /// A shared pointer to the Function object.
+ //------------------------------------------------------------------
+ void AddFunction(lldb::FunctionSP &function_sp);
+
+ //------------------------------------------------------------------
+ /// @copydoc SymbolContextScope::CalculateSymbolContext(SymbolContext*)
+ ///
+ /// @see SymbolContextScope
+ //------------------------------------------------------------------
+ void CalculateSymbolContext(SymbolContext *sc) override;
+
+ lldb::ModuleSP CalculateSymbolContextModule() override;
+
+ CompileUnit *CalculateSymbolContextCompileUnit() override;
+
+ //------------------------------------------------------------------
+ /// @copydoc SymbolContextScope::DumpSymbolContext(Stream*)
+ ///
+ /// @see SymbolContextScope
+ //------------------------------------------------------------------
+ void DumpSymbolContext(Stream *s) override;
+
+ lldb::LanguageType GetLanguage();
+
+ void SetLanguage(lldb::LanguageType language) {
+ m_flags.Set(flagsParsedLanguage);
+ m_language = language;
+ }
+
+ void GetDescription(Stream *s, lldb::DescriptionLevel level) const;
+
+ //------------------------------------------------------------------
+ /// Get a shared pointer to a function in this compile unit by
+ /// index.
+ ///
+ /// Typically called when iterating though all functions in a
+ /// compile unit after all functions have been parsed. This provides
+ /// raw access to the function shared pointer list and will not
+ /// cause the SymbolFile plug-in to parse any unparsed functions.
+ ///
+ /// @param[in] idx
+ /// An index into the function list.
+ ///
+ /// @return
+ /// A shared pointer to a function that might contain a NULL
+ /// Function class pointer.
+ //------------------------------------------------------------------
+ lldb::FunctionSP GetFunctionAtIndex(size_t idx);
+
+ //------------------------------------------------------------------
+ /// Dump the compile unit contents to the stream \a s.
+ ///
+ /// @param[in] s
+ /// The stream to which to dump the object description.
+ ///
+ /// @param[in] show_context
+ /// If \b true, variables will dump their symbol context
+ /// information.
+ //------------------------------------------------------------------
+ void Dump(Stream *s, bool show_context) const;
+
+ //------------------------------------------------------------------
+ /// Find the line entry by line and optional inlined file spec.
+ ///
+ /// Finds the first line entry that has an index greater than
+ /// \a start_idx that matches \a line. If \a file_spec_ptr
+ /// is NULL, then the search matches line entries whose file matches
+ /// the file for the compile unit. If \a file_spec_ptr is
+ /// not NULL, line entries must match the specified file spec (for
+ /// inlined line table entries).
+ ///
+ /// Multiple calls to this function can find all entries that match
+ /// a given file and line by starting with \a start_idx equal to zero,
+ /// and calling this function back with the return value + 1.
+ ///
+ /// @param[in] start_idx
+ /// The zero based index at which to start looking for matches.
+ ///
+ /// @param[in] line
+ /// The line number to search for.
+ ///
+ /// @param[in] file_spec_ptr
+ /// If non-NULL search for entries that match this file spec,
+ /// else if NULL, search for line entries that match the compile
+ /// unit file.
+ ///
+ /// @param[in] exact
+ /// If \btrue match only if there is a line table entry for this line
+ /// number.
+ /// If \bfalse, find the line table entry equal to or after this line
+ /// number.
+ ///
+ /// @param[out] line_entry
+ /// If non-NULL, a copy of the line entry that was found.
+ ///
+ /// @return
+ /// The zero based index of a matching line entry, or UINT32_MAX
+ /// if no matching line entry is found.
+ //------------------------------------------------------------------
+ uint32_t FindLineEntry(uint32_t start_idx, uint32_t line,
+ const FileSpec *file_spec_ptr, bool exact,
+ LineEntry *line_entry);
+
+ //------------------------------------------------------------------
+ /// Get the line table for the compile unit.
+ ///
+ /// Called by clients and the SymbolFile plug-in. The SymbolFile
+ /// plug-ins use this function to determine if the line table has
+ /// be parsed yet. Clients use this function to get the line table
+ /// from a compile unit.
+ ///
+ /// @return
+ /// The line table object pointer, or NULL if this line table
+ /// hasn't been parsed yet.
+ //------------------------------------------------------------------
+ LineTable *GetLineTable();
+
+ DebugMacros *GetDebugMacros();
+
+ //------------------------------------------------------------------
+ /// Get the compile unit's support file list.
+ ///
+ /// The support file list is used by the line table, and any objects
+ /// that have valid Declaration objects.
+ ///
+ /// @return
+ /// A support file list object.
+ //------------------------------------------------------------------
+ FileSpecList &GetSupportFiles();
+
+ //------------------------------------------------------------------
+ /// Get the compile unit's imported module list.
+ ///
+ /// This reports all the imports that the compile unit made,
+ /// including the current module.
+ ///
+ /// @return
+ /// A list of imported module names.
+ //------------------------------------------------------------------
+ const std::vector<ConstString> &GetImportedModules();
+
+ //------------------------------------------------------------------
+ /// Get the SymbolFile plug-in user data.
+ ///
+ /// SymbolFile plug-ins can store user data to internal state or
+ /// objects to quickly allow them to parse more information for a
+ /// given object.
+ ///
+ /// @return
+ /// The user data stored with the CompileUnit when it was
+ /// constructed.
+ //------------------------------------------------------------------
+ void *GetUserData() const;
+
+ //------------------------------------------------------------------
+ /// Get the variable list for a compile unit.
+ ///
+ /// Called by clients to get the variable list for a compile unit.
+ /// The variable list will contain all global and static variables
+ /// that were defined at the compile unit level.
+ ///
+ /// @param[in] can_create
+ /// If \b true, the variable list will be parsed on demand. If
+ /// \b false, the current variable list will be returned even
+ /// if it contains a NULL VariableList object (typically
+ /// called by dumping routines that want to display only what
+ /// has currently been parsed).
+ ///
+ /// @return
+ /// A shared pointer to a variable list, that can contain NULL
+ /// VariableList pointer if there are no global or static
+ /// variables.
+ //------------------------------------------------------------------
+ lldb::VariableListSP GetVariableList(bool can_create);
+
+ //------------------------------------------------------------------
+ /// Finds a function by user ID.
+ ///
+ /// Typically used by SymbolFile plug-ins when partially parsing
+ /// the debug information to see if the function has been parsed
+ /// yet.
+ ///
+ /// @param[in] uid
+ /// The user ID of the function to find. This value is supplied
+ /// by the SymbolFile plug-in and should be a value that
+ /// allows the plug-in to easily locate and parse additional
+ /// information in the function.
+ ///
+ /// @return
+ /// A shared pointer to the function object that might contain
+ /// a NULL Function pointer.
+ //------------------------------------------------------------------
+ lldb::FunctionSP FindFunctionByUID(lldb::user_id_t uid);
+
+ //------------------------------------------------------------------
+ /// Set the line table for the compile unit.
+ ///
+ /// Called by the SymbolFile plug-in when if first parses the line
+ /// table and hands ownership of the line table to this object. The
+ /// compile unit owns the line table object and will delete the
+ /// object when it is deleted.
+ ///
+ /// @param[in] line_table
+ /// A line table object pointer that this object now owns.
+ //------------------------------------------------------------------
+ void SetLineTable(LineTable *line_table);
+
+ void SetDebugMacros(const DebugMacrosSP &debug_macros);
+
+ //------------------------------------------------------------------
+ /// Set accessor for the variable list.
+ ///
+ /// Called by the SymbolFile plug-ins after they have parsed the
+ /// variable lists and are ready to hand ownership of the list over
+ /// to this object.
+ ///
+ /// @param[in] variable_list_sp
+ /// A shared pointer to a VariableList.
+ //------------------------------------------------------------------
+ void SetVariableList(lldb::VariableListSP &variable_list_sp);
+
+ //------------------------------------------------------------------
+ /// Resolve symbol contexts by file and line.
+ ///
+ /// Given a file in \a file_spec, and a line number, find all
+ /// instances and append them to the supplied symbol context list
+ /// \a sc_list.
+ ///
+ /// @param[in] file_spec
+ /// A file specification. If \a file_spec contains no directory
+ /// information, only the basename will be used when matching
+ /// contexts. If the directory in \a file_spec is valid, a
+ /// complete file specification match will be performed.
+ ///
+ /// @param[in] line
+ /// The line number to match against the compile unit's line
+ /// tables.
+ ///
+ /// @param[in] check_inlines
+ /// If \b true this function will also match any inline
+ /// file and line matches. If \b false, the compile unit's
+ /// file specification must match \a file_spec for any matches
+ /// to be returned.
+ ///
+ /// @param[in] exact
+ /// If true, only resolve the context if \a line exists in the line table.
+ /// If false, resolve the context to the closest line greater than \a line
+ /// in the line table.
+ ///
+ /// @param[in] resolve_scope
+ /// For each matching line entry, this bitfield indicates what
+ /// values within each SymbolContext that gets added to \a
+ /// sc_list will be resolved. See the SymbolContext::Scope
+ /// enumeration for a list of all available bits that can be
+ /// resolved. Only SymbolContext entries that can be resolved
+ /// using a LineEntry base address will be able to be resolved.
+ ///
+ /// @param[out] sc_list
+ /// A SymbolContext list class that will get any matching
+ /// entries appended to.
+ ///
+ /// @return
+ /// The number of new matches that were added to \a sc_list.
+ ///
+ /// @see enum SymbolContext::Scope
+ //------------------------------------------------------------------
+ uint32_t ResolveSymbolContext(const FileSpec &file_spec, uint32_t line,
+ bool check_inlines, bool exact,
+ uint32_t resolve_scope,
+ SymbolContextList &sc_list);
+
+ //------------------------------------------------------------------
+ /// Get whether compiler optimizations were enabled for this compile unit
+ ///
+ /// "optimized" means that the debug experience may be difficult
+ /// for the user to understand. Variables may not be available when
+ /// the developer would expect them, stepping through the source lines
+ /// in the function may appear strange, etc.
+ ///
+ /// @return
+ /// Returns 'true' if this compile unit was compiled with
+ /// optimization. 'false' indicates that either the optimization
+ /// is unknown, or this compile unit was built without optimization.
+ //------------------------------------------------------------------
+ bool GetIsOptimized();
protected:
- void *m_user_data; ///< User data for the SymbolFile parser to store information into.
- lldb::LanguageType m_language; ///< The programming language enumeration value.
- Flags m_flags; ///< Compile unit flags that help with partial parsing.
- std::vector<lldb::FunctionSP> m_functions; ///< The sparsely populated list of shared pointers to functions
- ///< that gets populated as functions get partially parsed.
- std::vector<ConstString> m_imported_modules; ///< All modules, including the current module, imported by this
- ///< compile unit.
- FileSpecList m_support_files; ///< Files associated with this compile unit's line table and declarations.
- std::unique_ptr<LineTable> m_line_table_ap; ///< Line table that will get parsed on demand.
- DebugMacrosSP m_debug_macros_sp; ///< Debug macros that will get parsed on demand.
- lldb::VariableListSP m_variables; ///< Global and static variable list that will get parsed on demand.
- lldb_private::LazyBool m_is_optimized; /// eLazyBoolYes if this compile unit was compiled with optimization.
+ void *m_user_data; ///< User data for the SymbolFile parser to store
+ ///information into.
+ lldb::LanguageType
+ m_language; ///< The programming language enumeration value.
+ Flags m_flags; ///< Compile unit flags that help with partial parsing.
+ std::vector<lldb::FunctionSP> m_functions; ///< The sparsely populated list of
+ ///shared pointers to functions
+ ///< that gets populated as functions get partially parsed.
+ std::vector<ConstString> m_imported_modules; ///< All modules, including the
+ ///current module, imported by
+ ///this
+ ///< compile unit.
+ FileSpecList m_support_files; ///< Files associated with this compile unit's
+ ///line table and declarations.
+ std::unique_ptr<LineTable>
+ m_line_table_ap; ///< Line table that will get parsed on demand.
+ DebugMacrosSP
+ m_debug_macros_sp; ///< Debug macros that will get parsed on demand.
+ lldb::VariableListSP m_variables; ///< Global and static variable list that
+ ///will get parsed on demand.
+ lldb_private::LazyBool m_is_optimized; /// eLazyBoolYes if this compile unit
+ /// was compiled with optimization.
private:
- enum
- {
- flagsParsedAllFunctions = (1u << 0), ///< Have we already parsed all our functions
- flagsParsedVariables = (1u << 1), ///< Have we already parsed globals and statics?
- flagsParsedSupportFiles = (1u << 2), ///< Have we already parsed the support files for this compile unit?
- flagsParsedLineTable = (1u << 3), ///< Have we parsed the line table already?
- flagsParsedLanguage = (1u << 4), ///< Have we parsed the language already?
- flagsParsedImportedModules = (1u << 5), ///< Have we parsed the imported modules already?
- flagsParsedDebugMacros = (1u << 6) ///< Have we parsed the debug macros already?
- };
+ enum {
+ flagsParsedAllFunctions =
+ (1u << 0), ///< Have we already parsed all our functions
+ flagsParsedVariables =
+ (1u << 1), ///< Have we already parsed globals and statics?
+ flagsParsedSupportFiles = (1u << 2), ///< Have we already parsed the support
+ ///files for this compile unit?
+ flagsParsedLineTable =
+ (1u << 3), ///< Have we parsed the line table already?
+ flagsParsedLanguage = (1u << 4), ///< Have we parsed the language already?
+ flagsParsedImportedModules =
+ (1u << 5), ///< Have we parsed the imported modules already?
+ flagsParsedDebugMacros =
+ (1u << 6) ///< Have we parsed the debug macros already?
+ };
- DISALLOW_COPY_AND_ASSIGN (CompileUnit);
+ DISALLOW_COPY_AND_ASSIGN(CompileUnit);
};
} // namespace lldb_private
Modified: lldb/trunk/include/lldb/Symbol/CompilerDecl.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Symbol/CompilerDecl.h?rev=280751&r1=280750&r2=280751&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Symbol/CompilerDecl.h (original)
+++ lldb/trunk/include/lldb/Symbol/CompilerDecl.h Tue Sep 6 15:57:50 2016
@@ -10,120 +10,85 @@
#ifndef liblldb_CompilerDecl_h_
#define liblldb_CompilerDecl_h_
-#include "lldb/lldb-private.h"
#include "lldb/Core/ConstString.h"
#include "lldb/Symbol/CompilerType.h"
+#include "lldb/lldb-private.h"
namespace lldb_private {
-class CompilerDecl
-{
+class CompilerDecl {
public:
- //----------------------------------------------------------------------
- // Constructors and Destructors
- //----------------------------------------------------------------------
- CompilerDecl () :
- m_type_system (nullptr),
- m_opaque_decl (nullptr)
- {
- }
-
- CompilerDecl (TypeSystem *type_system, void *decl) :
- m_type_system (type_system),
- m_opaque_decl (decl)
- {
- }
-
- ~CompilerDecl ()
- {
- }
-
- //----------------------------------------------------------------------
- // Tests
- //----------------------------------------------------------------------
-
- explicit operator bool () const
- {
- return IsValid ();
- }
-
- bool
- operator < (const CompilerDecl &rhs) const
- {
- if (m_type_system == rhs.m_type_system)
- return m_opaque_decl < rhs.m_opaque_decl;
- return m_type_system < rhs.m_type_system;
- }
-
- bool
- IsValid () const
- {
- return m_type_system != nullptr && m_opaque_decl != nullptr;
- }
-
- bool
- IsClang () const;
-
- //----------------------------------------------------------------------
- // Accessors
- //----------------------------------------------------------------------
-
- TypeSystem *
- GetTypeSystem() const
- {
- return m_type_system;
- }
-
- void *
- GetOpaqueDecl() const
- {
- return m_opaque_decl;
- }
-
- void
- SetDecl (TypeSystem* type_system, void* decl)
- {
- m_type_system = type_system;
- m_opaque_decl = decl;
- }
-
- void
- Clear()
- {
- m_type_system = nullptr;
- m_opaque_decl = nullptr;
- }
-
- ConstString
- GetName () const;
-
- ConstString
- GetMangledName () const;
-
- CompilerDeclContext
- GetDeclContext() const;
-
- // If this decl represents a function, return the return type
- CompilerType
- GetFunctionReturnType() const;
-
- // If this decl represents a function, return the number of arguments for the function
- size_t
- GetNumFunctionArguments() const;
-
- // If this decl represents a function, return the argument type given a zero based argument index
- CompilerType
- GetFunctionArgumentType (size_t arg_idx) const;
+ //----------------------------------------------------------------------
+ // Constructors and Destructors
+ //----------------------------------------------------------------------
+ CompilerDecl() : m_type_system(nullptr), m_opaque_decl(nullptr) {}
+
+ CompilerDecl(TypeSystem *type_system, void *decl)
+ : m_type_system(type_system), m_opaque_decl(decl) {}
+
+ ~CompilerDecl() {}
+
+ //----------------------------------------------------------------------
+ // Tests
+ //----------------------------------------------------------------------
+
+ explicit operator bool() const { return IsValid(); }
+
+ bool operator<(const CompilerDecl &rhs) const {
+ if (m_type_system == rhs.m_type_system)
+ return m_opaque_decl < rhs.m_opaque_decl;
+ return m_type_system < rhs.m_type_system;
+ }
+
+ bool IsValid() const {
+ return m_type_system != nullptr && m_opaque_decl != nullptr;
+ }
+
+ bool IsClang() const;
+
+ //----------------------------------------------------------------------
+ // Accessors
+ //----------------------------------------------------------------------
+
+ TypeSystem *GetTypeSystem() const { return m_type_system; }
+
+ void *GetOpaqueDecl() const { return m_opaque_decl; }
+
+ void SetDecl(TypeSystem *type_system, void *decl) {
+ m_type_system = type_system;
+ m_opaque_decl = decl;
+ }
+
+ void Clear() {
+ m_type_system = nullptr;
+ m_opaque_decl = nullptr;
+ }
+
+ ConstString GetName() const;
+
+ ConstString GetMangledName() const;
+
+ CompilerDeclContext GetDeclContext() const;
+
+ // If this decl represents a function, return the return type
+ CompilerType GetFunctionReturnType() const;
+
+ // If this decl represents a function, return the number of arguments for the
+ // function
+ size_t GetNumFunctionArguments() const;
+
+ // If this decl represents a function, return the argument type given a zero
+ // based argument index
+ CompilerType GetFunctionArgumentType(size_t arg_idx) const;
private:
- TypeSystem *m_type_system;
- void *m_opaque_decl;
+ TypeSystem *m_type_system;
+ void *m_opaque_decl;
};
-
-bool operator == (const CompilerDecl &lhs, const CompilerDecl &rhs);
-bool operator != (const CompilerDecl &lhs, const CompilerDecl &rhs);
-
+bool operator==(const CompilerDecl &lhs, const CompilerDecl &rhs);
+bool operator!=(const CompilerDecl &lhs, const CompilerDecl &rhs);
+
} // namespace lldb_private
#endif // #ifndef liblldb_CompilerDecl_h_
Modified: lldb/trunk/include/lldb/Symbol/CompilerDeclContext.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Symbol/CompilerDeclContext.h?rev=280751&r1=280750&r2=280751&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Symbol/CompilerDeclContext.h (original)
+++ lldb/trunk/include/lldb/Symbol/CompilerDeclContext.h Tue Sep 6 15:57:50 2016
@@ -12,138 +12,102 @@
#include <vector>
-#include "lldb/lldb-private.h"
#include "lldb/Core/ConstString.h"
+#include "lldb/lldb-private.h"
namespace lldb_private {
-class CompilerDeclContext
-{
+class CompilerDeclContext {
public:
- //----------------------------------------------------------------------
- // Constructors and Destructors
- //----------------------------------------------------------------------
- CompilerDeclContext () :
- m_type_system (nullptr),
- m_opaque_decl_ctx (nullptr)
- {
- }
-
- CompilerDeclContext (TypeSystem *type_system, void *decl_ctx) :
- m_type_system (type_system),
- m_opaque_decl_ctx (decl_ctx)
- {
- }
-
- ~CompilerDeclContext()
- {
- }
-
- //----------------------------------------------------------------------
- // Tests
- //----------------------------------------------------------------------
-
- explicit operator bool () const
- {
- return IsValid ();
- }
-
- bool
- operator < (const CompilerDeclContext &rhs) const
- {
- if (m_type_system == rhs.m_type_system)
- return m_opaque_decl_ctx < rhs.m_opaque_decl_ctx;
- return m_type_system < rhs.m_type_system;
- }
-
- bool
- IsValid () const
- {
- return m_type_system != nullptr && m_opaque_decl_ctx != nullptr;
- }
-
- bool
- IsClang () const;
-
- std::vector<CompilerDecl>
- FindDeclByName (ConstString name, const bool ignore_using_decls);
-
- //----------------------------------------------------------------------
- /// Checks if this decl context represents a method of a class.
- ///
- /// @param[out] language_ptr
- /// If non NULL and \b true is returned from this function,
- /// this will indicate if the language that respresents the method.
- ///
- /// @param[out] is_instance_method_ptr
- /// If non NULL and \b true is returned from this function,
- /// this will indicate if the method is an instance function (true)
- /// or a class method (false indicating the function is static, or
- /// doesn't require an instance of the class to be called).
- ///
- /// @param[out] language_object_name_ptr
- /// If non NULL and \b true is returned from this function,
- /// this will indicate if implicit object name for the language
- /// like "this" for C++, and "self" for Objective C.
- ///
- /// @return
- /// Returns true if this is a decl context that represents a method
- /// in a struct, union or class.
- //----------------------------------------------------------------------
- bool
- IsClassMethod (lldb::LanguageType *language_ptr,
- bool *is_instance_method_ptr,
- ConstString *language_object_name_ptr);
-
- //----------------------------------------------------------------------
- // Accessors
- //----------------------------------------------------------------------
-
- TypeSystem *
- GetTypeSystem() const
- {
- return m_type_system;
- }
-
- void *
- GetOpaqueDeclContext() const
- {
- return m_opaque_decl_ctx;
- }
-
- void
- SetDeclContext (TypeSystem* type_system, void* decl_ctx)
- {
- m_type_system = type_system;
- m_opaque_decl_ctx = decl_ctx;
- }
-
- void
- Clear()
- {
- m_type_system = nullptr;
- m_opaque_decl_ctx = nullptr;
- }
+ //----------------------------------------------------------------------
+ // Constructors and Destructors
+ //----------------------------------------------------------------------
+ CompilerDeclContext() : m_type_system(nullptr), m_opaque_decl_ctx(nullptr) {}
+
+ CompilerDeclContext(TypeSystem *type_system, void *decl_ctx)
+ : m_type_system(type_system), m_opaque_decl_ctx(decl_ctx) {}
+
+ ~CompilerDeclContext() {}
+
+ //----------------------------------------------------------------------
+ // Tests
+ //----------------------------------------------------------------------
+
+ explicit operator bool() const { return IsValid(); }
+
+ bool operator<(const CompilerDeclContext &rhs) const {
+ if (m_type_system == rhs.m_type_system)
+ return m_opaque_decl_ctx < rhs.m_opaque_decl_ctx;
+ return m_type_system < rhs.m_type_system;
+ }
+
+ bool IsValid() const {
+ return m_type_system != nullptr && m_opaque_decl_ctx != nullptr;
+ }
+
+ bool IsClang() const;
+
+ std::vector<CompilerDecl> FindDeclByName(ConstString name,
+ const bool ignore_using_decls);
+
+ //----------------------------------------------------------------------
+ /// Checks if this decl context represents a method of a class.
+ ///
+ /// @param[out] language_ptr
+ /// If non NULL and \b true is returned from this function,
+ /// this will indicate if the language that respresents the method.
+ ///
+ /// @param[out] is_instance_method_ptr
+ /// If non NULL and \b true is returned from this function,
+ /// this will indicate if the method is an instance function (true)
+ /// or a class method (false indicating the function is static, or
+ /// doesn't require an instance of the class to be called).
+ ///
+ /// @param[out] language_object_name_ptr
+ /// If non NULL and \b true is returned from this function,
+ /// this will indicate if implicit object name for the language
+ /// like "this" for C++, and "self" for Objective C.
+ ///
+ /// @return
+ /// Returns true if this is a decl context that represents a method
+ /// in a struct, union or class.
+ //----------------------------------------------------------------------
+ bool IsClassMethod(lldb::LanguageType *language_ptr,
+ bool *is_instance_method_ptr,
+ ConstString *language_object_name_ptr);
+
+ //----------------------------------------------------------------------
+ // Accessors
+ //----------------------------------------------------------------------
+
+ TypeSystem *GetTypeSystem() const { return m_type_system; }
+
+ void *GetOpaqueDeclContext() const { return m_opaque_decl_ctx; }
+
+ void SetDeclContext(TypeSystem *type_system, void *decl_ctx) {
+ m_type_system = type_system;
+ m_opaque_decl_ctx = decl_ctx;
+ }
+
+ void Clear() {
+ m_type_system = nullptr;
+ m_opaque_decl_ctx = nullptr;
+ }
- ConstString
- GetName () const;
+ ConstString GetName() const;
- ConstString
- GetScopeQualifiedName() const;
+ ConstString GetScopeQualifiedName() const;
- bool
- IsStructUnionOrClass () const;
+ bool IsStructUnionOrClass() const;
private:
- TypeSystem *m_type_system;
- void *m_opaque_decl_ctx;
-
+ TypeSystem *m_type_system;
+ void *m_opaque_decl_ctx;
};
-
-bool operator == (const CompilerDeclContext &lhs, const CompilerDeclContext &rhs);
-bool operator != (const CompilerDeclContext &lhs, const CompilerDeclContext &rhs);
-
+bool operator==(const CompilerDeclContext &lhs, const CompilerDeclContext &rhs);
+bool operator!=(const CompilerDeclContext &lhs, const CompilerDeclContext &rhs);
+
} // namespace lldb_private
#endif // #ifndef liblldb_CompilerDeclContext_h_
Modified: lldb/trunk/include/lldb/Symbol/CompilerType.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Symbol/CompilerType.h?rev=280751&r1=280750&r2=280751&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Symbol/CompilerType.h (original)
+++ lldb/trunk/include/lldb/Symbol/CompilerType.h Tue Sep 6 15:57:50 2016
@@ -18,565 +18,414 @@
// Other libraries and framework includes
// Project includes
-#include "lldb/lldb-private.h"
#include "lldb/Core/ClangForward.h"
+#include "lldb/lldb-private.h"
namespace lldb_private {
//----------------------------------------------------------------------
-// A class that can carry around a clang ASTContext and a opaque clang
+// A class that can carry around a clang ASTContext and a opaque clang
// QualType. A clang::QualType can be easily reconstructed from an
-// opaque clang type and often the ASTContext is needed when doing
+// opaque clang type and often the ASTContext is needed when doing
// various type related tasks, so this class allows both items to travel
// in a single very lightweight class that can be used. There are many
// static equivalents of the member functions that allow the ASTContext
// and the opaque clang QualType to be specified for ease of use and
// to avoid code duplication.
//----------------------------------------------------------------------
-class CompilerType
-{
+class CompilerType {
public:
- //----------------------------------------------------------------------
- // Constructors and Destructors
- //----------------------------------------------------------------------
- CompilerType (TypeSystem *type_system, lldb::opaque_compiler_type_t type);
- CompilerType (clang::ASTContext *ast_context, clang::QualType qual_type);
-
- CompilerType (const CompilerType &rhs) :
- m_type (rhs.m_type),
- m_type_system (rhs.m_type_system)
- {
- }
-
- CompilerType () :
- m_type (nullptr),
- m_type_system (nullptr)
- {
- }
-
- ~CompilerType();
-
- //----------------------------------------------------------------------
- // Operators
- //----------------------------------------------------------------------
-
- const CompilerType &
- operator= (const CompilerType &rhs)
- {
- m_type = rhs.m_type;
- m_type_system = rhs.m_type_system;
- return *this;
- }
-
- //----------------------------------------------------------------------
- // Tests
- //----------------------------------------------------------------------
-
- explicit operator bool () const
- {
- return m_type != nullptr && m_type_system != nullptr;
- }
-
- bool
- operator < (const CompilerType &rhs) const
- {
- if (m_type_system == rhs.m_type_system)
- return m_type < rhs.m_type;
- return m_type_system < rhs.m_type_system;
- }
-
- bool
- IsValid () const
- {
- return m_type != nullptr && m_type_system != nullptr;
- }
-
- bool
- IsArrayType (CompilerType *element_type,
- uint64_t *size,
- bool *is_incomplete) const;
-
- bool
- IsVectorType (CompilerType *element_type,
- uint64_t *size) const;
-
- bool
- IsArrayOfScalarType () const;
-
- bool
- IsAggregateType () const;
-
- bool
- IsAnonymousType () const;
-
- bool
- IsBeingDefined () const;
-
- bool
- IsCharType () const;
-
- bool
- IsCompleteType () const;
-
- bool
- IsConst() const;
-
- bool
- IsCStringType (uint32_t &length) const;
-
- bool
- IsDefined() const;
-
- bool
- IsFloatingPointType (uint32_t &count, bool &is_complex) const;
-
- bool
- IsFunctionType(bool *is_variadic_ptr = nullptr) const;
-
- uint32_t
- IsHomogeneousAggregate (CompilerType* base_type_ptr) const;
-
- size_t
- GetNumberOfFunctionArguments () const;
-
- CompilerType
- GetFunctionArgumentAtIndex (const size_t index) const;
-
- bool
- IsVariadicFunctionType () const;
-
- bool
- IsFunctionPointerType () const;
-
- bool
- IsBlockPointerType (CompilerType *function_pointer_type_ptr) const;
-
- bool
- IsIntegerType (bool &is_signed) const;
-
- bool
- IsEnumerationType (bool &is_signed) const;
-
- bool
- IsIntegerOrEnumerationType (bool &is_signed) const;
-
- bool
- IsPolymorphicClass () const;
-
- bool
- IsPossibleCPlusPlusDynamicType(CompilerType *target_type = nullptr) const
- {
- return IsPossibleDynamicType (target_type, true, false);
- }
-
- bool
- IsPossibleDynamicType(CompilerType *target_type, // Can pass nullptr
- bool check_cplusplus,
- bool check_objc) const;
-
- bool
- IsPointerToScalarType () const;
-
- bool
- IsRuntimeGeneratedType () const;
-
- bool
- IsPointerType(CompilerType *pointee_type = nullptr) const;
-
- bool
- IsPointerOrReferenceType(CompilerType *pointee_type = nullptr) const;
-
- bool
- IsReferenceType(CompilerType *pointee_type = nullptr, bool* is_rvalue = nullptr) const;
-
- bool
- ShouldTreatScalarValueAsAddress () const;
-
- bool
- IsScalarType () const;
-
- bool
- IsTypedefType () const;
-
- bool
- IsVoidType () const;
-
- //----------------------------------------------------------------------
- // Type Completion
- //----------------------------------------------------------------------
-
- bool
- GetCompleteType () const;
-
- //----------------------------------------------------------------------
- // AST related queries
- //----------------------------------------------------------------------
-
- size_t
- GetPointerByteSize () const;
-
- //----------------------------------------------------------------------
- // Accessors
- //----------------------------------------------------------------------
-
- TypeSystem *
- GetTypeSystem() const
- {
- return m_type_system;
- }
-
- ConstString
- GetConstQualifiedTypeName () const;
-
- ConstString
- GetConstTypeName () const;
-
- ConstString
- GetTypeName () const;
-
- ConstString
- GetDisplayTypeName () const;
-
- uint32_t
- GetTypeInfo(CompilerType *pointee_or_element_compiler_type = nullptr) const;
-
- lldb::LanguageType
- GetMinimumLanguage ();
-
- lldb::opaque_compiler_type_t
- GetOpaqueQualType() const
- {
- return m_type;
- }
-
- lldb::TypeClass
- GetTypeClass () const;
-
- void
- SetCompilerType (TypeSystem* type_system, lldb::opaque_compiler_type_t type);
-
- void
- SetCompilerType (clang::ASTContext *ast, clang::QualType qual_type);
-
- unsigned
- GetTypeQualifiers() const;
-
- //----------------------------------------------------------------------
- // Creating related types
- //----------------------------------------------------------------------
-
- CompilerType
- GetArrayElementType(uint64_t *stride = nullptr) const;
-
- CompilerType
- GetArrayType (uint64_t size) const;
-
- CompilerType
- GetCanonicalType () const;
-
- CompilerType
- GetFullyUnqualifiedType () const;
-
- // Returns -1 if this isn't a function of if the function doesn't have a prototype
- // Returns a value >= 0 if there is a prototype.
- int
- GetFunctionArgumentCount () const;
-
- CompilerType
- GetFunctionArgumentTypeAtIndex (size_t idx) const;
-
- CompilerType
- GetFunctionReturnType () const;
-
- size_t
- GetNumMemberFunctions () const;
-
- TypeMemberFunctionImpl
- GetMemberFunctionAtIndex (size_t idx);
-
- //----------------------------------------------------------------------
- // If this type is a reference to a type (L value or R value reference),
- // return a new type with the reference removed, else return the current
- // type itself.
- //----------------------------------------------------------------------
- CompilerType
- GetNonReferenceType () const;
-
- //----------------------------------------------------------------------
- // If this type is a pointer type, return the type that the pointer
- // points to, else return an invalid type.
- //----------------------------------------------------------------------
- CompilerType
- GetPointeeType () const;
-
- //----------------------------------------------------------------------
- // Return a new CompilerType that is a pointer to this type
- //----------------------------------------------------------------------
- CompilerType
- GetPointerType () const;
-
- //----------------------------------------------------------------------
- // Return a new CompilerType that is a L value reference to this type if
- // this type is valid and the type system supports L value references,
- // else return an invalid type.
- //----------------------------------------------------------------------
- CompilerType
- GetLValueReferenceType () const;
-
- //----------------------------------------------------------------------
- // Return a new CompilerType that is a R value reference to this type if
- // this type is valid and the type system supports R value references,
- // else return an invalid type.
- //----------------------------------------------------------------------
- CompilerType
- GetRValueReferenceType () const;
-
- //----------------------------------------------------------------------
- // Return a new CompilerType adds a const modifier to this type if
- // this type is valid and the type system supports const modifiers,
- // else return an invalid type.
- //----------------------------------------------------------------------
- CompilerType
- AddConstModifier () const;
-
- //----------------------------------------------------------------------
- // Return a new CompilerType adds a volatile modifier to this type if
- // this type is valid and the type system supports volatile modifiers,
- // else return an invalid type.
- //----------------------------------------------------------------------
- CompilerType
- AddVolatileModifier () const;
-
- //----------------------------------------------------------------------
- // Return a new CompilerType adds a restrict modifier to this type if
- // this type is valid and the type system supports restrict modifiers,
- // else return an invalid type.
- //----------------------------------------------------------------------
- CompilerType
- AddRestrictModifier () const;
-
- //----------------------------------------------------------------------
- // Create a typedef to this type using "name" as the name of the typedef
- // this type is valid and the type system supports typedefs, else return
- // an invalid type.
- //----------------------------------------------------------------------
- CompilerType
- CreateTypedef (const char *name, const CompilerDeclContext &decl_ctx) const;
-
- // If the current object represents a typedef type, get the underlying type
- CompilerType
- GetTypedefedType () const;
-
- //----------------------------------------------------------------------
- // Create related types using the current type's AST
- //----------------------------------------------------------------------
- CompilerType
- GetBasicTypeFromAST (lldb::BasicType basic_type) const;
-
- //----------------------------------------------------------------------
- // Exploring the type
- //----------------------------------------------------------------------
-
- uint64_t
- GetByteSize (ExecutionContextScope *exe_scope) const;
-
- uint64_t
- GetBitSize (ExecutionContextScope *exe_scope) const;
-
- lldb::Encoding
- GetEncoding (uint64_t &count) const;
-
- lldb::Format
- GetFormat () const;
-
- size_t
- GetTypeBitAlign () const;
-
- uint32_t
- GetNumChildren (bool omit_empty_base_classes) const;
-
- lldb::BasicType
- GetBasicTypeEnumeration () const;
-
- static lldb::BasicType
- GetBasicTypeEnumeration (const ConstString &name);
-
- //----------------------------------------------------------------------
- // If this type is an enumeration, iterate through all of its enumerators
- // using a callback. If the callback returns true, keep iterating, else
- // abort the iteration.
- //----------------------------------------------------------------------
- void
- ForEachEnumerator (std::function <bool (const CompilerType &integer_type,
- const ConstString &name,
- const llvm::APSInt &value)> const &callback) const;
-
- uint32_t
- GetNumFields () const;
-
- CompilerType
- GetFieldAtIndex (size_t idx,
- std::string& name,
- uint64_t *bit_offset_ptr,
- uint32_t *bitfield_bit_size_ptr,
- bool *is_bitfield_ptr) const;
-
- uint32_t
- GetNumDirectBaseClasses () const;
-
- uint32_t
- GetNumVirtualBaseClasses () const;
-
- CompilerType
- GetDirectBaseClassAtIndex (size_t idx,
- uint32_t *bit_offset_ptr) const;
-
- CompilerType
- GetVirtualBaseClassAtIndex (size_t idx,
- uint32_t *bit_offset_ptr) const;
-
- uint32_t
- GetIndexOfFieldWithName(const char* name,
- CompilerType* field_compiler_type = nullptr,
- uint64_t *bit_offset_ptr = nullptr,
- uint32_t *bitfield_bit_size_ptr = nullptr,
- bool *is_bitfield_ptr = nullptr) const;
-
- CompilerType
- GetChildCompilerTypeAtIndex (ExecutionContext *exe_ctx,
- size_t idx,
- bool transparent_pointers,
- bool omit_empty_base_classes,
- bool ignore_array_bounds,
- std::string& child_name,
- uint32_t &child_byte_size,
- int32_t &child_byte_offset,
- uint32_t &child_bitfield_bit_size,
- uint32_t &child_bitfield_bit_offset,
- bool &child_is_base_class,
- bool &child_is_deref_of_parent,
- ValueObject *valobj,
- uint64_t &language_flags) const;
-
- // Lookup a child given a name. This function will match base class names
- // and member member names in "clang_type" only, not descendants.
- uint32_t
- GetIndexOfChildWithName (const char *name,
- bool omit_empty_base_classes) const;
-
- // Lookup a child member given a name. This function will match member names
- // only and will descend into "clang_type" children in search for the first
- // member in this class, or any base class that matches "name".
- // TODO: Return all matches for a given name by returning a vector<vector<uint32_t>>
- // so we catch all names that match a given child name, not just the first.
- size_t
- GetIndexOfChildMemberWithName (const char *name,
- bool omit_empty_base_classes,
- std::vector<uint32_t>& child_indexes) const;
-
- size_t
- GetNumTemplateArguments () const;
-
- CompilerType
- GetTemplateArgument (size_t idx,
- lldb::TemplateArgumentKind &kind) const;
-
- CompilerType
- GetTypeForFormatters () const;
-
- LazyBool
- ShouldPrintAsOneLiner (ValueObject* valobj) const;
-
- bool
- IsMeaninglessWithoutDynamicResolution () const;
-
- //------------------------------------------------------------------
- // Pointers & References
- //------------------------------------------------------------------
-
- // Converts "s" to a floating point value and place resulting floating
- // point bytes in the "dst" buffer.
- size_t
- ConvertStringToFloatValue (const char *s,
- uint8_t *dst,
- size_t dst_size) const;
-
- //----------------------------------------------------------------------
- // Dumping types
- //----------------------------------------------------------------------
- void
- DumpValue (ExecutionContext *exe_ctx,
- Stream *s,
- lldb::Format format,
- const DataExtractor &data,
- lldb::offset_t data_offset,
- size_t data_byte_size,
- uint32_t bitfield_bit_size,
- uint32_t bitfield_bit_offset,
- bool show_types,
- bool show_summary,
- bool verbose,
- uint32_t depth);
-
- bool
- DumpTypeValue (Stream *s,
- lldb::Format format,
- const DataExtractor &data,
- lldb::offset_t data_offset,
- size_t data_byte_size,
- uint32_t bitfield_bit_size,
- uint32_t bitfield_bit_offset,
- ExecutionContextScope *exe_scope);
-
- void
- DumpSummary (ExecutionContext *exe_ctx,
- Stream *s,
- const DataExtractor &data,
- lldb::offset_t data_offset,
- size_t data_byte_size);
-
- void
- DumpTypeDescription () const; // Dump to stdout
-
- void
- DumpTypeDescription (Stream *s) const;
-
- bool
- GetValueAsScalar (const DataExtractor &data,
- lldb::offset_t data_offset,
- size_t data_byte_size,
- Scalar &value) const;
-
- bool
- SetValueFromScalar (const Scalar &value,
- Stream &strm);
-
- bool
- ReadFromMemory (ExecutionContext *exe_ctx,
- lldb::addr_t addr,
- AddressType address_type,
- DataExtractor &data);
-
- bool
- WriteToMemory (ExecutionContext *exe_ctx,
- lldb::addr_t addr,
- AddressType address_type,
- StreamString &new_value);
-
- void
- Clear()
- {
- m_type = nullptr;
- m_type_system = nullptr;
- }
+ //----------------------------------------------------------------------
+ // Constructors and Destructors
+ //----------------------------------------------------------------------
+ CompilerType(TypeSystem *type_system, lldb::opaque_compiler_type_t type);
+ CompilerType(clang::ASTContext *ast_context, clang::QualType qual_type);
+
+ CompilerType(const CompilerType &rhs)
+ : m_type(rhs.m_type), m_type_system(rhs.m_type_system) {}
+
+ CompilerType() : m_type(nullptr), m_type_system(nullptr) {}
+
+ ~CompilerType();
+
+ //----------------------------------------------------------------------
+ // Operators
+ //----------------------------------------------------------------------
+
+ const CompilerType &operator=(const CompilerType &rhs) {
+ m_type = rhs.m_type;
+ m_type_system = rhs.m_type_system;
+ return *this;
+ }
+
+ //----------------------------------------------------------------------
+ // Tests
+ //----------------------------------------------------------------------
+
+ explicit operator bool() const {
+ return m_type != nullptr && m_type_system != nullptr;
+ }
+
+ bool operator<(const CompilerType &rhs) const {
+ if (m_type_system == rhs.m_type_system)
+ return m_type < rhs.m_type;
+ return m_type_system < rhs.m_type_system;
+ }
+
+ bool IsValid() const { return m_type != nullptr && m_type_system != nullptr; }
+
+ bool IsArrayType(CompilerType *element_type, uint64_t *size,
+ bool *is_incomplete) const;
+
+ bool IsVectorType(CompilerType *element_type, uint64_t *size) const;
+
+ bool IsArrayOfScalarType() const;
+
+ bool IsAggregateType() const;
+
+ bool IsAnonymousType() const;
+
+ bool IsBeingDefined() const;
+
+ bool IsCharType() const;
+
+ bool IsCompleteType() const;
+
+ bool IsConst() const;
+
+ bool IsCStringType(uint32_t &length) const;
+
+ bool IsDefined() const;
+
+ bool IsFloatingPointType(uint32_t &count, bool &is_complex) const;
+
+ bool IsFunctionType(bool *is_variadic_ptr = nullptr) const;
+
+ uint32_t IsHomogeneousAggregate(CompilerType *base_type_ptr) const;
+
+ size_t GetNumberOfFunctionArguments() const;
+
+ CompilerType GetFunctionArgumentAtIndex(const size_t index) const;
+
+ bool IsVariadicFunctionType() const;
+
+ bool IsFunctionPointerType() const;
+
+ bool IsBlockPointerType(CompilerType *function_pointer_type_ptr) const;
+
+ bool IsIntegerType(bool &is_signed) const;
+
+ bool IsEnumerationType(bool &is_signed) const;
+
+ bool IsIntegerOrEnumerationType(bool &is_signed) const;
+
+ bool IsPolymorphicClass() const;
+
+ bool
+ IsPossibleCPlusPlusDynamicType(CompilerType *target_type = nullptr) const {
+ return IsPossibleDynamicType(target_type, true, false);
+ }
+
+ bool IsPossibleDynamicType(CompilerType *target_type, // Can pass nullptr
+ bool check_cplusplus, bool check_objc) const;
+
+ bool IsPointerToScalarType() const;
+
+ bool IsRuntimeGeneratedType() const;
+
+ bool IsPointerType(CompilerType *pointee_type = nullptr) const;
+
+ bool IsPointerOrReferenceType(CompilerType *pointee_type = nullptr) const;
+
+ bool IsReferenceType(CompilerType *pointee_type = nullptr,
+ bool *is_rvalue = nullptr) const;
+
+ bool ShouldTreatScalarValueAsAddress() const;
+
+ bool IsScalarType() const;
+
+ bool IsTypedefType() const;
+
+ bool IsVoidType() const;
+
+ //----------------------------------------------------------------------
+ // Type Completion
+ //----------------------------------------------------------------------
+
+ bool GetCompleteType() const;
+
+ //----------------------------------------------------------------------
+ // AST related queries
+ //----------------------------------------------------------------------
+
+ size_t GetPointerByteSize() const;
+
+ //----------------------------------------------------------------------
+ // Accessors
+ //----------------------------------------------------------------------
+
+ TypeSystem *GetTypeSystem() const { return m_type_system; }
+
+ ConstString GetConstQualifiedTypeName() const;
+
+ ConstString GetConstTypeName() const;
+
+ ConstString GetTypeName() const;
+
+ ConstString GetDisplayTypeName() const;
+
+ uint32_t
+ GetTypeInfo(CompilerType *pointee_or_element_compiler_type = nullptr) const;
+
+ lldb::LanguageType GetMinimumLanguage();
+
+ lldb::opaque_compiler_type_t GetOpaqueQualType() const { return m_type; }
+
+ lldb::TypeClass GetTypeClass() const;
+
+ void SetCompilerType(TypeSystem *type_system,
+ lldb::opaque_compiler_type_t type);
+
+ void SetCompilerType(clang::ASTContext *ast, clang::QualType qual_type);
+
+ unsigned GetTypeQualifiers() const;
+
+ //----------------------------------------------------------------------
+ // Creating related types
+ //----------------------------------------------------------------------
+
+ CompilerType GetArrayElementType(uint64_t *stride = nullptr) const;
+
+ CompilerType GetArrayType(uint64_t size) const;
+
+ CompilerType GetCanonicalType() const;
+
+ CompilerType GetFullyUnqualifiedType() const;
+
+ // Returns -1 if this isn't a function of if the function doesn't have a
+ // prototype
+ // Returns a value >= 0 if there is a prototype.
+ int GetFunctionArgumentCount() const;
+
+ CompilerType GetFunctionArgumentTypeAtIndex(size_t idx) const;
+
+ CompilerType GetFunctionReturnType() const;
+
+ size_t GetNumMemberFunctions() const;
+
+ TypeMemberFunctionImpl GetMemberFunctionAtIndex(size_t idx);
+
+ //----------------------------------------------------------------------
+ // If this type is a reference to a type (L value or R value reference),
+ // return a new type with the reference removed, else return the current
+ // type itself.
+ //----------------------------------------------------------------------
+ CompilerType GetNonReferenceType() const;
+
+ //----------------------------------------------------------------------
+ // If this type is a pointer type, return the type that the pointer
+ // points to, else return an invalid type.
+ //----------------------------------------------------------------------
+ CompilerType GetPointeeType() const;
+
+ //----------------------------------------------------------------------
+ // Return a new CompilerType that is a pointer to this type
+ //----------------------------------------------------------------------
+ CompilerType GetPointerType() const;
+
+ //----------------------------------------------------------------------
+ // Return a new CompilerType that is a L value reference to this type if
+ // this type is valid and the type system supports L value references,
+ // else return an invalid type.
+ //----------------------------------------------------------------------
+ CompilerType GetLValueReferenceType() const;
+
+ //----------------------------------------------------------------------
+ // Return a new CompilerType that is a R value reference to this type if
+ // this type is valid and the type system supports R value references,
+ // else return an invalid type.
+ //----------------------------------------------------------------------
+ CompilerType GetRValueReferenceType() const;
+
+ //----------------------------------------------------------------------
+ // Return a new CompilerType adds a const modifier to this type if
+ // this type is valid and the type system supports const modifiers,
+ // else return an invalid type.
+ //----------------------------------------------------------------------
+ CompilerType AddConstModifier() const;
+
+ //----------------------------------------------------------------------
+ // Return a new CompilerType adds a volatile modifier to this type if
+ // this type is valid and the type system supports volatile modifiers,
+ // else return an invalid type.
+ //----------------------------------------------------------------------
+ CompilerType AddVolatileModifier() const;
+
+ //----------------------------------------------------------------------
+ // Return a new CompilerType adds a restrict modifier to this type if
+ // this type is valid and the type system supports restrict modifiers,
+ // else return an invalid type.
+ //----------------------------------------------------------------------
+ CompilerType AddRestrictModifier() const;
+
+ //----------------------------------------------------------------------
+ // Create a typedef to this type using "name" as the name of the typedef
+ // this type is valid and the type system supports typedefs, else return
+ // an invalid type.
+ //----------------------------------------------------------------------
+ CompilerType CreateTypedef(const char *name,
+ const CompilerDeclContext &decl_ctx) const;
+
+ // If the current object represents a typedef type, get the underlying type
+ CompilerType GetTypedefedType() const;
+
+ //----------------------------------------------------------------------
+ // Create related types using the current type's AST
+ //----------------------------------------------------------------------
+ CompilerType GetBasicTypeFromAST(lldb::BasicType basic_type) const;
+
+ //----------------------------------------------------------------------
+ // Exploring the type
+ //----------------------------------------------------------------------
+
+ uint64_t GetByteSize(ExecutionContextScope *exe_scope) const;
+
+ uint64_t GetBitSize(ExecutionContextScope *exe_scope) const;
+
+ lldb::Encoding GetEncoding(uint64_t &count) const;
+
+ lldb::Format GetFormat() const;
+
+ size_t GetTypeBitAlign() const;
+
+ uint32_t GetNumChildren(bool omit_empty_base_classes) const;
+
+ lldb::BasicType GetBasicTypeEnumeration() const;
+
+ static lldb::BasicType GetBasicTypeEnumeration(const ConstString &name);
+
+ //----------------------------------------------------------------------
+ // If this type is an enumeration, iterate through all of its enumerators
+ // using a callback. If the callback returns true, keep iterating, else
+ // abort the iteration.
+ //----------------------------------------------------------------------
+ void ForEachEnumerator(
+ std::function<bool(const CompilerType &integer_type,
+ const ConstString &name,
+ const llvm::APSInt &value)> const &callback) const;
+
+ uint32_t GetNumFields() const;
+
+ CompilerType GetFieldAtIndex(size_t idx, std::string &name,
+ uint64_t *bit_offset_ptr,
+ uint32_t *bitfield_bit_size_ptr,
+ bool *is_bitfield_ptr) const;
+
+ uint32_t GetNumDirectBaseClasses() const;
+
+ uint32_t GetNumVirtualBaseClasses() const;
+
+ CompilerType GetDirectBaseClassAtIndex(size_t idx,
+ uint32_t *bit_offset_ptr) const;
+
+ CompilerType GetVirtualBaseClassAtIndex(size_t idx,
+ uint32_t *bit_offset_ptr) const;
+
+ uint32_t GetIndexOfFieldWithName(const char *name,
+ CompilerType *field_compiler_type = nullptr,
+ uint64_t *bit_offset_ptr = nullptr,
+ uint32_t *bitfield_bit_size_ptr = nullptr,
+ bool *is_bitfield_ptr = nullptr) const;
+
+ CompilerType GetChildCompilerTypeAtIndex(
+ ExecutionContext *exe_ctx, size_t idx, bool transparent_pointers,
+ bool omit_empty_base_classes, bool ignore_array_bounds,
+ std::string &child_name, uint32_t &child_byte_size,
+ int32_t &child_byte_offset, uint32_t &child_bitfield_bit_size,
+ uint32_t &child_bitfield_bit_offset, bool &child_is_base_class,
+ bool &child_is_deref_of_parent, ValueObject *valobj,
+ uint64_t &language_flags) const;
+
+ // Lookup a child given a name. This function will match base class names
+ // and member member names in "clang_type" only, not descendants.
+ uint32_t GetIndexOfChildWithName(const char *name,
+ bool omit_empty_base_classes) const;
+
+ // Lookup a child member given a name. This function will match member names
+ // only and will descend into "clang_type" children in search for the first
+ // member in this class, or any base class that matches "name".
+ // TODO: Return all matches for a given name by returning a
+ // vector<vector<uint32_t>>
+ // so we catch all names that match a given child name, not just the first.
+ size_t
+ GetIndexOfChildMemberWithName(const char *name, bool omit_empty_base_classes,
+ std::vector<uint32_t> &child_indexes) const;
+
+ size_t GetNumTemplateArguments() const;
+
+ CompilerType GetTemplateArgument(size_t idx,
+ lldb::TemplateArgumentKind &kind) const;
+
+ CompilerType GetTypeForFormatters() const;
+
+ LazyBool ShouldPrintAsOneLiner(ValueObject *valobj) const;
+
+ bool IsMeaninglessWithoutDynamicResolution() const;
+
+ //------------------------------------------------------------------
+ // Pointers & References
+ //------------------------------------------------------------------
+
+ // Converts "s" to a floating point value and place resulting floating
+ // point bytes in the "dst" buffer.
+ size_t ConvertStringToFloatValue(const char *s, uint8_t *dst,
+ size_t dst_size) const;
+
+ //----------------------------------------------------------------------
+ // Dumping types
+ //----------------------------------------------------------------------
+ void DumpValue(ExecutionContext *exe_ctx, Stream *s, lldb::Format format,
+ const DataExtractor &data, lldb::offset_t data_offset,
+ size_t data_byte_size, uint32_t bitfield_bit_size,
+ uint32_t bitfield_bit_offset, bool show_types,
+ bool show_summary, bool verbose, uint32_t depth);
+
+ bool DumpTypeValue(Stream *s, lldb::Format format, const DataExtractor &data,
+ lldb::offset_t data_offset, size_t data_byte_size,
+ uint32_t bitfield_bit_size, uint32_t bitfield_bit_offset,
+ ExecutionContextScope *exe_scope);
+
+ void DumpSummary(ExecutionContext *exe_ctx, Stream *s,
+ const DataExtractor &data, lldb::offset_t data_offset,
+ size_t data_byte_size);
+
+ void DumpTypeDescription() const; // Dump to stdout
+
+ void DumpTypeDescription(Stream *s) const;
+
+ bool GetValueAsScalar(const DataExtractor &data, lldb::offset_t data_offset,
+ size_t data_byte_size, Scalar &value) const;
+
+ bool SetValueFromScalar(const Scalar &value, Stream &strm);
+
+ bool ReadFromMemory(ExecutionContext *exe_ctx, lldb::addr_t addr,
+ AddressType address_type, DataExtractor &data);
+
+ bool WriteToMemory(ExecutionContext *exe_ctx, lldb::addr_t addr,
+ AddressType address_type, StreamString &new_value);
+
+ void Clear() {
+ m_type = nullptr;
+ m_type_system = nullptr;
+ }
private:
- lldb::opaque_compiler_type_t m_type;
- TypeSystem *m_type_system;
+ lldb::opaque_compiler_type_t m_type;
+ TypeSystem *m_type_system;
};
-
-bool operator == (const CompilerType &lhs, const CompilerType &rhs);
-bool operator != (const CompilerType &lhs, const CompilerType &rhs);
+
+bool operator==(const CompilerType &lhs, const CompilerType &rhs);
+bool operator!=(const CompilerType &lhs, const CompilerType &rhs);
} // namespace lldb_private
Modified: lldb/trunk/include/lldb/Symbol/DWARFCallFrameInfo.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Symbol/DWARFCallFrameInfo.h?rev=280751&r1=280750&r2=280751&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Symbol/DWARFCallFrameInfo.h (original)
+++ lldb/trunk/include/lldb/Symbol/DWARFCallFrameInfo.h Tue Sep 6 15:57:50 2016
@@ -32,138 +32,125 @@ namespace lldb_private {
// eh_frame / debug_frame, and one to generate an UnwindPlan based
// on the FDE in the eh_frame / debug_frame section.
-class DWARFCallFrameInfo
-{
+class DWARFCallFrameInfo {
public:
+ DWARFCallFrameInfo(ObjectFile &objfile, lldb::SectionSP §ion,
+ lldb::RegisterKind reg_kind, bool is_eh_frame);
- DWARFCallFrameInfo (ObjectFile& objfile,
- lldb::SectionSP& section,
- lldb::RegisterKind reg_kind,
- bool is_eh_frame);
-
- ~DWARFCallFrameInfo();
-
- // Locate an AddressRange that includes the provided Address in this
- // object's eh_frame/debug_info
- // Returns true if a range is found to cover that address.
- bool
- GetAddressRange (Address addr, AddressRange &range);
-
- // Return an UnwindPlan based on the call frame information encoded
- // in the FDE of this DWARFCallFrameInfo section.
- bool
- GetUnwindPlan (Address addr, UnwindPlan& unwind_plan);
-
- typedef RangeVector<lldb::addr_t, uint32_t> FunctionAddressAndSizeVector;
-
- //------------------------------------------------------------------
- // Build a vector of file address and size for all functions in this Module
- // based on the eh_frame FDE entries.
- //
- // The eh_frame information can be a useful source of file address and size of
- // the functions in a Module. Often a binary's non-exported symbols are stripped
- // before shipping so lldb won't know the start addr / size of many functions
- // in the Module. But the eh_frame can help to give the addresses of these
- // stripped symbols, at least.
- //
- // @param[out] function_info
- // A vector provided by the caller is filled out. May be empty if no FDEs/no eh_frame
- // is present in this Module.
+ ~DWARFCallFrameInfo();
- void
- GetFunctionAddressAndSizeVector (FunctionAddressAndSizeVector &function_info);
+ // Locate an AddressRange that includes the provided Address in this
+ // object's eh_frame/debug_info
+ // Returns true if a range is found to cover that address.
+ bool GetAddressRange(Address addr, AddressRange &range);
+
+ // Return an UnwindPlan based on the call frame information encoded
+ // in the FDE of this DWARFCallFrameInfo section.
+ bool GetUnwindPlan(Address addr, UnwindPlan &unwind_plan);
+
+ typedef RangeVector<lldb::addr_t, uint32_t> FunctionAddressAndSizeVector;
+
+ //------------------------------------------------------------------
+ // Build a vector of file address and size for all functions in this Module
+ // based on the eh_frame FDE entries.
+ //
+ // The eh_frame information can be a useful source of file address and size of
+ // the functions in a Module. Often a binary's non-exported symbols are
+ // stripped
+ // before shipping so lldb won't know the start addr / size of many functions
+ // in the Module. But the eh_frame can help to give the addresses of these
+ // stripped symbols, at least.
+ //
+ // @param[out] function_info
+ // A vector provided by the caller is filled out. May be empty if no
+ // FDEs/no eh_frame
+ // is present in this Module.
- void
- ForEachFDEEntries(const std::function<bool(lldb::addr_t, uint32_t, dw_offset_t)>& callback);
+ void
+ GetFunctionAddressAndSizeVector(FunctionAddressAndSizeVector &function_info);
+
+ void ForEachFDEEntries(
+ const std::function<bool(lldb::addr_t, uint32_t, dw_offset_t)> &callback);
private:
- enum
- {
- CFI_AUG_MAX_SIZE = 8,
- CFI_HEADER_SIZE = 8
- };
-
- struct CIE
- {
- dw_offset_t cie_offset;
- uint8_t version;
- char augmentation[CFI_AUG_MAX_SIZE]; // This is typically empty or very short.
- uint32_t code_align;
- int32_t data_align;
- uint32_t return_addr_reg_num;
- dw_offset_t inst_offset; // offset of CIE instructions in mCFIData
- uint32_t inst_length; // length of CIE instructions in mCFIData
- uint8_t ptr_encoding;
- uint8_t lsda_addr_encoding; // The encoding of the LSDA address in the FDE augmentation data
- lldb::addr_t personality_loc; // (file) address of the pointer to the personality routine
- lldb_private::UnwindPlan::Row initial_row;
-
- CIE(dw_offset_t offset) : cie_offset(offset), version (-1), code_align (0),
- data_align (0), return_addr_reg_num (LLDB_INVALID_REGNUM), inst_offset (0),
- inst_length (0), ptr_encoding (0),
- lsda_addr_encoding (DW_EH_PE_omit), personality_loc (LLDB_INVALID_ADDRESS),
- initial_row ()
- {
- }
- };
-
- typedef std::shared_ptr<CIE> CIESP;
-
- typedef std::map<dw_offset_t, CIESP> cie_map_t;
-
- // Start address (file address), size, offset of FDE location
- // used for finding an FDE for a given File address; the start address field is
- // an offset into an individual Module.
- typedef RangeDataVector<lldb::addr_t, uint32_t, dw_offset_t> FDEEntryMap;
-
- bool
- IsEHFrame() const;
-
- bool
- GetFDEEntryByFileAddress (lldb::addr_t file_offset, FDEEntryMap::Entry& fde_entry);
-
- void
- GetFDEIndex ();
-
- bool
- FDEToUnwindPlan (uint32_t offset, Address startaddr, UnwindPlan& unwind_plan);
-
- const CIE*
- GetCIE(dw_offset_t cie_offset);
-
- void
- GetCFIData();
-
- // Applies the specified DWARF opcode to the given row. This function handle the commands
- // operates only on a single row (these are the ones what can appear both in CIE and in FDE).
- // Returns true if the opcode is handled and false otherwise.
- bool
- HandleCommonDwarfOpcode(uint8_t primary_opcode,
- uint8_t extended_opcode,
- int32_t data_align,
- lldb::offset_t& offset,
- UnwindPlan::Row& row);
-
- ObjectFile& m_objfile;
- lldb::SectionSP m_section_sp;
- lldb::RegisterKind m_reg_kind;
- Flags m_flags;
- cie_map_t m_cie_map;
-
- DataExtractor m_cfi_data;
- bool m_cfi_data_initialized; // only copy the section into the DE once
-
- FDEEntryMap m_fde_index;
- bool m_fde_index_initialized; // only scan the section for FDEs once
- std::mutex m_fde_index_mutex; // and isolate the thread that does it
+ enum { CFI_AUG_MAX_SIZE = 8, CFI_HEADER_SIZE = 8 };
- bool m_is_eh_frame;
+ struct CIE {
+ dw_offset_t cie_offset;
+ uint8_t version;
+ char augmentation[CFI_AUG_MAX_SIZE]; // This is typically empty or very
+ // short.
+ uint32_t code_align;
+ int32_t data_align;
+ uint32_t return_addr_reg_num;
+ dw_offset_t inst_offset; // offset of CIE instructions in mCFIData
+ uint32_t inst_length; // length of CIE instructions in mCFIData
+ uint8_t ptr_encoding;
+ uint8_t lsda_addr_encoding; // The encoding of the LSDA address in the FDE
+ // augmentation data
+ lldb::addr_t personality_loc; // (file) address of the pointer to the
+ // personality routine
+ lldb_private::UnwindPlan::Row initial_row;
+
+ CIE(dw_offset_t offset)
+ : cie_offset(offset), version(-1), code_align(0), data_align(0),
+ return_addr_reg_num(LLDB_INVALID_REGNUM), inst_offset(0),
+ inst_length(0), ptr_encoding(0), lsda_addr_encoding(DW_EH_PE_omit),
+ personality_loc(LLDB_INVALID_ADDRESS), initial_row() {}
+ };
+
+ typedef std::shared_ptr<CIE> CIESP;
+
+ typedef std::map<dw_offset_t, CIESP> cie_map_t;
+
+ // Start address (file address), size, offset of FDE location
+ // used for finding an FDE for a given File address; the start address field
+ // is
+ // an offset into an individual Module.
+ typedef RangeDataVector<lldb::addr_t, uint32_t, dw_offset_t> FDEEntryMap;
+
+ bool IsEHFrame() const;
+
+ bool GetFDEEntryByFileAddress(lldb::addr_t file_offset,
+ FDEEntryMap::Entry &fde_entry);
+
+ void GetFDEIndex();
+
+ bool FDEToUnwindPlan(uint32_t offset, Address startaddr,
+ UnwindPlan &unwind_plan);
+
+ const CIE *GetCIE(dw_offset_t cie_offset);
+
+ void GetCFIData();
+
+ // Applies the specified DWARF opcode to the given row. This function handle
+ // the commands
+ // operates only on a single row (these are the ones what can appear both in
+ // CIE and in FDE).
+ // Returns true if the opcode is handled and false otherwise.
+ bool HandleCommonDwarfOpcode(uint8_t primary_opcode, uint8_t extended_opcode,
+ int32_t data_align, lldb::offset_t &offset,
+ UnwindPlan::Row &row);
+
+ ObjectFile &m_objfile;
+ lldb::SectionSP m_section_sp;
+ lldb::RegisterKind m_reg_kind;
+ Flags m_flags;
+ cie_map_t m_cie_map;
+
+ DataExtractor m_cfi_data;
+ bool m_cfi_data_initialized; // only copy the section into the DE once
+
+ FDEEntryMap m_fde_index;
+ bool m_fde_index_initialized; // only scan the section for FDEs once
+ std::mutex m_fde_index_mutex; // and isolate the thread that does it
- CIESP
- ParseCIE (const uint32_t cie_offset);
+ bool m_is_eh_frame;
+ CIESP
+ ParseCIE(const uint32_t cie_offset);
};
} // namespace lldb_private
-#endif // liblldb_DWARFCallFrameInfo_h_
+#endif // liblldb_DWARFCallFrameInfo_h_
Modified: lldb/trunk/include/lldb/Symbol/DebugMacros.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Symbol/DebugMacros.h?rev=280751&r1=280750&r2=280751&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Symbol/DebugMacros.h (original)
+++ lldb/trunk/include/lldb/Symbol/DebugMacros.h Tue Sep 6 15:57:50 2016
@@ -17,8 +17,8 @@
// Other libraries and framework includes
// Project includes
-#include "lldb/lldb-private.h"
#include "lldb/Core/ConstString.h"
+#include "lldb/lldb-private.h"
namespace lldb_private {
@@ -26,113 +26,75 @@ class CompileUnit;
class DebugMacros;
typedef std::shared_ptr<DebugMacros> DebugMacrosSP;
-class DebugMacroEntry
-{
+class DebugMacroEntry {
public:
- enum EntryType
- {
- INVALID,
- DEFINE,
- UNDEF,
- START_FILE,
- END_FILE,
- INDIRECT
- };
+ enum EntryType { INVALID, DEFINE, UNDEF, START_FILE, END_FILE, INDIRECT };
public:
- static DebugMacroEntry
- CreateDefineEntry(uint32_t line, const char *str);
+ static DebugMacroEntry CreateDefineEntry(uint32_t line, const char *str);
+
+ static DebugMacroEntry CreateUndefEntry(uint32_t line, const char *str);
+
+ static DebugMacroEntry CreateStartFileEntry(uint32_t line,
+ uint32_t debug_line_file_idx);
+
+ static DebugMacroEntry CreateEndFileEntry();
+
+ static DebugMacroEntry
+ CreateIndirectEntry(const DebugMacrosSP &debug_macros_sp);
- static DebugMacroEntry
- CreateUndefEntry(uint32_t line, const char *str);
+ DebugMacroEntry() : m_type(INVALID) {}
- static DebugMacroEntry
- CreateStartFileEntry(uint32_t line, uint32_t debug_line_file_idx);
+ ~DebugMacroEntry() = default;
- static DebugMacroEntry
- CreateEndFileEntry();
-
- static DebugMacroEntry
- CreateIndirectEntry(const DebugMacrosSP &debug_macros_sp);
-
- DebugMacroEntry() : m_type(INVALID) { }
-
- ~DebugMacroEntry() = default;
-
- EntryType
- GetType() const
- {
- return m_type;
- }
-
- uint64_t
- GetLineNumber() const
- {
- return m_line;
- }
-
- ConstString
- GetMacroString() const
- {
- return m_str;
- }
-
- const FileSpec& GetFileSpec(CompileUnit *comp_unit) const;
-
- DebugMacros *
- GetIndirectDebugMacros() const
- {
- return m_debug_macros_sp.get();
- }
+ EntryType GetType() const { return m_type; }
+
+ uint64_t GetLineNumber() const { return m_line; }
+
+ ConstString GetMacroString() const { return m_str; }
+
+ const FileSpec &GetFileSpec(CompileUnit *comp_unit) const;
+
+ DebugMacros *GetIndirectDebugMacros() const {
+ return m_debug_macros_sp.get();
+ }
private:
- DebugMacroEntry(EntryType type,
- uint32_t line,
- uint32_t debug_line_file_idx,
- const char *str);
-
- DebugMacroEntry(EntryType type,
- const DebugMacrosSP &debug_macros_sp);
-
- EntryType m_type:3;
- uint32_t m_line:29;
- uint32_t m_debug_line_file_idx;
- ConstString m_str;
- DebugMacrosSP m_debug_macros_sp;
+ DebugMacroEntry(EntryType type, uint32_t line, uint32_t debug_line_file_idx,
+ const char *str);
+
+ DebugMacroEntry(EntryType type, const DebugMacrosSP &debug_macros_sp);
+
+ EntryType m_type : 3;
+ uint32_t m_line : 29;
+ uint32_t m_debug_line_file_idx;
+ ConstString m_str;
+ DebugMacrosSP m_debug_macros_sp;
};
-class DebugMacros
-{
+class DebugMacros {
public:
- DebugMacros() = default;
+ DebugMacros() = default;
- ~DebugMacros() = default;
+ ~DebugMacros() = default;
- void
- AddMacroEntry(const DebugMacroEntry &entry)
- {
- m_macro_entries.push_back(entry);
- }
-
- size_t
- GetNumMacroEntries() const
- {
- return m_macro_entries.size();
- }
-
- DebugMacroEntry
- GetMacroEntryAtIndex(const size_t index) const
- {
- if (index < m_macro_entries.size())
- return m_macro_entries[index];
- else
- return DebugMacroEntry();
- }
+ void AddMacroEntry(const DebugMacroEntry &entry) {
+ m_macro_entries.push_back(entry);
+ }
+
+ size_t GetNumMacroEntries() const { return m_macro_entries.size(); }
+
+ DebugMacroEntry GetMacroEntryAtIndex(const size_t index) const {
+ if (index < m_macro_entries.size())
+ return m_macro_entries[index];
+ else
+ return DebugMacroEntry();
+ }
private:
- DISALLOW_COPY_AND_ASSIGN(DebugMacros);
+ DISALLOW_COPY_AND_ASSIGN(DebugMacros);
- std::vector<DebugMacroEntry> m_macro_entries;
+ std::vector<DebugMacroEntry> m_macro_entries;
};
} // namespace lldb_private
Modified: lldb/trunk/include/lldb/Symbol/DeclVendor.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Symbol/DeclVendor.h?rev=280751&r1=280750&r2=280751&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Symbol/DeclVendor.h (original)
+++ lldb/trunk/include/lldb/Symbol/DeclVendor.h Tue Sep 6 15:57:50 2016
@@ -15,59 +15,50 @@
#include <vector>
namespace lldb_private {
-
+
//----------------------------------------------------------------------
// The Decl vendor class is intended as a generic interface to search
// for named declarations that are not necessarily backed by a specific
// symbol file.
//----------------------------------------------------------------------
-class DeclVendor
-{
+class DeclVendor {
public:
- //------------------------------------------------------------------
- // Constructors and Destructors
- //------------------------------------------------------------------
- DeclVendor()
- {
- }
-
- virtual
- ~DeclVendor()
- {
- }
-
- //------------------------------------------------------------------
- /// Look up the set of Decls that the DeclVendor currently knows about
- /// matching a given name.
- ///
- /// @param[in] name
- /// The name to look for.
- ///
- /// @param[in] append
- /// If true, FindDecls will clear "decls" when it starts.
- ///
- /// @param[in] max_matches
- /// The maximum number of Decls to return. UINT32_MAX means "as
- /// many as possible."
- ///
- /// @return
- /// The number of Decls added to decls; will not exceed
- /// max_matches.
- //------------------------------------------------------------------
- virtual uint32_t
- FindDecls (const ConstString &name,
- bool append,
- uint32_t max_matches,
- std::vector <clang::NamedDecl*> &decls) = 0;
-
+ //------------------------------------------------------------------
+ // Constructors and Destructors
+ //------------------------------------------------------------------
+ DeclVendor() {}
+
+ virtual ~DeclVendor() {}
+
+ //------------------------------------------------------------------
+ /// Look up the set of Decls that the DeclVendor currently knows about
+ /// matching a given name.
+ ///
+ /// @param[in] name
+ /// The name to look for.
+ ///
+ /// @param[in] append
+ /// If true, FindDecls will clear "decls" when it starts.
+ ///
+ /// @param[in] max_matches
+ /// The maximum number of Decls to return. UINT32_MAX means "as
+ /// many as possible."
+ ///
+ /// @return
+ /// The number of Decls added to decls; will not exceed
+ /// max_matches.
+ //------------------------------------------------------------------
+ virtual uint32_t FindDecls(const ConstString &name, bool append,
+ uint32_t max_matches,
+ std::vector<clang::NamedDecl *> &decls) = 0;
+
private:
- //------------------------------------------------------------------
- // For DeclVendor only
- //------------------------------------------------------------------
- DISALLOW_COPY_AND_ASSIGN (DeclVendor);
+ //------------------------------------------------------------------
+ // For DeclVendor only
+ //------------------------------------------------------------------
+ DISALLOW_COPY_AND_ASSIGN(DeclVendor);
};
-
-
+
} // namespace lldb_private
#endif
Modified: lldb/trunk/include/lldb/Symbol/Declaration.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Symbol/Declaration.h?rev=280751&r1=280750&r2=280751&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Symbol/Declaration.h (original)
+++ lldb/trunk/include/lldb/Symbol/Declaration.h Tue Sep 6 15:57:50 2016
@@ -10,8 +10,8 @@
#ifndef liblldb_Declaration_h_
#define liblldb_Declaration_h_
-#include "lldb/lldb-private.h"
#include "lldb/Host/FileSpec.h"
+#include "lldb/lldb-private.h"
namespace lldb_private {
@@ -25,254 +25,216 @@ namespace lldb_private {
/// functions, types, variables, any many other debug core objects were
/// declared.
//----------------------------------------------------------------------
-class Declaration
-{
+class Declaration {
public:
- //------------------------------------------------------------------
- /// Default constructor.
- //------------------------------------------------------------------
- Declaration () :
- m_file (),
- m_line (0)
-#ifdef LLDB_ENABLE_DECLARATION_COLUMNS
- ,m_column (0)
-#endif
- {
- }
-
-
- //------------------------------------------------------------------
- /// Construct with file specification, and optional line and column.
- ///
- /// @param[in] file_spec
- /// The file specification that describes where this was
- /// declared.
- ///
- /// @param[in] line
- /// The line number that describes where this was declared. Set
- /// to zero if there is no line number information.
- ///
- /// @param[in] column
- /// The column number that describes where this was declared.
- /// Set to zero if there is no column number information.
- //------------------------------------------------------------------
- Declaration (const FileSpec& file_spec, uint32_t line = 0, uint32_t column = 0) :
- m_file (file_spec),
- m_line (line)
-#ifdef LLDB_ENABLE_DECLARATION_COLUMNS
- ,m_column (column)
-#endif
- {
- }
-
- //------------------------------------------------------------------
- /// Construct with a reference to another Declaration object.
- //------------------------------------------------------------------
- Declaration (const Declaration& rhs) :
- m_file (rhs.m_file),
- m_line (rhs.m_line)
-#ifdef LLDB_ENABLE_DECLARATION_COLUMNS
- ,m_column (rhs.m_column)
-#endif
- {
-
- }
-
- //------------------------------------------------------------------
- /// Construct with a pointer to another Declaration object.
- //------------------------------------------------------------------
- Declaration(const Declaration* decl_ptr) :
- m_file(),
- m_line(0)
-#ifdef LLDB_ENABLE_DECLARATION_COLUMNS
- ,m_column(0)
-#endif
- {
- if (decl_ptr)
- *this = *decl_ptr;
- }
-
- //------------------------------------------------------------------
- /// Clear the object's state.
- ///
- /// Sets the file specification to be empty, and the line and column
- /// to zero.
- //------------------------------------------------------------------
- void
- Clear ()
- {
- m_file.Clear();
- m_line= 0;
-#ifdef LLDB_ENABLE_DECLARATION_COLUMNS
- m_column = 0;
-#endif
- }
-
- //------------------------------------------------------------------
- /// Compare two declaration objects.
- ///
- /// Compares the two file specifications from \a lhs and \a rhs. If
- /// the file specifications are equal, then continue to compare the
- /// line number and column numbers respectively.
- ///
- /// @param[in] lhs
- /// The Left Hand Side const Declaration object reference.
- ///
- /// @param[in] rhs
- /// The Right Hand Side const Declaration object reference.
- ///
- /// @return
- /// @li -1 if lhs < rhs
- /// @li 0 if lhs == rhs
- /// @li 1 if lhs > rhs
- //------------------------------------------------------------------
- static int
- Compare (const Declaration& lhs, const Declaration& rhs);
-
- //------------------------------------------------------------------
- /// Dump a description of this object to a Stream.
- ///
- /// Dump a description of the contents of this object to the
- /// supplied stream \a s.
- ///
- /// @param[in] s
- /// The stream to which to dump the object description.
- //------------------------------------------------------------------
- void
- Dump (Stream *s, bool show_fullpaths) const;
-
- bool
- DumpStopContext (Stream *s, bool show_fullpaths) const;
- //------------------------------------------------------------------
- /// Get accessor for the declaration column number.
- ///
- /// @return
- /// Non-zero indicates a valid column number, zero indicates no
- /// column information is available.
- //------------------------------------------------------------------
- uint32_t
- GetColumn () const
- {
+ //------------------------------------------------------------------
+ /// Default constructor.
+ //------------------------------------------------------------------
+ Declaration()
+ : m_file(), m_line(0)
+#ifdef LLDB_ENABLE_DECLARATION_COLUMNS
+ ,
+ m_column(0)
+#endif
+ {
+ }
+
+ //------------------------------------------------------------------
+ /// Construct with file specification, and optional line and column.
+ ///
+ /// @param[in] file_spec
+ /// The file specification that describes where this was
+ /// declared.
+ ///
+ /// @param[in] line
+ /// The line number that describes where this was declared. Set
+ /// to zero if there is no line number information.
+ ///
+ /// @param[in] column
+ /// The column number that describes where this was declared.
+ /// Set to zero if there is no column number information.
+ //------------------------------------------------------------------
+ Declaration(const FileSpec &file_spec, uint32_t line = 0, uint32_t column = 0)
+ : m_file(file_spec), m_line(line)
+#ifdef LLDB_ENABLE_DECLARATION_COLUMNS
+ ,
+ m_column(column)
+#endif
+ {
+ }
+
+ //------------------------------------------------------------------
+ /// Construct with a reference to another Declaration object.
+ //------------------------------------------------------------------
+ Declaration(const Declaration &rhs)
+ : m_file(rhs.m_file), m_line(rhs.m_line)
+#ifdef LLDB_ENABLE_DECLARATION_COLUMNS
+ ,
+ m_column(rhs.m_column)
+#endif
+ {
+ }
+
+ //------------------------------------------------------------------
+ /// Construct with a pointer to another Declaration object.
+ //------------------------------------------------------------------
+ Declaration(const Declaration *decl_ptr)
+ : m_file(), m_line(0)
+#ifdef LLDB_ENABLE_DECLARATION_COLUMNS
+ ,
+ m_column(0)
+#endif
+ {
+ if (decl_ptr)
+ *this = *decl_ptr;
+ }
+
+ //------------------------------------------------------------------
+ /// Clear the object's state.
+ ///
+ /// Sets the file specification to be empty, and the line and column
+ /// to zero.
+ //------------------------------------------------------------------
+ void Clear() {
+ m_file.Clear();
+ m_line = 0;
+#ifdef LLDB_ENABLE_DECLARATION_COLUMNS
+ m_column = 0;
+#endif
+ }
+
+ //------------------------------------------------------------------
+ /// Compare two declaration objects.
+ ///
+ /// Compares the two file specifications from \a lhs and \a rhs. If
+ /// the file specifications are equal, then continue to compare the
+ /// line number and column numbers respectively.
+ ///
+ /// @param[in] lhs
+ /// The Left Hand Side const Declaration object reference.
+ ///
+ /// @param[in] rhs
+ /// The Right Hand Side const Declaration object reference.
+ ///
+ /// @return
+ /// @li -1 if lhs < rhs
+ /// @li 0 if lhs == rhs
+ /// @li 1 if lhs > rhs
+ //------------------------------------------------------------------
+ static int Compare(const Declaration &lhs, const Declaration &rhs);
+
+ //------------------------------------------------------------------
+ /// Dump a description of this object to a Stream.
+ ///
+ /// Dump a description of the contents of this object to the
+ /// supplied stream \a s.
+ ///
+ /// @param[in] s
+ /// The stream to which to dump the object description.
+ //------------------------------------------------------------------
+ void Dump(Stream *s, bool show_fullpaths) const;
+
+ bool DumpStopContext(Stream *s, bool show_fullpaths) const;
+ //------------------------------------------------------------------
+ /// Get accessor for the declaration column number.
+ ///
+ /// @return
+ /// Non-zero indicates a valid column number, zero indicates no
+ /// column information is available.
+ //------------------------------------------------------------------
+ uint32_t GetColumn() const {
#ifdef LLDB_ENABLE_DECLARATION_COLUMNS
- return m_column;
+ return m_column;
#else
- return 0;
+ return 0;
#endif
- }
+ }
- //------------------------------------------------------------------
- /// Get accessor for file specification.
- ///
- /// @return
- /// A reference to the file specification object.
- //------------------------------------------------------------------
- FileSpec&
- GetFile ()
- {
- return m_file;
- }
-
- //------------------------------------------------------------------
- /// Get const accessor for file specification.
- ///
- /// @return
- /// A const reference to the file specification object.
- //------------------------------------------------------------------
- const FileSpec&
- GetFile () const
- {
- return m_file;
- }
-
- //------------------------------------------------------------------
- /// Get accessor for the declaration line number.
- ///
- /// @return
- /// Non-zero indicates a valid line number, zero indicates no
- /// line information is available.
- //------------------------------------------------------------------
- uint32_t
- GetLine () const
- {
- return m_line;
- }
-
-
- bool
- IsValid() const
- {
- return m_file && m_line != 0;
- }
-
- //------------------------------------------------------------------
- /// Get the memory cost of this object.
- ///
- /// @return
- /// The number of bytes that this object occupies in memory.
- /// The returned value does not include the bytes for any
- /// shared string values.
- ///
- /// @see ConstString::StaticMemorySize ()
- //------------------------------------------------------------------
- size_t
- MemorySize () const;
-
- //------------------------------------------------------------------
- /// Set accessor for the declaration column number.
- ///
- /// @param[in] column
- /// Non-zero indicates a valid column number, zero indicates no
- /// column information is available.
- //------------------------------------------------------------------
- void
- SetColumn (uint32_t column)
- {
-#ifdef LLDB_ENABLE_DECLARATION_COLUMNS
- m_column = col;
-#endif
- }
+ //------------------------------------------------------------------
+ /// Get accessor for file specification.
+ ///
+ /// @return
+ /// A reference to the file specification object.
+ //------------------------------------------------------------------
+ FileSpec &GetFile() { return m_file; }
+
+ //------------------------------------------------------------------
+ /// Get const accessor for file specification.
+ ///
+ /// @return
+ /// A const reference to the file specification object.
+ //------------------------------------------------------------------
+ const FileSpec &GetFile() const { return m_file; }
+
+ //------------------------------------------------------------------
+ /// Get accessor for the declaration line number.
+ ///
+ /// @return
+ /// Non-zero indicates a valid line number, zero indicates no
+ /// line information is available.
+ //------------------------------------------------------------------
+ uint32_t GetLine() const { return m_line; }
+
+ bool IsValid() const { return m_file && m_line != 0; }
+
+ //------------------------------------------------------------------
+ /// Get the memory cost of this object.
+ ///
+ /// @return
+ /// The number of bytes that this object occupies in memory.
+ /// The returned value does not include the bytes for any
+ /// shared string values.
+ ///
+ /// @see ConstString::StaticMemorySize ()
+ //------------------------------------------------------------------
+ size_t MemorySize() const;
+
+ //------------------------------------------------------------------
+ /// Set accessor for the declaration column number.
+ ///
+ /// @param[in] column
+ /// Non-zero indicates a valid column number, zero indicates no
+ /// column information is available.
+ //------------------------------------------------------------------
+ void SetColumn(uint32_t column) {
+#ifdef LLDB_ENABLE_DECLARATION_COLUMNS
+ m_column = col;
+#endif
+ }
+
+ //------------------------------------------------------------------
+ /// Set accessor for the declaration file specification.
+ ///
+ /// @param[in] file_spec
+ /// The new declaration file specification.
+ //------------------------------------------------------------------
+ void SetFile(const FileSpec &file_spec) { m_file = file_spec; }
+
+ //------------------------------------------------------------------
+ /// Set accessor for the declaration line number.
+ ///
+ /// @param[in] line
+ /// Non-zero indicates a valid line number, zero indicates no
+ /// line information is available.
+ //------------------------------------------------------------------
+ void SetLine(uint32_t line) { m_line = line; }
- //------------------------------------------------------------------
- /// Set accessor for the declaration file specification.
- ///
- /// @param[in] file_spec
- /// The new declaration file specification.
- //------------------------------------------------------------------
- void
- SetFile (const FileSpec& file_spec)
- {
- m_file = file_spec;
- }
-
- //------------------------------------------------------------------
- /// Set accessor for the declaration line number.
- ///
- /// @param[in] line
- /// Non-zero indicates a valid line number, zero indicates no
- /// line information is available.
- //------------------------------------------------------------------
- void
- SetLine (uint32_t line)
- {
- m_line = line;
- }
protected:
- //------------------------------------------------------------------
- /// Member variables.
- //------------------------------------------------------------------
- FileSpec m_file; ///< The file specification that points to the
- ///< source file where the declaration occurred.
- uint32_t m_line; ///< Non-zero values indicates a valid line number,
- ///< zero indicates no line number information is available.
+ //------------------------------------------------------------------
+ /// Member variables.
+ //------------------------------------------------------------------
+ FileSpec m_file; ///< The file specification that points to the
+ ///< source file where the declaration occurred.
+ uint32_t m_line; ///< Non-zero values indicates a valid line number,
+ ///< zero indicates no line number information is available.
#ifdef LLDB_ENABLE_DECLARATION_COLUMNS
- uint32_t m_column; ///< Non-zero values indicates a valid column number,
- ///< zero indicates no column information is available.
+ uint32_t m_column; ///< Non-zero values indicates a valid column number,
+ ///< zero indicates no column information is available.
#endif
};
-bool
-operator == (const Declaration &lhs, const Declaration &rhs);
+bool operator==(const Declaration &lhs, const Declaration &rhs);
} // namespace lldb_private
-#endif // liblldb_Declaration_h_
+#endif // liblldb_Declaration_h_
Modified: lldb/trunk/include/lldb/Symbol/FuncUnwinders.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Symbol/FuncUnwinders.h?rev=280751&r1=280750&r2=280751&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Symbol/FuncUnwinders.h (original)
+++ lldb/trunk/include/lldb/Symbol/FuncUnwinders.h Tue Sep 6 15:57:50 2016
@@ -5,157 +5,152 @@
#include <vector>
#include "lldb/Core/AddressRange.h"
-#include "lldb/Core/ArchSpec.h"
#include "lldb/Core/AddressRange.h"
+#include "lldb/Core/ArchSpec.h"
namespace lldb_private {
class UnwindTable;
-class FuncUnwinders
-{
+class FuncUnwinders {
public:
- // FuncUnwinders objects are used to track UnwindPlans for a function
- // (named or not - really just an address range)
-
- // We'll record four different UnwindPlans for each address range:
- //
- // 1. Unwinding from a call site (a valid exception throw location)
- // This is often sourced from the eh_frame exception handling info
- // 2. Unwinding from a non-call site (any location in the function)
- // This is often done by analyzing the function prologue assembly
- // language instructions
- // 3. A fast unwind method for this function which only retrieves a
- // limited set of registers necessary to walk the stack
- // 4. An architectural default unwind plan when none of the above are
- // available for some reason.
-
- // Additionally, FuncUnwinds object can be asked where the prologue
- // instructions are finished for migrating breakpoints past the
- // stack frame setup instructions when we don't have line table information.
-
- FuncUnwinders (lldb_private::UnwindTable& unwind_table, AddressRange range);
-
- ~FuncUnwinders ();
-
- // current_offset is the byte offset into the function.
- // 0 means no instructions have executed yet. -1 means the offset is unknown.
- // On architectures where the pc points to the next instruction that will execute, this
- // offset value will have already been decremented by 1 to stay within the bounds of the
- // correct function body.
- lldb::UnwindPlanSP
- GetUnwindPlanAtCallSite (Target &target, int current_offset);
-
- lldb::UnwindPlanSP
- GetUnwindPlanAtNonCallSite (Target& target, lldb_private::Thread& thread, int current_offset);
-
- lldb::UnwindPlanSP
- GetUnwindPlanFastUnwind (Target& target, lldb_private::Thread& thread);
-
- lldb::UnwindPlanSP
- GetUnwindPlanArchitectureDefault (lldb_private::Thread& thread);
-
- lldb::UnwindPlanSP
- GetUnwindPlanArchitectureDefaultAtFunctionEntry (lldb_private::Thread& thread);
-
- Address&
- GetFirstNonPrologueInsn (Target& target);
+ // FuncUnwinders objects are used to track UnwindPlans for a function
+ // (named or not - really just an address range)
- const Address&
- GetFunctionStartAddress () const;
+ // We'll record four different UnwindPlans for each address range:
+ //
+ // 1. Unwinding from a call site (a valid exception throw location)
+ // This is often sourced from the eh_frame exception handling info
+ // 2. Unwinding from a non-call site (any location in the function)
+ // This is often done by analyzing the function prologue assembly
+ // language instructions
+ // 3. A fast unwind method for this function which only retrieves a
+ // limited set of registers necessary to walk the stack
+ // 4. An architectural default unwind plan when none of the above are
+ // available for some reason.
+
+ // Additionally, FuncUnwinds object can be asked where the prologue
+ // instructions are finished for migrating breakpoints past the
+ // stack frame setup instructions when we don't have line table information.
+
+ FuncUnwinders(lldb_private::UnwindTable &unwind_table, AddressRange range);
+
+ ~FuncUnwinders();
+
+ // current_offset is the byte offset into the function.
+ // 0 means no instructions have executed yet. -1 means the offset is unknown.
+ // On architectures where the pc points to the next instruction that will
+ // execute, this
+ // offset value will have already been decremented by 1 to stay within the
+ // bounds of the
+ // correct function body.
+ lldb::UnwindPlanSP GetUnwindPlanAtCallSite(Target &target,
+ int current_offset);
+
+ lldb::UnwindPlanSP GetUnwindPlanAtNonCallSite(Target &target,
+ lldb_private::Thread &thread,
+ int current_offset);
+
+ lldb::UnwindPlanSP GetUnwindPlanFastUnwind(Target &target,
+ lldb_private::Thread &thread);
+
+ lldb::UnwindPlanSP
+ GetUnwindPlanArchitectureDefault(lldb_private::Thread &thread);
+
+ lldb::UnwindPlanSP
+ GetUnwindPlanArchitectureDefaultAtFunctionEntry(lldb_private::Thread &thread);
+
+ Address &GetFirstNonPrologueInsn(Target &target);
+
+ const Address &GetFunctionStartAddress() const;
+
+ bool ContainsAddress(const Address &addr) const {
+ return m_range.ContainsFileAddress(addr);
+ }
+
+ // A function may have a Language Specific Data Area specified -- a block of
+ // data in
+ // the object file which is used in the processing of an exception throw /
+ // catch.
+ // If any of the UnwindPlans have the address of the LSDA region for this
+ // function,
+ // this will return it.
+ Address GetLSDAAddress(Target &target);
+
+ // A function may have a Personality Routine associated with it -- used in the
+ // processing of throwing an exception. If any of the UnwindPlans have the
+ // address of the personality routine, this will return it. Read the
+ // target-pointer
+ // at this address to get the personality function address.
+ Address GetPersonalityRoutinePtrAddress(Target &target);
+
+ // The following methods to retrieve specific unwind plans should rarely be
+ // used.
+ // Instead, clients should ask for the *behavior* they are looking for, using
+ // one
+ // of the above UnwindPlan retrieval methods.
+
+ lldb::UnwindPlanSP GetAssemblyUnwindPlan(Target &target, Thread &thread,
+ int current_offset);
+
+ lldb::UnwindPlanSP GetEHFrameUnwindPlan(Target &target, int current_offset);
+
+ lldb::UnwindPlanSP GetEHFrameAugmentedUnwindPlan(Target &target,
+ Thread &thread,
+ int current_offset);
- bool
- ContainsAddress (const Address& addr) const
- {
- return m_range.ContainsFileAddress (addr);
- }
+ lldb::UnwindPlanSP GetCompactUnwindUnwindPlan(Target &target,
+ int current_offset);
- // A function may have a Language Specific Data Area specified -- a block of data in
- // the object file which is used in the processing of an exception throw / catch.
- // If any of the UnwindPlans have the address of the LSDA region for this function,
- // this will return it.
- Address
- GetLSDAAddress (Target &target);
+ lldb::UnwindPlanSP GetArmUnwindUnwindPlan(Target &target, int current_offset);
- // A function may have a Personality Routine associated with it -- used in the
- // processing of throwing an exception. If any of the UnwindPlans have the
- // address of the personality routine, this will return it. Read the target-pointer
- // at this address to get the personality function address.
- Address
- GetPersonalityRoutinePtrAddress (Target &target);
+ lldb::UnwindPlanSP GetArchDefaultUnwindPlan(Thread &thread);
-
-
- // The following methods to retrieve specific unwind plans should rarely be used.
- // Instead, clients should ask for the *behavior* they are looking for, using one
- // of the above UnwindPlan retrieval methods.
-
- lldb::UnwindPlanSP
- GetAssemblyUnwindPlan (Target &target, Thread &thread, int current_offset);
-
- lldb::UnwindPlanSP
- GetEHFrameUnwindPlan (Target &target, int current_offset);
-
- lldb::UnwindPlanSP
- GetEHFrameAugmentedUnwindPlan (Target &target, Thread &thread, int current_offset);
-
- lldb::UnwindPlanSP
- GetCompactUnwindUnwindPlan (Target &target, int current_offset);
-
- lldb::UnwindPlanSP
- GetArmUnwindUnwindPlan (Target &target, int current_offset);
-
- lldb::UnwindPlanSP
- GetArchDefaultUnwindPlan (Thread &thread);
-
- lldb::UnwindPlanSP
- GetArchDefaultAtFuncEntryUnwindPlan (Thread &thread);
+ lldb::UnwindPlanSP GetArchDefaultAtFuncEntryUnwindPlan(Thread &thread);
private:
+ lldb::UnwindAssemblySP GetUnwindAssemblyProfiler(Target &target);
- lldb::UnwindAssemblySP
- GetUnwindAssemblyProfiler (Target& target);
+ // Do a simplistic comparison for the register restore rule for getting
+ // the caller's pc value on two UnwindPlans -- returns LazyBoolYes if
+ // they have the same unwind rule for the pc, LazyBoolNo if they do not
+ // have the same unwind rule for the pc, and LazyBoolCalculate if it was
+ // unable to determine this for some reason.
+ lldb_private::LazyBool CompareUnwindPlansForIdenticalInitialPCLocation(
+ Thread &thread, const lldb::UnwindPlanSP &a, const lldb::UnwindPlanSP &b);
+
+ UnwindTable &m_unwind_table;
+ AddressRange m_range;
+
+ std::recursive_mutex m_mutex;
+
+ lldb::UnwindPlanSP m_unwind_plan_assembly_sp;
+ lldb::UnwindPlanSP m_unwind_plan_eh_frame_sp;
+ lldb::UnwindPlanSP m_unwind_plan_eh_frame_augmented_sp; // augmented by
+ // assembly inspection
+ // so it's valid
+ // everywhere
+ std::vector<lldb::UnwindPlanSP> m_unwind_plan_compact_unwind;
+ lldb::UnwindPlanSP m_unwind_plan_arm_unwind_sp;
+ lldb::UnwindPlanSP m_unwind_plan_fast_sp;
+ lldb::UnwindPlanSP m_unwind_plan_arch_default_sp;
+ lldb::UnwindPlanSP m_unwind_plan_arch_default_at_func_entry_sp;
+
+ // Fetching the UnwindPlans can be expensive - if we've already attempted
+ // to get one & failed, don't try again.
+ bool m_tried_unwind_plan_assembly : 1, m_tried_unwind_plan_eh_frame : 1,
+ m_tried_unwind_plan_eh_frame_augmented : 1,
+ m_tried_unwind_plan_compact_unwind : 1,
+ m_tried_unwind_plan_arm_unwind : 1, m_tried_unwind_fast : 1,
+ m_tried_unwind_arch_default : 1,
+ m_tried_unwind_arch_default_at_func_entry : 1;
- // Do a simplistic comparison for the register restore rule for getting
- // the caller's pc value on two UnwindPlans -- returns LazyBoolYes if
- // they have the same unwind rule for the pc, LazyBoolNo if they do not
- // have the same unwind rule for the pc, and LazyBoolCalculate if it was
- // unable to determine this for some reason.
- lldb_private::LazyBool
- CompareUnwindPlansForIdenticalInitialPCLocation (Thread& thread, const lldb::UnwindPlanSP &a, const lldb::UnwindPlanSP &b);
-
- UnwindTable& m_unwind_table;
- AddressRange m_range;
-
- std::recursive_mutex m_mutex;
-
- lldb::UnwindPlanSP m_unwind_plan_assembly_sp;
- lldb::UnwindPlanSP m_unwind_plan_eh_frame_sp;
- lldb::UnwindPlanSP m_unwind_plan_eh_frame_augmented_sp; // augmented by assembly inspection so it's valid everywhere
- std::vector<lldb::UnwindPlanSP> m_unwind_plan_compact_unwind;
- lldb::UnwindPlanSP m_unwind_plan_arm_unwind_sp;
- lldb::UnwindPlanSP m_unwind_plan_fast_sp;
- lldb::UnwindPlanSP m_unwind_plan_arch_default_sp;
- lldb::UnwindPlanSP m_unwind_plan_arch_default_at_func_entry_sp;
-
- // Fetching the UnwindPlans can be expensive - if we've already attempted
- // to get one & failed, don't try again.
- bool m_tried_unwind_plan_assembly:1,
- m_tried_unwind_plan_eh_frame:1,
- m_tried_unwind_plan_eh_frame_augmented:1,
- m_tried_unwind_plan_compact_unwind:1,
- m_tried_unwind_plan_arm_unwind:1,
- m_tried_unwind_fast:1,
- m_tried_unwind_arch_default:1,
- m_tried_unwind_arch_default_at_func_entry:1;
+ Address m_first_non_prologue_insn;
- Address m_first_non_prologue_insn;
-
- DISALLOW_COPY_AND_ASSIGN (FuncUnwinders);
+ DISALLOW_COPY_AND_ASSIGN(FuncUnwinders);
}; // class FuncUnwinders
} // namespace lldb_private
-
-#endif //liblldb_FuncUnwinders_h
+#endif // liblldb_FuncUnwinders_h
Modified: lldb/trunk/include/lldb/Symbol/Function.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Symbol/Function.h?rev=280751&r1=280750&r2=280751&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Symbol/Function.h (original)
+++ lldb/trunk/include/lldb/Symbol/Function.h Tue Sep 6 15:57:50 2016
@@ -11,11 +11,11 @@
#define liblldb_Function_h_
#include "lldb/Core/AddressRange.h"
-#include "lldb/Symbol/Block.h"
-#include "lldb/Symbol/Declaration.h"
-#include "lldb/Expression/DWARFExpression.h"
#include "lldb/Core/Mangled.h"
#include "lldb/Core/UserID.h"
+#include "lldb/Expression/DWARFExpression.h"
+#include "lldb/Symbol/Block.h"
+#include "lldb/Symbol/Declaration.h"
namespace lldb_private {
@@ -26,281 +26,268 @@ namespace lldb_private {
/// This provides generic function information that gets reused between
/// inline functions and function types.
//----------------------------------------------------------------------
-class FunctionInfo
-{
+class FunctionInfo {
public:
- //------------------------------------------------------------------
- /// Construct with the function method name and optional declaration
- /// information.
- ///
- /// @param[in] name
- /// A C string name for the method name for this function. This
- /// value should not be the mangled named, but the simple method
- /// name.
- ///
- /// @param[in] decl_ptr
- /// Optional declaration information that describes where the
- /// function was declared. This can be NULL.
- //------------------------------------------------------------------
- FunctionInfo (const char *name, const Declaration *decl_ptr);
-
- //------------------------------------------------------------------
- /// Construct with the function method name and optional declaration
- /// information.
- ///
- /// @param[in] name
- /// A name for the method name for this function. This value
- /// should not be the mangled named, but the simple method name.
- ///
- /// @param[in] decl_ptr
- /// Optional declaration information that describes where the
- /// function was declared. This can be NULL.
- //------------------------------------------------------------------
- FunctionInfo (const ConstString& name, const Declaration *decl_ptr);
-
- //------------------------------------------------------------------
- /// Destructor.
- ///
- /// The destructor is virtual since classes inherit from this class.
- //------------------------------------------------------------------
- virtual
- ~FunctionInfo ();
-
- //------------------------------------------------------------------
- /// Compare two function information objects.
- ///
- /// First compares the method names, and if equal, then compares
- /// the declaration information.
- ///
- /// @param[in] lhs
- /// The Left Hand Side const FunctionInfo object reference.
- ///
- /// @param[in] rhs
- /// The Right Hand Side const FunctionInfo object reference.
- ///
- /// @return
- /// @li -1 if lhs < rhs
- /// @li 0 if lhs == rhs
- /// @li 1 if lhs > rhs
- //------------------------------------------------------------------
- static int
- Compare (const FunctionInfo& lhs, const FunctionInfo& rhs);
-
- //------------------------------------------------------------------
- /// Dump a description of this object to a Stream.
- ///
- /// Dump a description of the contents of this object to the
- /// supplied stream \a s.
- ///
- /// @param[in] s
- /// The stream to which to dump the object description.
- //------------------------------------------------------------------
- void
- Dump (Stream *s, bool show_fullpaths) const;
-
- //------------------------------------------------------------------
- /// Get accessor for the declaration information.
- ///
- /// @return
- /// A reference to the declaration object.
- //------------------------------------------------------------------
- Declaration&
- GetDeclaration ();
-
- //------------------------------------------------------------------
- /// Get const accessor for the declaration information.
- ///
- /// @return
- /// A const reference to the declaration object.
- //------------------------------------------------------------------
- const Declaration&
- GetDeclaration () const;
-
- //------------------------------------------------------------------
- /// Get accessor for the method name.
- ///
- /// @return
- /// A const reference to the method name object.
- //------------------------------------------------------------------
- ConstString
- GetName () const;
-
- //------------------------------------------------------------------
- /// Get the memory cost of this object.
- ///
- /// @return
- /// The number of bytes that this object occupies in memory.
- /// The returned value does not include the bytes for any
- /// shared string values.
- ///
- /// @see ConstString::StaticMemorySize ()
- //------------------------------------------------------------------
- virtual size_t
- MemorySize () const;
+ //------------------------------------------------------------------
+ /// Construct with the function method name and optional declaration
+ /// information.
+ ///
+ /// @param[in] name
+ /// A C string name for the method name for this function. This
+ /// value should not be the mangled named, but the simple method
+ /// name.
+ ///
+ /// @param[in] decl_ptr
+ /// Optional declaration information that describes where the
+ /// function was declared. This can be NULL.
+ //------------------------------------------------------------------
+ FunctionInfo(const char *name, const Declaration *decl_ptr);
+
+ //------------------------------------------------------------------
+ /// Construct with the function method name and optional declaration
+ /// information.
+ ///
+ /// @param[in] name
+ /// A name for the method name for this function. This value
+ /// should not be the mangled named, but the simple method name.
+ ///
+ /// @param[in] decl_ptr
+ /// Optional declaration information that describes where the
+ /// function was declared. This can be NULL.
+ //------------------------------------------------------------------
+ FunctionInfo(const ConstString &name, const Declaration *decl_ptr);
+
+ //------------------------------------------------------------------
+ /// Destructor.
+ ///
+ /// The destructor is virtual since classes inherit from this class.
+ //------------------------------------------------------------------
+ virtual ~FunctionInfo();
+
+ //------------------------------------------------------------------
+ /// Compare two function information objects.
+ ///
+ /// First compares the method names, and if equal, then compares
+ /// the declaration information.
+ ///
+ /// @param[in] lhs
+ /// The Left Hand Side const FunctionInfo object reference.
+ ///
+ /// @param[in] rhs
+ /// The Right Hand Side const FunctionInfo object reference.
+ ///
+ /// @return
+ /// @li -1 if lhs < rhs
+ /// @li 0 if lhs == rhs
+ /// @li 1 if lhs > rhs
+ //------------------------------------------------------------------
+ static int Compare(const FunctionInfo &lhs, const FunctionInfo &rhs);
+
+ //------------------------------------------------------------------
+ /// Dump a description of this object to a Stream.
+ ///
+ /// Dump a description of the contents of this object to the
+ /// supplied stream \a s.
+ ///
+ /// @param[in] s
+ /// The stream to which to dump the object description.
+ //------------------------------------------------------------------
+ void Dump(Stream *s, bool show_fullpaths) const;
+
+ //------------------------------------------------------------------
+ /// Get accessor for the declaration information.
+ ///
+ /// @return
+ /// A reference to the declaration object.
+ //------------------------------------------------------------------
+ Declaration &GetDeclaration();
+
+ //------------------------------------------------------------------
+ /// Get const accessor for the declaration information.
+ ///
+ /// @return
+ /// A const reference to the declaration object.
+ //------------------------------------------------------------------
+ const Declaration &GetDeclaration() const;
+
+ //------------------------------------------------------------------
+ /// Get accessor for the method name.
+ ///
+ /// @return
+ /// A const reference to the method name object.
+ //------------------------------------------------------------------
+ ConstString GetName() const;
+
+ //------------------------------------------------------------------
+ /// Get the memory cost of this object.
+ ///
+ /// @return
+ /// The number of bytes that this object occupies in memory.
+ /// The returned value does not include the bytes for any
+ /// shared string values.
+ ///
+ /// @see ConstString::StaticMemorySize ()
+ //------------------------------------------------------------------
+ virtual size_t MemorySize() const;
protected:
- //------------------------------------------------------------------
- // Member variables.
- //------------------------------------------------------------------
- ConstString m_name; ///< Function method name (not a mangled name).
- Declaration m_declaration; ///< Information describing where this function information was defined.
+ //------------------------------------------------------------------
+ // Member variables.
+ //------------------------------------------------------------------
+ ConstString m_name; ///< Function method name (not a mangled name).
+ Declaration m_declaration; ///< Information describing where this function
+ ///information was defined.
};
//----------------------------------------------------------------------
/// @class InlineFunctionInfo Function.h "lldb/Symbol/Function.h"
/// @brief A class that describes information for an inlined function.
//----------------------------------------------------------------------
-class InlineFunctionInfo : public FunctionInfo
-{
+class InlineFunctionInfo : public FunctionInfo {
public:
- //------------------------------------------------------------------
- /// Construct with the function method name, mangled name, and
- /// optional declaration information.
- ///
- /// @param[in] name
- /// A C string name for the method name for this function. This
- /// value should not be the mangled named, but the simple method
- /// name.
- ///
- /// @param[in] mangled
- /// A C string name for the mangled name for this function. This
- /// value can be NULL if there is no mangled information.
- ///
- /// @param[in] decl_ptr
- /// Optional declaration information that describes where the
- /// function was declared. This can be NULL.
- ///
- /// @param[in] call_decl_ptr
- /// Optional calling location declaration information that
- /// describes from where this inlined function was called.
- //------------------------------------------------------------------
- InlineFunctionInfo(const char *name, const char *mangled, const Declaration *decl_ptr, const Declaration *call_decl_ptr);
-
- //------------------------------------------------------------------
- /// Construct with the function method name, mangled name, and
- /// optional declaration information.
- ///
- /// @param[in] name
- /// A name for the method name for this function. This value
- /// should not be the mangled named, but the simple method name.
- ///
- /// @param[in] mangled
- /// A name for the mangled name for this function. This value
- /// can be empty if there is no mangled information.
- ///
- /// @param[in] decl_ptr
- /// Optional declaration information that describes where the
- /// function was declared. This can be NULL.
- ///
- /// @param[in] call_decl_ptr
- /// Optional calling location declaration information that
- /// describes from where this inlined function was called.
- //------------------------------------------------------------------
- InlineFunctionInfo(const ConstString& name, const Mangled &mangled, const Declaration *decl_ptr, const Declaration *call_decl_ptr);
-
- //------------------------------------------------------------------
- /// Destructor.
- //------------------------------------------------------------------
- ~InlineFunctionInfo() override;
-
- //------------------------------------------------------------------
- /// Compare two inlined function information objects.
- ///
- /// First compares the FunctionInfo objects, and if equal,
- /// compares the mangled names.
- ///
- /// @param[in] lhs
- /// The Left Hand Side const InlineFunctionInfo object
- /// reference.
- ///
- /// @param[in] rhs
- /// The Right Hand Side const InlineFunctionInfo object
- /// reference.
- ///
- /// @return
- /// @li -1 if lhs < rhs
- /// @li 0 if lhs == rhs
- /// @li 1 if lhs > rhs
- //------------------------------------------------------------------
- int
- Compare(const InlineFunctionInfo& lhs, const InlineFunctionInfo& rhs);
-
- //------------------------------------------------------------------
- /// Dump a description of this object to a Stream.
- ///
- /// Dump a description of the contents of this object to the
- /// supplied stream \a s.
- ///
- /// @param[in] s
- /// The stream to which to dump the object description.
- //------------------------------------------------------------------
- void
- Dump(Stream *s, bool show_fullpaths) const;
-
- void
- DumpStopContext (Stream *s, lldb::LanguageType language) const;
-
- ConstString
- GetName (lldb::LanguageType language) const;
-
- ConstString
- GetDisplayName (lldb::LanguageType language) const;
-
- //------------------------------------------------------------------
- /// Get accessor for the call site declaration information.
- ///
- /// @return
- /// A reference to the declaration object.
- //------------------------------------------------------------------
- Declaration&
- GetCallSite ();
-
- //------------------------------------------------------------------
- /// Get const accessor for the call site declaration information.
- ///
- /// @return
- /// A const reference to the declaration object.
- //------------------------------------------------------------------
- const Declaration&
- GetCallSite () const;
-
- //------------------------------------------------------------------
- /// Get accessor for the mangled name object.
- ///
- /// @return
- /// A reference to the mangled name object.
- //------------------------------------------------------------------
- Mangled&
- GetMangled();
-
- //------------------------------------------------------------------
- /// Get const accessor for the mangled name object.
- ///
- /// @return
- /// A const reference to the mangled name object.
- //------------------------------------------------------------------
- const Mangled&
- GetMangled() const;
-
- //------------------------------------------------------------------
- /// Get the memory cost of this object.
- ///
- /// @return
- /// The number of bytes that this object occupies in memory.
- /// The returned value does not include the bytes for any
- /// shared string values.
- ///
- /// @see ConstString::StaticMemorySize ()
- //------------------------------------------------------------------
- size_t
- MemorySize() const override;
+ //------------------------------------------------------------------
+ /// Construct with the function method name, mangled name, and
+ /// optional declaration information.
+ ///
+ /// @param[in] name
+ /// A C string name for the method name for this function. This
+ /// value should not be the mangled named, but the simple method
+ /// name.
+ ///
+ /// @param[in] mangled
+ /// A C string name for the mangled name for this function. This
+ /// value can be NULL if there is no mangled information.
+ ///
+ /// @param[in] decl_ptr
+ /// Optional declaration information that describes where the
+ /// function was declared. This can be NULL.
+ ///
+ /// @param[in] call_decl_ptr
+ /// Optional calling location declaration information that
+ /// describes from where this inlined function was called.
+ //------------------------------------------------------------------
+ InlineFunctionInfo(const char *name, const char *mangled,
+ const Declaration *decl_ptr,
+ const Declaration *call_decl_ptr);
+
+ //------------------------------------------------------------------
+ /// Construct with the function method name, mangled name, and
+ /// optional declaration information.
+ ///
+ /// @param[in] name
+ /// A name for the method name for this function. This value
+ /// should not be the mangled named, but the simple method name.
+ ///
+ /// @param[in] mangled
+ /// A name for the mangled name for this function. This value
+ /// can be empty if there is no mangled information.
+ ///
+ /// @param[in] decl_ptr
+ /// Optional declaration information that describes where the
+ /// function was declared. This can be NULL.
+ ///
+ /// @param[in] call_decl_ptr
+ /// Optional calling location declaration information that
+ /// describes from where this inlined function was called.
+ //------------------------------------------------------------------
+ InlineFunctionInfo(const ConstString &name, const Mangled &mangled,
+ const Declaration *decl_ptr,
+ const Declaration *call_decl_ptr);
+
+ //------------------------------------------------------------------
+ /// Destructor.
+ //------------------------------------------------------------------
+ ~InlineFunctionInfo() override;
+
+ //------------------------------------------------------------------
+ /// Compare two inlined function information objects.
+ ///
+ /// First compares the FunctionInfo objects, and if equal,
+ /// compares the mangled names.
+ ///
+ /// @param[in] lhs
+ /// The Left Hand Side const InlineFunctionInfo object
+ /// reference.
+ ///
+ /// @param[in] rhs
+ /// The Right Hand Side const InlineFunctionInfo object
+ /// reference.
+ ///
+ /// @return
+ /// @li -1 if lhs < rhs
+ /// @li 0 if lhs == rhs
+ /// @li 1 if lhs > rhs
+ //------------------------------------------------------------------
+ int Compare(const InlineFunctionInfo &lhs, const InlineFunctionInfo &rhs);
+
+ //------------------------------------------------------------------
+ /// Dump a description of this object to a Stream.
+ ///
+ /// Dump a description of the contents of this object to the
+ /// supplied stream \a s.
+ ///
+ /// @param[in] s
+ /// The stream to which to dump the object description.
+ //------------------------------------------------------------------
+ void Dump(Stream *s, bool show_fullpaths) const;
+
+ void DumpStopContext(Stream *s, lldb::LanguageType language) const;
+
+ ConstString GetName(lldb::LanguageType language) const;
+
+ ConstString GetDisplayName(lldb::LanguageType language) const;
+
+ //------------------------------------------------------------------
+ /// Get accessor for the call site declaration information.
+ ///
+ /// @return
+ /// A reference to the declaration object.
+ //------------------------------------------------------------------
+ Declaration &GetCallSite();
+
+ //------------------------------------------------------------------
+ /// Get const accessor for the call site declaration information.
+ ///
+ /// @return
+ /// A const reference to the declaration object.
+ //------------------------------------------------------------------
+ const Declaration &GetCallSite() const;
+
+ //------------------------------------------------------------------
+ /// Get accessor for the mangled name object.
+ ///
+ /// @return
+ /// A reference to the mangled name object.
+ //------------------------------------------------------------------
+ Mangled &GetMangled();
+
+ //------------------------------------------------------------------
+ /// Get const accessor for the mangled name object.
+ ///
+ /// @return
+ /// A const reference to the mangled name object.
+ //------------------------------------------------------------------
+ const Mangled &GetMangled() const;
+
+ //------------------------------------------------------------------
+ /// Get the memory cost of this object.
+ ///
+ /// @return
+ /// The number of bytes that this object occupies in memory.
+ /// The returned value does not include the bytes for any
+ /// shared string values.
+ ///
+ /// @see ConstString::StaticMemorySize ()
+ //------------------------------------------------------------------
+ size_t MemorySize() const override;
private:
- //------------------------------------------------------------------
- // Member variables.
- //------------------------------------------------------------------
- Mangled m_mangled; ///< Mangled inlined function name (can be empty if there is no mangled information).
- Declaration m_call_decl;
+ //------------------------------------------------------------------
+ // Member variables.
+ //------------------------------------------------------------------
+ Mangled m_mangled; ///< Mangled inlined function name (can be empty if there
+ ///is no mangled information).
+ Declaration m_call_decl;
};
//----------------------------------------------------------------------
@@ -327,369 +314,321 @@ private:
/// The concrete information is the address range information and
/// specific locations for an instance of this function.
//----------------------------------------------------------------------
-class Function :
- public UserID,
- public SymbolContextScope
-{
+class Function : public UserID, public SymbolContextScope {
public:
- //------------------------------------------------------------------
- /// Construct with a compile unit, function UID, function type UID,
- /// optional mangled name, function type, and a section offset
- /// based address range.
- ///
- /// @param[in] comp_unit
- /// The compile unit to which this function belongs.
- ///
- /// @param[in] func_uid
- /// The UID for this function. This value is provided by the
- /// SymbolFile plug-in and can be any value that allows
- /// the plug-in to quickly find and parse more detailed
- /// information when and if more information is needed.
- ///
- /// @param[in] func_type_uid
- /// The type UID for the function Type to allow for lazy type
- /// parsing from the debug information.
- ///
- /// @param[in] mangled
- /// The optional mangled name for this function. If empty, there
- /// is no mangled information.
- ///
- /// @param[in] func_type
- /// The optional function type. If NULL, the function type will
- /// be parsed on demand when accessed using the
- /// Function::GetType() function by asking the SymbolFile
- /// plug-in to get the type for \a func_type_uid.
- ///
- /// @param[in] range
- /// The section offset based address for this function.
- //------------------------------------------------------------------
- Function (
- CompileUnit *comp_unit,
- lldb::user_id_t func_uid,
- lldb::user_id_t func_type_uid,
- const Mangled &mangled,
- Type * func_type,
- const AddressRange& range);
-
- //------------------------------------------------------------------
- /// Construct with a compile unit, function UID, function type UID,
- /// optional mangled name, function type, and a section offset
- /// based address range.
- ///
- /// @param[in] comp_unit
- /// The compile unit to which this function belongs.
- ///
- /// @param[in] func_uid
- /// The UID for this function. This value is provided by the
- /// SymbolFile plug-in and can be any value that allows
- /// the plug-in to quickly find and parse more detailed
- /// information when and if more information is needed.
- ///
- /// @param[in] func_type_uid
- /// The type UID for the function Type to allow for lazy type
- /// parsing from the debug information.
- ///
- /// @param[in] mangled
- /// The optional mangled name for this function. If empty, there
- /// is no mangled information.
- ///
- /// @param[in] func_type
- /// The optional function type. If NULL, the function type will
- /// be parsed on demand when accessed using the
- /// Function::GetType() function by asking the SymbolFile
- /// plug-in to get the type for \a func_type_uid.
- ///
- /// @param[in] range
- /// The section offset based address for this function.
- //------------------------------------------------------------------
- Function (
- CompileUnit *comp_unit,
- lldb::user_id_t func_uid,
- lldb::user_id_t func_type_uid,
- const char *mangled,
- Type * func_type,
- const AddressRange& range);
-
- //------------------------------------------------------------------
- /// Destructor.
- //------------------------------------------------------------------
- ~Function() override;
-
- //------------------------------------------------------------------
- /// @copydoc SymbolContextScope::CalculateSymbolContext(SymbolContext*)
- ///
- /// @see SymbolContextScope
- //------------------------------------------------------------------
- void
- CalculateSymbolContext(SymbolContext* sc) override;
-
- lldb::ModuleSP
- CalculateSymbolContextModule() override;
-
- CompileUnit *
- CalculateSymbolContextCompileUnit() override;
-
- Function *
- CalculateSymbolContextFunction() override;
-
- const AddressRange &
- GetAddressRange()
- {
- return m_range;
- }
-
- lldb::LanguageType
- GetLanguage() const;
- //------------------------------------------------------------------
- /// Find the file and line number of the source location of the start
- /// of the function. This will use the declaration if present and fall
- /// back on the line table if that fails. So there may NOT be a line
- /// table entry for this source file/line combo.
- ///
- /// @param[out] source_file
- /// The source file.
- ///
- /// @param[out] line_no
- /// The line number.
- //------------------------------------------------------------------
- void
- GetStartLineSourceInfo (FileSpec &source_file, uint32_t &line_no);
-
- //------------------------------------------------------------------
- /// Find the file and line number of the source location of the end
- /// of the function.
- ///
- ///
- /// @param[out] source_file
- /// The source file.
- ///
- /// @param[out] line_no
- /// The line number.
- //------------------------------------------------------------------
- void
- GetEndLineSourceInfo (FileSpec &source_file, uint32_t &line_no);
-
- //------------------------------------------------------------------
- /// Get accessor for the block list.
- ///
- /// @return
- /// The block list object that describes all lexical blocks
- /// in the function.
- ///
- /// @see BlockList
- //------------------------------------------------------------------
- Block&
- GetBlock (bool can_create);
-
- //------------------------------------------------------------------
- /// Get accessor for the compile unit that owns this function.
- ///
- /// @return
- /// A compile unit object pointer.
- //------------------------------------------------------------------
- CompileUnit*
- GetCompileUnit();
-
- //------------------------------------------------------------------
- /// Get const accessor for the compile unit that owns this function.
- ///
- /// @return
- /// A const compile unit object pointer.
- //------------------------------------------------------------------
- const CompileUnit*
- GetCompileUnit() const;
-
- void
- GetDescription(Stream *s, lldb::DescriptionLevel level, Target *target);
-
- //------------------------------------------------------------------
- /// Get accessor for the frame base location.
- ///
- /// @return
- /// A location expression that describes the function frame
- /// base.
- //------------------------------------------------------------------
- DWARFExpression &
- GetFrameBaseExpression()
- {
- return m_frame_base;
- }
-
- //------------------------------------------------------------------
- /// Get const accessor for the frame base location.
- ///
- /// @return
- /// A const compile unit object pointer.
- //------------------------------------------------------------------
- const DWARFExpression &
- GetFrameBaseExpression() const
- {
- return m_frame_base;
- }
-
- ConstString
- GetName() const;
-
- ConstString
- GetNameNoArguments () const;
-
- ConstString
- GetDisplayName () const;
-
- const Mangled &
- GetMangled() const
- {
- return m_mangled;
- }
-
- //------------------------------------------------------------------
- /// Get the DeclContext for this function, if available.
- ///
- /// @return
- /// The DeclContext, or NULL if none exists.
- //------------------------------------------------------------------
- CompilerDeclContext
- GetDeclContext();
-
- //------------------------------------------------------------------
- /// Get accessor for the type that describes the function
- /// return value type, and parameter types.
- ///
- /// @return
- /// A type object pointer.
- //------------------------------------------------------------------
- Type*
- GetType();
-
- //------------------------------------------------------------------
- /// Get const accessor for the type that describes the function
- /// return value type, and parameter types.
- ///
- /// @return
- /// A const type object pointer.
- //------------------------------------------------------------------
- const Type*
- GetType() const;
-
- CompilerType
- GetCompilerType ();
-
- //------------------------------------------------------------------
- /// Get the size of the prologue instructions for this function. The "prologue"
- /// instructions include any instructions given line number 0 immediately following
- /// the prologue end.
- ///
- /// @return
- /// The size of the prologue.
- //------------------------------------------------------------------
- uint32_t
- GetPrologueByteSize ();
-
- //------------------------------------------------------------------
- /// Dump a description of this object to a Stream.
- ///
- /// Dump a description of the contents of this object to the
- /// supplied stream \a s.
- ///
- /// @param[in] s
- /// The stream to which to dump the object description.
- ///
- /// @param[in] show_context
- /// If \b true, variables will dump their symbol context
- /// information.
- //------------------------------------------------------------------
- void
- Dump(Stream *s, bool show_context) const;
-
- //------------------------------------------------------------------
- /// @copydoc SymbolContextScope::DumpSymbolContext(Stream*)
- ///
- /// @see SymbolContextScope
- //------------------------------------------------------------------
- void
- DumpSymbolContext(Stream *s) override;
-
- //------------------------------------------------------------------
- /// Get the memory cost of this object.
- ///
- /// @return
- /// The number of bytes that this object occupies in memory.
- /// The returned value does not include the bytes for any
- /// shared string values.
- ///
- /// @see ConstString::StaticMemorySize ()
- //------------------------------------------------------------------
- size_t
- MemorySize () const;
-
- //------------------------------------------------------------------
- /// Get whether compiler optimizations were enabled for this function
- ///
- /// The debug information may provide information about whether this
- /// function was compiled with optimization or not. In this case,
- /// "optimized" means that the debug experience may be difficult
- /// for the user to understand. Variables may not be available when
- /// the developer would expect them, stepping through the source lines
- /// in the function may appear strange, etc.
- ///
- /// @return
- /// Returns 'true' if this function was compiled with
- /// optimization. 'false' indicates that either the optimization
- /// is unknown, or this function was built without optimization.
- //------------------------------------------------------------------
- bool
- GetIsOptimized ();
-
- //------------------------------------------------------------------
- /// Get whether this function represents a 'top-level' function
- ///
- /// The concept of a top-level function is language-specific, mostly
- /// meant to represent the notion of scripting-style code that has
- /// global visibility of the variables/symbols/functions/...
- /// defined within the containing file/module
- ///
- /// If stopped in a top-level function, LLDB will expose global variables
- /// as-if locals in the 'frame variable' command
- ///
- /// @return
- /// Returns 'true' if this function is a top-level function,
- /// 'false' otherwise.
- //------------------------------------------------------------------
- bool
- IsTopLevelFunction ();
-
- lldb::DisassemblerSP
- GetInstructions (const ExecutionContext &exe_ctx,
- const char *flavor,
- bool prefer_file_cache);
-
- bool
- GetDisassembly (const ExecutionContext &exe_ctx,
- const char *flavor,
- bool prefer_file_cache,
- Stream &strm);
+ //------------------------------------------------------------------
+ /// Construct with a compile unit, function UID, function type UID,
+ /// optional mangled name, function type, and a section offset
+ /// based address range.
+ ///
+ /// @param[in] comp_unit
+ /// The compile unit to which this function belongs.
+ ///
+ /// @param[in] func_uid
+ /// The UID for this function. This value is provided by the
+ /// SymbolFile plug-in and can be any value that allows
+ /// the plug-in to quickly find and parse more detailed
+ /// information when and if more information is needed.
+ ///
+ /// @param[in] func_type_uid
+ /// The type UID for the function Type to allow for lazy type
+ /// parsing from the debug information.
+ ///
+ /// @param[in] mangled
+ /// The optional mangled name for this function. If empty, there
+ /// is no mangled information.
+ ///
+ /// @param[in] func_type
+ /// The optional function type. If NULL, the function type will
+ /// be parsed on demand when accessed using the
+ /// Function::GetType() function by asking the SymbolFile
+ /// plug-in to get the type for \a func_type_uid.
+ ///
+ /// @param[in] range
+ /// The section offset based address for this function.
+ //------------------------------------------------------------------
+ Function(CompileUnit *comp_unit, lldb::user_id_t func_uid,
+ lldb::user_id_t func_type_uid, const Mangled &mangled,
+ Type *func_type, const AddressRange &range);
+
+ //------------------------------------------------------------------
+ /// Construct with a compile unit, function UID, function type UID,
+ /// optional mangled name, function type, and a section offset
+ /// based address range.
+ ///
+ /// @param[in] comp_unit
+ /// The compile unit to which this function belongs.
+ ///
+ /// @param[in] func_uid
+ /// The UID for this function. This value is provided by the
+ /// SymbolFile plug-in and can be any value that allows
+ /// the plug-in to quickly find and parse more detailed
+ /// information when and if more information is needed.
+ ///
+ /// @param[in] func_type_uid
+ /// The type UID for the function Type to allow for lazy type
+ /// parsing from the debug information.
+ ///
+ /// @param[in] mangled
+ /// The optional mangled name for this function. If empty, there
+ /// is no mangled information.
+ ///
+ /// @param[in] func_type
+ /// The optional function type. If NULL, the function type will
+ /// be parsed on demand when accessed using the
+ /// Function::GetType() function by asking the SymbolFile
+ /// plug-in to get the type for \a func_type_uid.
+ ///
+ /// @param[in] range
+ /// The section offset based address for this function.
+ //------------------------------------------------------------------
+ Function(CompileUnit *comp_unit, lldb::user_id_t func_uid,
+ lldb::user_id_t func_type_uid, const char *mangled, Type *func_type,
+ const AddressRange &range);
+
+ //------------------------------------------------------------------
+ /// Destructor.
+ //------------------------------------------------------------------
+ ~Function() override;
+
+ //------------------------------------------------------------------
+ /// @copydoc SymbolContextScope::CalculateSymbolContext(SymbolContext*)
+ ///
+ /// @see SymbolContextScope
+ //------------------------------------------------------------------
+ void CalculateSymbolContext(SymbolContext *sc) override;
+
+ lldb::ModuleSP CalculateSymbolContextModule() override;
+
+ CompileUnit *CalculateSymbolContextCompileUnit() override;
+
+ Function *CalculateSymbolContextFunction() override;
+
+ const AddressRange &GetAddressRange() { return m_range; }
+
+ lldb::LanguageType GetLanguage() const;
+ //------------------------------------------------------------------
+ /// Find the file and line number of the source location of the start
+ /// of the function. This will use the declaration if present and fall
+ /// back on the line table if that fails. So there may NOT be a line
+ /// table entry for this source file/line combo.
+ ///
+ /// @param[out] source_file
+ /// The source file.
+ ///
+ /// @param[out] line_no
+ /// The line number.
+ //------------------------------------------------------------------
+ void GetStartLineSourceInfo(FileSpec &source_file, uint32_t &line_no);
+
+ //------------------------------------------------------------------
+ /// Find the file and line number of the source location of the end
+ /// of the function.
+ ///
+ ///
+ /// @param[out] source_file
+ /// The source file.
+ ///
+ /// @param[out] line_no
+ /// The line number.
+ //------------------------------------------------------------------
+ void GetEndLineSourceInfo(FileSpec &source_file, uint32_t &line_no);
+
+ //------------------------------------------------------------------
+ /// Get accessor for the block list.
+ ///
+ /// @return
+ /// The block list object that describes all lexical blocks
+ /// in the function.
+ ///
+ /// @see BlockList
+ //------------------------------------------------------------------
+ Block &GetBlock(bool can_create);
+
+ //------------------------------------------------------------------
+ /// Get accessor for the compile unit that owns this function.
+ ///
+ /// @return
+ /// A compile unit object pointer.
+ //------------------------------------------------------------------
+ CompileUnit *GetCompileUnit();
+
+ //------------------------------------------------------------------
+ /// Get const accessor for the compile unit that owns this function.
+ ///
+ /// @return
+ /// A const compile unit object pointer.
+ //------------------------------------------------------------------
+ const CompileUnit *GetCompileUnit() const;
+
+ void GetDescription(Stream *s, lldb::DescriptionLevel level, Target *target);
+
+ //------------------------------------------------------------------
+ /// Get accessor for the frame base location.
+ ///
+ /// @return
+ /// A location expression that describes the function frame
+ /// base.
+ //------------------------------------------------------------------
+ DWARFExpression &GetFrameBaseExpression() { return m_frame_base; }
+
+ //------------------------------------------------------------------
+ /// Get const accessor for the frame base location.
+ ///
+ /// @return
+ /// A const compile unit object pointer.
+ //------------------------------------------------------------------
+ const DWARFExpression &GetFrameBaseExpression() const { return m_frame_base; }
+
+ ConstString GetName() const;
+
+ ConstString GetNameNoArguments() const;
+
+ ConstString GetDisplayName() const;
+
+ const Mangled &GetMangled() const { return m_mangled; }
+
+ //------------------------------------------------------------------
+ /// Get the DeclContext for this function, if available.
+ ///
+ /// @return
+ /// The DeclContext, or NULL if none exists.
+ //------------------------------------------------------------------
+ CompilerDeclContext GetDeclContext();
+
+ //------------------------------------------------------------------
+ /// Get accessor for the type that describes the function
+ /// return value type, and parameter types.
+ ///
+ /// @return
+ /// A type object pointer.
+ //------------------------------------------------------------------
+ Type *GetType();
+
+ //------------------------------------------------------------------
+ /// Get const accessor for the type that describes the function
+ /// return value type, and parameter types.
+ ///
+ /// @return
+ /// A const type object pointer.
+ //------------------------------------------------------------------
+ const Type *GetType() const;
+
+ CompilerType GetCompilerType();
+
+ //------------------------------------------------------------------
+ /// Get the size of the prologue instructions for this function. The
+ /// "prologue"
+ /// instructions include any instructions given line number 0 immediately
+ /// following
+ /// the prologue end.
+ ///
+ /// @return
+ /// The size of the prologue.
+ //------------------------------------------------------------------
+ uint32_t GetPrologueByteSize();
+
+ //------------------------------------------------------------------
+ /// Dump a description of this object to a Stream.
+ ///
+ /// Dump a description of the contents of this object to the
+ /// supplied stream \a s.
+ ///
+ /// @param[in] s
+ /// The stream to which to dump the object description.
+ ///
+ /// @param[in] show_context
+ /// If \b true, variables will dump their symbol context
+ /// information.
+ //------------------------------------------------------------------
+ void Dump(Stream *s, bool show_context) const;
+
+ //------------------------------------------------------------------
+ /// @copydoc SymbolContextScope::DumpSymbolContext(Stream*)
+ ///
+ /// @see SymbolContextScope
+ //------------------------------------------------------------------
+ void DumpSymbolContext(Stream *s) override;
+
+ //------------------------------------------------------------------
+ /// Get the memory cost of this object.
+ ///
+ /// @return
+ /// The number of bytes that this object occupies in memory.
+ /// The returned value does not include the bytes for any
+ /// shared string values.
+ ///
+ /// @see ConstString::StaticMemorySize ()
+ //------------------------------------------------------------------
+ size_t MemorySize() const;
+
+ //------------------------------------------------------------------
+ /// Get whether compiler optimizations were enabled for this function
+ ///
+ /// The debug information may provide information about whether this
+ /// function was compiled with optimization or not. In this case,
+ /// "optimized" means that the debug experience may be difficult
+ /// for the user to understand. Variables may not be available when
+ /// the developer would expect them, stepping through the source lines
+ /// in the function may appear strange, etc.
+ ///
+ /// @return
+ /// Returns 'true' if this function was compiled with
+ /// optimization. 'false' indicates that either the optimization
+ /// is unknown, or this function was built without optimization.
+ //------------------------------------------------------------------
+ bool GetIsOptimized();
+
+ //------------------------------------------------------------------
+ /// Get whether this function represents a 'top-level' function
+ ///
+ /// The concept of a top-level function is language-specific, mostly
+ /// meant to represent the notion of scripting-style code that has
+ /// global visibility of the variables/symbols/functions/...
+ /// defined within the containing file/module
+ ///
+ /// If stopped in a top-level function, LLDB will expose global variables
+ /// as-if locals in the 'frame variable' command
+ ///
+ /// @return
+ /// Returns 'true' if this function is a top-level function,
+ /// 'false' otherwise.
+ //------------------------------------------------------------------
+ bool IsTopLevelFunction();
+
+ lldb::DisassemblerSP GetInstructions(const ExecutionContext &exe_ctx,
+ const char *flavor,
+ bool prefer_file_cache);
-protected:
+ bool GetDisassembly(const ExecutionContext &exe_ctx, const char *flavor,
+ bool prefer_file_cache, Stream &strm);
- enum
- {
- flagsCalculatedPrologueSize = (1 << 0) ///< Have we already tried to calculate the prologue size?
- };
-
- //------------------------------------------------------------------
- // Member variables.
- //------------------------------------------------------------------
- CompileUnit *m_comp_unit; ///< The compile unit that owns this function.
- lldb::user_id_t m_type_uid; ///< The user ID of for the prototype Type for this function.
- Type * m_type; ///< The function prototype type for this function that include the function info (FunctionInfo), return type and parameters.
- Mangled m_mangled; ///< The mangled function name if any, if empty, there is no mangled information.
- Block m_block; ///< All lexical blocks contained in this function.
- AddressRange m_range; ///< The function address range that covers the widest range needed to contain all blocks
- DWARFExpression m_frame_base; ///< The frame base expression for variables that are relative to the frame pointer.
- Flags m_flags;
- uint32_t m_prologue_byte_size; ///< Compute the prologue size once and cache it
+protected:
+ enum {
+ flagsCalculatedPrologueSize =
+ (1 << 0) ///< Have we already tried to calculate the prologue size?
+ };
+
+ //------------------------------------------------------------------
+ // Member variables.
+ //------------------------------------------------------------------
+ CompileUnit *m_comp_unit; ///< The compile unit that owns this function.
+ lldb::user_id_t
+ m_type_uid; ///< The user ID of for the prototype Type for this function.
+ Type *m_type; ///< The function prototype type for this function that include
+ ///the function info (FunctionInfo), return type and parameters.
+ Mangled m_mangled; ///< The mangled function name if any, if empty, there is
+ ///no mangled information.
+ Block m_block; ///< All lexical blocks contained in this function.
+ AddressRange m_range; ///< The function address range that covers the widest
+ ///range needed to contain all blocks
+ DWARFExpression m_frame_base; ///< The frame base expression for variables
+ ///that are relative to the frame pointer.
+ Flags m_flags;
+ uint32_t
+ m_prologue_byte_size; ///< Compute the prologue size once and cache it
private:
- DISALLOW_COPY_AND_ASSIGN(Function);
+ DISALLOW_COPY_AND_ASSIGN(Function);
};
} // namespace lldb_private
Modified: lldb/trunk/include/lldb/Symbol/GoASTContext.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Symbol/GoASTContext.h?rev=280751&r1=280750&r2=280751&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Symbol/GoASTContext.h (original)
+++ lldb/trunk/include/lldb/Symbol/GoASTContext.h Tue Sep 6 15:57:50 2016
@@ -21,379 +21,408 @@
// Other libraries and framework includes
// Project includes
#include "lldb/Core/ConstString.h"
-#include "lldb/Symbol/TypeSystem.h"
#include "lldb/Symbol/CompilerType.h"
+#include "lldb/Symbol/TypeSystem.h"
-namespace lldb_private
-{
+namespace lldb_private {
class Declaration;
class GoType;
-class GoASTContext : public TypeSystem
-{
- public:
- GoASTContext();
- ~GoASTContext() override;
+class GoASTContext : public TypeSystem {
+public:
+ GoASTContext();
+ ~GoASTContext() override;
+
+ //------------------------------------------------------------------
+ // PluginInterface functions
+ //------------------------------------------------------------------
+ ConstString GetPluginName() override;
+
+ uint32_t GetPluginVersion() override;
+
+ static ConstString GetPluginNameStatic();
+
+ static lldb::TypeSystemSP CreateInstance(lldb::LanguageType language,
+ Module *module, Target *target);
- //------------------------------------------------------------------
- // PluginInterface functions
- //------------------------------------------------------------------
- ConstString
- GetPluginName() override;
+ static void EnumerateSupportedLanguages(
+ std::set<lldb::LanguageType> &languages_for_types,
+ std::set<lldb::LanguageType> &languages_for_expressions);
- uint32_t
- GetPluginVersion() override;
+ static void Initialize();
- static ConstString
- GetPluginNameStatic ();
+ static void Terminate();
- static lldb::TypeSystemSP
- CreateInstance (lldb::LanguageType language, Module *module, Target *target);
-
- static void
- EnumerateSupportedLanguages(std::set<lldb::LanguageType> &languages_for_types, std::set<lldb::LanguageType> &languages_for_expressions);
+ DWARFASTParser *GetDWARFParser() override;
- static void
- Initialize ();
+ void SetAddressByteSize(int byte_size) { m_pointer_byte_size = byte_size; }
- static void
- Terminate ();
-
- DWARFASTParser *GetDWARFParser() override;
+ //------------------------------------------------------------------
+ // llvm casting support
+ //------------------------------------------------------------------
+ static bool classof(const TypeSystem *ts) {
+ return ts->getKind() == TypeSystem::eKindGo;
+ }
- void
- SetAddressByteSize(int byte_size)
- {
- m_pointer_byte_size = byte_size;
- }
+ //----------------------------------------------------------------------
+ // CompilerDecl functions
+ //----------------------------------------------------------------------
+ ConstString DeclGetName(void *opaque_decl) override { return ConstString(); }
- //------------------------------------------------------------------
- // llvm casting support
- //------------------------------------------------------------------
- static bool classof(const TypeSystem *ts)
- {
- return ts->getKind() == TypeSystem::eKindGo;
- }
+ //----------------------------------------------------------------------
+ // CompilerDeclContext functions
+ //----------------------------------------------------------------------
- //----------------------------------------------------------------------
- // CompilerDecl functions
- //----------------------------------------------------------------------
- ConstString
- DeclGetName (void *opaque_decl) override
- {
- return ConstString();
- }
+ bool DeclContextIsStructUnionOrClass(void *opaque_decl_ctx) override {
+ return false;
+ }
- //----------------------------------------------------------------------
- // CompilerDeclContext functions
- //----------------------------------------------------------------------
-
- bool
- DeclContextIsStructUnionOrClass(void *opaque_decl_ctx) override
- {
- return false;
- }
+ ConstString DeclContextGetName(void *opaque_decl_ctx) override {
+ return ConstString();
+ }
- ConstString
- DeclContextGetName(void *opaque_decl_ctx) override
- {
- return ConstString();
- }
+ ConstString DeclContextGetScopeQualifiedName(void *opaque_decl_ctx) override {
+ return ConstString();
+ }
- ConstString
- DeclContextGetScopeQualifiedName(void *opaque_decl_ctx) override
- {
- return ConstString();
- }
+ bool
+ DeclContextIsClassMethod(void *opaque_decl_ctx,
+ lldb::LanguageType *language_ptr,
+ bool *is_instance_method_ptr,
+ ConstString *language_object_name_ptr) override {
+ return false;
+ }
- bool
- DeclContextIsClassMethod(void *opaque_decl_ctx, lldb::LanguageType *language_ptr, bool *is_instance_method_ptr,
- ConstString *language_object_name_ptr) override
- {
- return false;
- }
+ //----------------------------------------------------------------------
+ // Creating Types
+ //----------------------------------------------------------------------
- //----------------------------------------------------------------------
- // Creating Types
- //----------------------------------------------------------------------
+ CompilerType CreateArrayType(const ConstString &name,
+ const CompilerType &element_type,
+ uint64_t length);
- CompilerType CreateArrayType(const ConstString &name, const CompilerType &element_type, uint64_t length);
+ CompilerType CreateBaseType(int go_kind,
+ const ConstString &type_name_const_str,
+ uint64_t byte_size);
- CompilerType CreateBaseType(int go_kind, const ConstString &type_name_const_str, uint64_t byte_size);
+ // For interface, map, chan.
+ CompilerType CreateTypedefType(int kind, const ConstString &name,
+ CompilerType impl);
- // For interface, map, chan.
- CompilerType CreateTypedefType(int kind, const ConstString &name, CompilerType impl);
+ CompilerType CreateVoidType(const ConstString &name);
+ CompilerType CreateFunctionType(const lldb_private::ConstString &name,
+ CompilerType *params, size_t params_count,
+ bool is_variadic);
- CompilerType CreateVoidType(const ConstString &name);
- CompilerType CreateFunctionType(const lldb_private::ConstString &name, CompilerType *params, size_t params_count,
- bool is_variadic);
+ CompilerType CreateStructType(int kind, const ConstString &name,
+ uint32_t byte_size);
- CompilerType CreateStructType(int kind, const ConstString &name, uint32_t byte_size);
+ void CompleteStructType(const CompilerType &type);
- void CompleteStructType(const CompilerType &type);
+ void AddFieldToStruct(const CompilerType &struct_type,
+ const ConstString &name, const CompilerType &field_type,
+ uint32_t byte_offset);
- void AddFieldToStruct(const CompilerType &struct_type, const ConstString &name, const CompilerType &field_type,
- uint32_t byte_offset);
+ //----------------------------------------------------------------------
+ // Tests
+ //----------------------------------------------------------------------
- //----------------------------------------------------------------------
- // Tests
- //----------------------------------------------------------------------
+ static bool IsGoString(const CompilerType &type);
+ static bool IsGoSlice(const CompilerType &type);
+ static bool IsGoInterface(const CompilerType &type);
+ static bool IsDirectIface(uint8_t kind);
+ static bool IsPointerKind(uint8_t kind);
- static bool IsGoString(const CompilerType &type);
- static bool IsGoSlice(const CompilerType &type);
- static bool IsGoInterface(const CompilerType &type);
- static bool IsDirectIface(uint8_t kind);
- static bool IsPointerKind(uint8_t kind);
+ bool IsArrayType(lldb::opaque_compiler_type_t type,
+ CompilerType *element_type, uint64_t *size,
+ bool *is_incomplete) override;
- bool IsArrayType(lldb::opaque_compiler_type_t type, CompilerType *element_type, uint64_t *size, bool *is_incomplete) override;
+ bool IsAggregateType(lldb::opaque_compiler_type_t type) override;
- bool IsAggregateType(lldb::opaque_compiler_type_t type) override;
+ bool IsCharType(lldb::opaque_compiler_type_t type) override;
- bool IsCharType(lldb::opaque_compiler_type_t type) override;
+ bool IsCompleteType(lldb::opaque_compiler_type_t type) override;
- bool IsCompleteType(lldb::opaque_compiler_type_t type) override;
+ bool IsDefined(lldb::opaque_compiler_type_t type) override;
- bool IsDefined(lldb::opaque_compiler_type_t type) override;
+ bool IsFloatingPointType(lldb::opaque_compiler_type_t type, uint32_t &count,
+ bool &is_complex) override;
- bool IsFloatingPointType(lldb::opaque_compiler_type_t type, uint32_t &count, bool &is_complex) override;
+ bool IsFunctionType(lldb::opaque_compiler_type_t type,
+ bool *is_variadic_ptr = nullptr) override;
- bool IsFunctionType(lldb::opaque_compiler_type_t type, bool *is_variadic_ptr = nullptr) override;
+ size_t
+ GetNumberOfFunctionArguments(lldb::opaque_compiler_type_t type) override;
- size_t GetNumberOfFunctionArguments(lldb::opaque_compiler_type_t type) override;
+ CompilerType GetFunctionArgumentAtIndex(lldb::opaque_compiler_type_t type,
+ const size_t index) override;
- CompilerType GetFunctionArgumentAtIndex(lldb::opaque_compiler_type_t type, const size_t index) override;
+ bool IsFunctionPointerType(lldb::opaque_compiler_type_t type) override;
- bool IsFunctionPointerType(lldb::opaque_compiler_type_t type) override;
-
- bool IsBlockPointerType (lldb::opaque_compiler_type_t type, CompilerType *function_pointer_type_ptr) override;
+ bool IsBlockPointerType(lldb::opaque_compiler_type_t type,
+ CompilerType *function_pointer_type_ptr) override;
- bool IsIntegerType(lldb::opaque_compiler_type_t type, bool &is_signed) override;
+ bool IsIntegerType(lldb::opaque_compiler_type_t type,
+ bool &is_signed) override;
- bool IsPossibleDynamicType(lldb::opaque_compiler_type_t type,
- CompilerType *target_type, // Can pass nullptr
- bool check_cplusplus, bool check_objc) override;
+ bool IsPossibleDynamicType(lldb::opaque_compiler_type_t type,
+ CompilerType *target_type, // Can pass nullptr
+ bool check_cplusplus, bool check_objc) override;
- bool IsPointerType(lldb::opaque_compiler_type_t type, CompilerType *pointee_type = nullptr) override;
+ bool IsPointerType(lldb::opaque_compiler_type_t type,
+ CompilerType *pointee_type = nullptr) override;
- bool IsScalarType(lldb::opaque_compiler_type_t type) override;
+ bool IsScalarType(lldb::opaque_compiler_type_t type) override;
- bool IsVoidType(lldb::opaque_compiler_type_t type) override;
+ bool IsVoidType(lldb::opaque_compiler_type_t type) override;
- bool SupportsLanguage (lldb::LanguageType language) override;
+ bool SupportsLanguage(lldb::LanguageType language) override;
- //----------------------------------------------------------------------
- // Type Completion
- //----------------------------------------------------------------------
+ //----------------------------------------------------------------------
+ // Type Completion
+ //----------------------------------------------------------------------
- bool GetCompleteType(lldb::opaque_compiler_type_t type) override;
+ bool GetCompleteType(lldb::opaque_compiler_type_t type) override;
- //----------------------------------------------------------------------
- // AST related queries
- //----------------------------------------------------------------------
+ //----------------------------------------------------------------------
+ // AST related queries
+ //----------------------------------------------------------------------
- uint32_t GetPointerByteSize() override;
+ uint32_t GetPointerByteSize() override;
- //----------------------------------------------------------------------
- // Accessors
- //----------------------------------------------------------------------
+ //----------------------------------------------------------------------
+ // Accessors
+ //----------------------------------------------------------------------
- ConstString GetTypeName(lldb::opaque_compiler_type_t type) override;
+ ConstString GetTypeName(lldb::opaque_compiler_type_t type) override;
- uint32_t GetTypeInfo(lldb::opaque_compiler_type_t type,
- CompilerType *pointee_or_element_compiler_type = nullptr) override;
+ uint32_t GetTypeInfo(
+ lldb::opaque_compiler_type_t type,
+ CompilerType *pointee_or_element_compiler_type = nullptr) override;
- lldb::LanguageType GetMinimumLanguage(lldb::opaque_compiler_type_t type) override;
+ lldb::LanguageType
+ GetMinimumLanguage(lldb::opaque_compiler_type_t type) override;
- lldb::TypeClass GetTypeClass(lldb::opaque_compiler_type_t type) override;
+ lldb::TypeClass GetTypeClass(lldb::opaque_compiler_type_t type) override;
- //----------------------------------------------------------------------
- // Creating related types
- //----------------------------------------------------------------------
+ //----------------------------------------------------------------------
+ // Creating related types
+ //----------------------------------------------------------------------
- CompilerType GetArrayElementType(lldb::opaque_compiler_type_t type, uint64_t *stride = nullptr) override;
+ CompilerType GetArrayElementType(lldb::opaque_compiler_type_t type,
+ uint64_t *stride = nullptr) override;
- CompilerType GetCanonicalType(lldb::opaque_compiler_type_t type) override;
+ CompilerType GetCanonicalType(lldb::opaque_compiler_type_t type) override;
- // Returns -1 if this isn't a function of if the function doesn't have a prototype
- // Returns a value >= 0 if there is a prototype.
- int GetFunctionArgumentCount(lldb::opaque_compiler_type_t type) override;
+ // Returns -1 if this isn't a function of if the function doesn't have a
+ // prototype
+ // Returns a value >= 0 if there is a prototype.
+ int GetFunctionArgumentCount(lldb::opaque_compiler_type_t type) override;
- CompilerType GetFunctionArgumentTypeAtIndex(lldb::opaque_compiler_type_t type, size_t idx) override;
+ CompilerType GetFunctionArgumentTypeAtIndex(lldb::opaque_compiler_type_t type,
+ size_t idx) override;
- CompilerType GetFunctionReturnType(lldb::opaque_compiler_type_t type) override;
+ CompilerType
+ GetFunctionReturnType(lldb::opaque_compiler_type_t type) override;
- size_t GetNumMemberFunctions(lldb::opaque_compiler_type_t type) override;
+ size_t GetNumMemberFunctions(lldb::opaque_compiler_type_t type) override;
- TypeMemberFunctionImpl GetMemberFunctionAtIndex(lldb::opaque_compiler_type_t type, size_t idx) override;
+ TypeMemberFunctionImpl
+ GetMemberFunctionAtIndex(lldb::opaque_compiler_type_t type,
+ size_t idx) override;
- CompilerType GetPointeeType(lldb::opaque_compiler_type_t type) override;
+ CompilerType GetPointeeType(lldb::opaque_compiler_type_t type) override;
- CompilerType GetPointerType(lldb::opaque_compiler_type_t type) override;
+ CompilerType GetPointerType(lldb::opaque_compiler_type_t type) override;
- //----------------------------------------------------------------------
- // Exploring the type
- //----------------------------------------------------------------------
+ //----------------------------------------------------------------------
+ // Exploring the type
+ //----------------------------------------------------------------------
- uint64_t GetBitSize(lldb::opaque_compiler_type_t type, ExecutionContextScope *exe_scope) override;
+ uint64_t GetBitSize(lldb::opaque_compiler_type_t type,
+ ExecutionContextScope *exe_scope) override;
- lldb::Encoding GetEncoding(lldb::opaque_compiler_type_t type, uint64_t &count) override;
+ lldb::Encoding GetEncoding(lldb::opaque_compiler_type_t type,
+ uint64_t &count) override;
- lldb::Format GetFormat(lldb::opaque_compiler_type_t type) override;
+ lldb::Format GetFormat(lldb::opaque_compiler_type_t type) override;
- uint32_t GetNumChildren(lldb::opaque_compiler_type_t type, bool omit_empty_base_classes) override;
+ uint32_t GetNumChildren(lldb::opaque_compiler_type_t type,
+ bool omit_empty_base_classes) override;
- lldb::BasicType GetBasicTypeEnumeration(lldb::opaque_compiler_type_t type) override;
+ lldb::BasicType
+ GetBasicTypeEnumeration(lldb::opaque_compiler_type_t type) override;
- CompilerType GetBuiltinTypeForEncodingAndBitSize(lldb::Encoding encoding, size_t bit_size) override;
+ CompilerType GetBuiltinTypeForEncodingAndBitSize(lldb::Encoding encoding,
+ size_t bit_size) override;
- uint32_t GetNumFields(lldb::opaque_compiler_type_t type) override;
+ uint32_t GetNumFields(lldb::opaque_compiler_type_t type) override;
- CompilerType GetFieldAtIndex(lldb::opaque_compiler_type_t type, size_t idx, std::string &name, uint64_t *bit_offset_ptr,
- uint32_t *bitfield_bit_size_ptr, bool *is_bitfield_ptr) override;
+ CompilerType GetFieldAtIndex(lldb::opaque_compiler_type_t type, size_t idx,
+ std::string &name, uint64_t *bit_offset_ptr,
+ uint32_t *bitfield_bit_size_ptr,
+ bool *is_bitfield_ptr) override;
- uint32_t
- GetNumDirectBaseClasses(lldb::opaque_compiler_type_t type) override
- {
- return 0;
- }
+ uint32_t GetNumDirectBaseClasses(lldb::opaque_compiler_type_t type) override {
+ return 0;
+ }
- uint32_t
- GetNumVirtualBaseClasses(lldb::opaque_compiler_type_t type) override
- {
- return 0;
- }
+ uint32_t
+ GetNumVirtualBaseClasses(lldb::opaque_compiler_type_t type) override {
+ return 0;
+ }
- CompilerType
- GetDirectBaseClassAtIndex(lldb::opaque_compiler_type_t type, size_t idx, uint32_t *bit_offset_ptr) override
- {
- return CompilerType();
- }
+ CompilerType GetDirectBaseClassAtIndex(lldb::opaque_compiler_type_t type,
+ size_t idx,
+ uint32_t *bit_offset_ptr) override {
+ return CompilerType();
+ }
- CompilerType
- GetVirtualBaseClassAtIndex(lldb::opaque_compiler_type_t type, size_t idx, uint32_t *bit_offset_ptr) override
- {
- return CompilerType();
- }
+ CompilerType GetVirtualBaseClassAtIndex(lldb::opaque_compiler_type_t type,
+ size_t idx,
+ uint32_t *bit_offset_ptr) override {
+ return CompilerType();
+ }
- CompilerType GetChildCompilerTypeAtIndex(lldb::opaque_compiler_type_t type, ExecutionContext *exe_ctx, size_t idx,
- bool transparent_pointers, bool omit_empty_base_classes,
- bool ignore_array_bounds, std::string &child_name,
- uint32_t &child_byte_size, int32_t &child_byte_offset,
- uint32_t &child_bitfield_bit_size,
- uint32_t &child_bitfield_bit_offset, bool &child_is_base_class,
- bool &child_is_deref_of_parent, ValueObject *valobj, uint64_t &language_flags) override;
+ CompilerType GetChildCompilerTypeAtIndex(
+ lldb::opaque_compiler_type_t type, ExecutionContext *exe_ctx, size_t idx,
+ bool transparent_pointers, bool omit_empty_base_classes,
+ bool ignore_array_bounds, std::string &child_name,
+ uint32_t &child_byte_size, int32_t &child_byte_offset,
+ uint32_t &child_bitfield_bit_size, uint32_t &child_bitfield_bit_offset,
+ bool &child_is_base_class, bool &child_is_deref_of_parent,
+ ValueObject *valobj, uint64_t &language_flags) override;
- // Lookup a child given a name. This function will match base class names
- // and member member names in "clang_type" only, not descendants.
- uint32_t GetIndexOfChildWithName(lldb::opaque_compiler_type_t type, const char *name, bool omit_empty_base_classes) override;
+ // Lookup a child given a name. This function will match base class names
+ // and member member names in "clang_type" only, not descendants.
+ uint32_t GetIndexOfChildWithName(lldb::opaque_compiler_type_t type,
+ const char *name,
+ bool omit_empty_base_classes) override;
- // Lookup a child member given a name. This function will match member names
- // only and will descend into "clang_type" children in search for the first
- // member in this class, or any base class that matches "name".
- // TODO: Return all matches for a given name by returning a vector<vector<uint32_t>>
- // so we catch all names that match a given child name, not just the first.
- size_t GetIndexOfChildMemberWithName(lldb::opaque_compiler_type_t type, const char *name, bool omit_empty_base_classes,
- std::vector<uint32_t> &child_indexes) override;
+ // Lookup a child member given a name. This function will match member names
+ // only and will descend into "clang_type" children in search for the first
+ // member in this class, or any base class that matches "name".
+ // TODO: Return all matches for a given name by returning a
+ // vector<vector<uint32_t>>
+ // so we catch all names that match a given child name, not just the first.
+ size_t
+ GetIndexOfChildMemberWithName(lldb::opaque_compiler_type_t type,
+ const char *name, bool omit_empty_base_classes,
+ std::vector<uint32_t> &child_indexes) override;
- size_t
- GetNumTemplateArguments(lldb::opaque_compiler_type_t type) override
- {
- return 0;
- }
+ size_t GetNumTemplateArguments(lldb::opaque_compiler_type_t type) override {
+ return 0;
+ }
- CompilerType
- GetTemplateArgument(lldb::opaque_compiler_type_t type, size_t idx, lldb::TemplateArgumentKind &kind) override
- {
- return CompilerType();
- }
+ CompilerType GetTemplateArgument(lldb::opaque_compiler_type_t type,
+ size_t idx,
+ lldb::TemplateArgumentKind &kind) override {
+ return CompilerType();
+ }
- //----------------------------------------------------------------------
- // Dumping types
- //----------------------------------------------------------------------
- void DumpValue(lldb::opaque_compiler_type_t type, ExecutionContext *exe_ctx, Stream *s, lldb::Format format,
- const DataExtractor &data, lldb::offset_t data_offset, size_t data_byte_size,
- uint32_t bitfield_bit_size, uint32_t bitfield_bit_offset, bool show_types, bool show_summary,
- bool verbose, uint32_t depth) override;
+ //----------------------------------------------------------------------
+ // Dumping types
+ //----------------------------------------------------------------------
+ void DumpValue(lldb::opaque_compiler_type_t type, ExecutionContext *exe_ctx,
+ Stream *s, lldb::Format format, const DataExtractor &data,
+ lldb::offset_t data_offset, size_t data_byte_size,
+ uint32_t bitfield_bit_size, uint32_t bitfield_bit_offset,
+ bool show_types, bool show_summary, bool verbose,
+ uint32_t depth) override;
- bool DumpTypeValue(lldb::opaque_compiler_type_t type, Stream *s, lldb::Format format, const DataExtractor &data,
- lldb::offset_t data_offset, size_t data_byte_size, uint32_t bitfield_bit_size,
- uint32_t bitfield_bit_offset, ExecutionContextScope *exe_scope) override;
+ bool DumpTypeValue(lldb::opaque_compiler_type_t type, Stream *s,
+ lldb::Format format, const DataExtractor &data,
+ lldb::offset_t data_offset, size_t data_byte_size,
+ uint32_t bitfield_bit_size, uint32_t bitfield_bit_offset,
+ ExecutionContextScope *exe_scope) override;
- void DumpTypeDescription(lldb::opaque_compiler_type_t type) override; // Dump to stdout
+ void DumpTypeDescription(
+ lldb::opaque_compiler_type_t type) override; // Dump to stdout
- void DumpTypeDescription(lldb::opaque_compiler_type_t type, Stream *s) override;
+ void DumpTypeDescription(lldb::opaque_compiler_type_t type,
+ Stream *s) override;
- //----------------------------------------------------------------------
- // TODO: These methods appear unused. Should they be removed?
- //----------------------------------------------------------------------
+ //----------------------------------------------------------------------
+ // TODO: These methods appear unused. Should they be removed?
+ //----------------------------------------------------------------------
- bool IsRuntimeGeneratedType(lldb::opaque_compiler_type_t type) override;
+ bool IsRuntimeGeneratedType(lldb::opaque_compiler_type_t type) override;
- void DumpSummary(lldb::opaque_compiler_type_t type, ExecutionContext *exe_ctx, Stream *s, const DataExtractor &data,
- lldb::offset_t data_offset, size_t data_byte_size) override;
+ void DumpSummary(lldb::opaque_compiler_type_t type, ExecutionContext *exe_ctx,
+ Stream *s, const DataExtractor &data,
+ lldb::offset_t data_offset, size_t data_byte_size) override;
- // Converts "s" to a floating point value and place resulting floating
- // point bytes in the "dst" buffer.
- size_t ConvertStringToFloatValue(lldb::opaque_compiler_type_t type, const char *s, uint8_t *dst, size_t dst_size) override;
+ // Converts "s" to a floating point value and place resulting floating
+ // point bytes in the "dst" buffer.
+ size_t ConvertStringToFloatValue(lldb::opaque_compiler_type_t type,
+ const char *s, uint8_t *dst,
+ size_t dst_size) override;
- //----------------------------------------------------------------------
- // TODO: Determine if these methods should move to ClangASTContext.
- //----------------------------------------------------------------------
+ //----------------------------------------------------------------------
+ // TODO: Determine if these methods should move to ClangASTContext.
+ //----------------------------------------------------------------------
- bool IsPointerOrReferenceType(lldb::opaque_compiler_type_t type,
- CompilerType *pointee_type = nullptr) override;
+ bool IsPointerOrReferenceType(lldb::opaque_compiler_type_t type,
+ CompilerType *pointee_type = nullptr) override;
- unsigned GetTypeQualifiers(lldb::opaque_compiler_type_t type) override;
+ unsigned GetTypeQualifiers(lldb::opaque_compiler_type_t type) override;
- bool IsCStringType(lldb::opaque_compiler_type_t type, uint32_t &length) override;
+ bool IsCStringType(lldb::opaque_compiler_type_t type,
+ uint32_t &length) override;
- size_t GetTypeBitAlign(lldb::opaque_compiler_type_t type) override;
+ size_t GetTypeBitAlign(lldb::opaque_compiler_type_t type) override;
- CompilerType GetBasicTypeFromAST(lldb::BasicType basic_type) override;
+ CompilerType GetBasicTypeFromAST(lldb::BasicType basic_type) override;
- bool IsBeingDefined(lldb::opaque_compiler_type_t type) override;
+ bool IsBeingDefined(lldb::opaque_compiler_type_t type) override;
- bool IsConst(lldb::opaque_compiler_type_t type) override;
+ bool IsConst(lldb::opaque_compiler_type_t type) override;
- uint32_t IsHomogeneousAggregate(lldb::opaque_compiler_type_t type, CompilerType *base_type_ptr) override;
+ uint32_t IsHomogeneousAggregate(lldb::opaque_compiler_type_t type,
+ CompilerType *base_type_ptr) override;
- bool IsPolymorphicClass(lldb::opaque_compiler_type_t type) override;
+ bool IsPolymorphicClass(lldb::opaque_compiler_type_t type) override;
- bool IsTypedefType(lldb::opaque_compiler_type_t type) override;
+ bool IsTypedefType(lldb::opaque_compiler_type_t type) override;
- // If the current object represents a typedef type, get the underlying type
- CompilerType GetTypedefedType(lldb::opaque_compiler_type_t type) override;
+ // If the current object represents a typedef type, get the underlying type
+ CompilerType GetTypedefedType(lldb::opaque_compiler_type_t type) override;
- bool IsVectorType(lldb::opaque_compiler_type_t type, CompilerType *element_type, uint64_t *size) override;
+ bool IsVectorType(lldb::opaque_compiler_type_t type,
+ CompilerType *element_type, uint64_t *size) override;
- CompilerType GetFullyUnqualifiedType(lldb::opaque_compiler_type_t type) override;
+ CompilerType
+ GetFullyUnqualifiedType(lldb::opaque_compiler_type_t type) override;
- CompilerType GetNonReferenceType(lldb::opaque_compiler_type_t type) override;
+ CompilerType GetNonReferenceType(lldb::opaque_compiler_type_t type) override;
- bool IsReferenceType(lldb::opaque_compiler_type_t type, CompilerType *pointee_type = nullptr, bool *is_rvalue = nullptr) override;
+ bool IsReferenceType(lldb::opaque_compiler_type_t type,
+ CompilerType *pointee_type = nullptr,
+ bool *is_rvalue = nullptr) override;
- private:
- typedef std::map<ConstString, std::unique_ptr<GoType>> TypeMap;
- int m_pointer_byte_size;
- int m_int_byte_size;
- std::unique_ptr<TypeMap> m_types;
- std::unique_ptr<DWARFASTParser> m_dwarf_ast_parser_ap;
+private:
+ typedef std::map<ConstString, std::unique_ptr<GoType>> TypeMap;
+ int m_pointer_byte_size;
+ int m_int_byte_size;
+ std::unique_ptr<TypeMap> m_types;
+ std::unique_ptr<DWARFASTParser> m_dwarf_ast_parser_ap;
- GoASTContext(const GoASTContext &) = delete;
- const GoASTContext &operator=(const GoASTContext &) = delete;
+ GoASTContext(const GoASTContext &) = delete;
+ const GoASTContext &operator=(const GoASTContext &) = delete;
};
-class GoASTContextForExpr : public GoASTContext
-{
- public:
- GoASTContextForExpr(lldb::TargetSP target) : m_target_wp(target) {}
- UserExpression *GetUserExpression(const char *expr, const char *expr_prefix, lldb::LanguageType language,
- Expression::ResultType desired_type,
- const EvaluateExpressionOptions &options) override;
+class GoASTContextForExpr : public GoASTContext {
+public:
+ GoASTContextForExpr(lldb::TargetSP target) : m_target_wp(target) {}
+ UserExpression *
+ GetUserExpression(const char *expr, const char *expr_prefix,
+ lldb::LanguageType language,
+ Expression::ResultType desired_type,
+ const EvaluateExpressionOptions &options) override;
- private:
- lldb::TargetWP m_target_wp;
+private:
+ lldb::TargetWP m_target_wp;
};
}
#endif // liblldb_GoASTContext_h_
Modified: lldb/trunk/include/lldb/Symbol/JavaASTContext.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Symbol/JavaASTContext.h?rev=280751&r1=280750&r2=280751&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Symbol/JavaASTContext.h (original)
+++ lldb/trunk/include/lldb/Symbol/JavaASTContext.h Tue Sep 6 15:57:50 2016
@@ -21,365 +21,334 @@
#include "lldb/Core/ConstString.h"
#include "lldb/Symbol/TypeSystem.h"
-namespace lldb_private
-{
+namespace lldb_private {
-class JavaASTContext : public TypeSystem
-{
+class JavaASTContext : public TypeSystem {
public:
- class JavaType;
- typedef std::map<ConstString, std::unique_ptr<JavaType>> JavaTypeMap;
+ class JavaType;
+ typedef std::map<ConstString, std::unique_ptr<JavaType>> JavaTypeMap;
- JavaASTContext(const ArchSpec &arch);
- ~JavaASTContext() override;
+ JavaASTContext(const ArchSpec &arch);
+ ~JavaASTContext() override;
- //------------------------------------------------------------------
- // PluginInterface functions
- //------------------------------------------------------------------
- ConstString
- GetPluginName() override;
+ //------------------------------------------------------------------
+ // PluginInterface functions
+ //------------------------------------------------------------------
+ ConstString GetPluginName() override;
- uint32_t
- GetPluginVersion() override;
+ uint32_t GetPluginVersion() override;
- static ConstString
- GetPluginNameStatic();
+ static ConstString GetPluginNameStatic();
- static lldb::TypeSystemSP
- CreateInstance(lldb::LanguageType language, Module *module, Target *target);
+ static lldb::TypeSystemSP CreateInstance(lldb::LanguageType language,
+ Module *module, Target *target);
- static void
- EnumerateSupportedLanguages(std::set<lldb::LanguageType> &languages_for_types,
- std::set<lldb::LanguageType> &languages_for_expressions);
+ static void EnumerateSupportedLanguages(
+ std::set<lldb::LanguageType> &languages_for_types,
+ std::set<lldb::LanguageType> &languages_for_expressions);
- static void
- Initialize();
+ static void Initialize();
- static void
- Terminate();
+ static void Terminate();
- DWARFASTParser *
- GetDWARFParser() override;
+ DWARFASTParser *GetDWARFParser() override;
- uint32_t
- GetPointerByteSize() override;
+ uint32_t GetPointerByteSize() override;
- //----------------------------------------------------------------------
- // CompilerDecl functions
- //----------------------------------------------------------------------
- ConstString
- DeclGetName(void *opaque_decl) override;
+ //----------------------------------------------------------------------
+ // CompilerDecl functions
+ //----------------------------------------------------------------------
+ ConstString DeclGetName(void *opaque_decl) override;
- //----------------------------------------------------------------------
- // CompilerDeclContext functions
- //----------------------------------------------------------------------
+ //----------------------------------------------------------------------
+ // CompilerDeclContext functions
+ //----------------------------------------------------------------------
- std::vector<CompilerDecl>
- DeclContextFindDeclByName(void *opaque_decl_ctx, ConstString name, const bool ignore_imported_decls) override;
+ std::vector<CompilerDecl>
+ DeclContextFindDeclByName(void *opaque_decl_ctx, ConstString name,
+ const bool ignore_imported_decls) override;
- bool
- DeclContextIsStructUnionOrClass(void *opaque_decl_ctx) override;
+ bool DeclContextIsStructUnionOrClass(void *opaque_decl_ctx) override;
- ConstString
- DeclContextGetName(void *opaque_decl_ctx) override;
+ ConstString DeclContextGetName(void *opaque_decl_ctx) override;
- bool
- DeclContextIsClassMethod(void *opaque_decl_ctx, lldb::LanguageType *language_ptr, bool *is_instance_method_ptr,
- ConstString *language_object_name_ptr) override;
+ bool DeclContextIsClassMethod(void *opaque_decl_ctx,
+ lldb::LanguageType *language_ptr,
+ bool *is_instance_method_ptr,
+ ConstString *language_object_name_ptr) override;
- //----------------------------------------------------------------------
- // Tests
- //----------------------------------------------------------------------
+ //----------------------------------------------------------------------
+ // Tests
+ //----------------------------------------------------------------------
- bool
- IsArrayType(lldb::opaque_compiler_type_t type, CompilerType *element_type, uint64_t *size,
- bool *is_incomplete) override;
+ bool IsArrayType(lldb::opaque_compiler_type_t type,
+ CompilerType *element_type, uint64_t *size,
+ bool *is_incomplete) override;
- bool
- IsAggregateType(lldb::opaque_compiler_type_t type) override;
+ bool IsAggregateType(lldb::opaque_compiler_type_t type) override;
- bool
- IsCharType(lldb::opaque_compiler_type_t type) override;
+ bool IsCharType(lldb::opaque_compiler_type_t type) override;
- bool
- IsFloatingPointType(lldb::opaque_compiler_type_t type, uint32_t &count, bool &is_complex) override;
+ bool IsFloatingPointType(lldb::opaque_compiler_type_t type, uint32_t &count,
+ bool &is_complex) override;
- bool
- IsFunctionType(lldb::opaque_compiler_type_t type, bool *is_variadic_ptr = nullptr) override;
+ bool IsFunctionType(lldb::opaque_compiler_type_t type,
+ bool *is_variadic_ptr = nullptr) override;
- size_t
- GetNumberOfFunctionArguments(lldb::opaque_compiler_type_t type) override;
+ size_t
+ GetNumberOfFunctionArguments(lldb::opaque_compiler_type_t type) override;
- CompilerType
- GetFunctionArgumentAtIndex(lldb::opaque_compiler_type_t type, const size_t index) override;
+ CompilerType GetFunctionArgumentAtIndex(lldb::opaque_compiler_type_t type,
+ const size_t index) override;
- bool
- IsFunctionPointerType(lldb::opaque_compiler_type_t type) override;
-
- bool
- IsBlockPointerType (lldb::opaque_compiler_type_t type, CompilerType *function_pointer_type_ptr) override;
+ bool IsFunctionPointerType(lldb::opaque_compiler_type_t type) override;
- bool
- IsIntegerType(lldb::opaque_compiler_type_t type, bool &is_signed) override;
+ bool IsBlockPointerType(lldb::opaque_compiler_type_t type,
+ CompilerType *function_pointer_type_ptr) override;
- bool
- IsPossibleDynamicType(lldb::opaque_compiler_type_t type, CompilerType *target_type, bool check_cplusplus,
- bool check_objc) override;
+ bool IsIntegerType(lldb::opaque_compiler_type_t type,
+ bool &is_signed) override;
- bool
- IsPointerType(lldb::opaque_compiler_type_t type, CompilerType *pointee_type = nullptr) override;
+ bool IsPossibleDynamicType(lldb::opaque_compiler_type_t type,
+ CompilerType *target_type, bool check_cplusplus,
+ bool check_objc) override;
- bool
- IsReferenceType(lldb::opaque_compiler_type_t type, CompilerType *pointee_type = nullptr,
- bool *is_rvalue = nullptr) override;
+ bool IsPointerType(lldb::opaque_compiler_type_t type,
+ CompilerType *pointee_type = nullptr) override;
- bool
- IsPointerOrReferenceType(lldb::opaque_compiler_type_t type, CompilerType *pointee_type = nullptr) override;
+ bool IsReferenceType(lldb::opaque_compiler_type_t type,
+ CompilerType *pointee_type = nullptr,
+ bool *is_rvalue = nullptr) override;
- bool
- IsScalarType(lldb::opaque_compiler_type_t type) override;
+ bool IsPointerOrReferenceType(lldb::opaque_compiler_type_t type,
+ CompilerType *pointee_type = nullptr) override;
- bool
- IsVoidType(lldb::opaque_compiler_type_t type) override;
+ bool IsScalarType(lldb::opaque_compiler_type_t type) override;
- bool
- IsCStringType(lldb::opaque_compiler_type_t type, uint32_t &length) override;
+ bool IsVoidType(lldb::opaque_compiler_type_t type) override;
- bool
- IsRuntimeGeneratedType(lldb::opaque_compiler_type_t type) override;
+ bool IsCStringType(lldb::opaque_compiler_type_t type,
+ uint32_t &length) override;
- bool
- IsTypedefType(lldb::opaque_compiler_type_t type) override;
+ bool IsRuntimeGeneratedType(lldb::opaque_compiler_type_t type) override;
- bool
- IsVectorType(lldb::opaque_compiler_type_t type, CompilerType *element_type, uint64_t *size) override;
+ bool IsTypedefType(lldb::opaque_compiler_type_t type) override;
- bool
- IsPolymorphicClass(lldb::opaque_compiler_type_t type) override;
+ bool IsVectorType(lldb::opaque_compiler_type_t type,
+ CompilerType *element_type, uint64_t *size) override;
- bool
- IsCompleteType(lldb::opaque_compiler_type_t type) override;
+ bool IsPolymorphicClass(lldb::opaque_compiler_type_t type) override;
- bool
- IsConst(lldb::opaque_compiler_type_t type) override;
+ bool IsCompleteType(lldb::opaque_compiler_type_t type) override;
- bool
- IsBeingDefined(lldb::opaque_compiler_type_t type) override;
+ bool IsConst(lldb::opaque_compiler_type_t type) override;
- bool
- IsDefined(lldb::opaque_compiler_type_t type) override;
+ bool IsBeingDefined(lldb::opaque_compiler_type_t type) override;
- uint32_t
- IsHomogeneousAggregate(lldb::opaque_compiler_type_t type, CompilerType *base_type_ptr) override;
+ bool IsDefined(lldb::opaque_compiler_type_t type) override;
- bool
- SupportsLanguage(lldb::LanguageType language) override;
+ uint32_t IsHomogeneousAggregate(lldb::opaque_compiler_type_t type,
+ CompilerType *base_type_ptr) override;
- bool
- GetCompleteType(lldb::opaque_compiler_type_t type) override;
+ bool SupportsLanguage(lldb::LanguageType language) override;
- ConstString
- GetTypeName(lldb::opaque_compiler_type_t type) override;
+ bool GetCompleteType(lldb::opaque_compiler_type_t type) override;
- uint32_t
- GetTypeInfo(lldb::opaque_compiler_type_t type, CompilerType *pointee_or_element_compiler_type = nullptr) override;
+ ConstString GetTypeName(lldb::opaque_compiler_type_t type) override;
- lldb::TypeClass
- GetTypeClass(lldb::opaque_compiler_type_t type) override;
+ uint32_t GetTypeInfo(
+ lldb::opaque_compiler_type_t type,
+ CompilerType *pointee_or_element_compiler_type = nullptr) override;
- lldb::LanguageType
- GetMinimumLanguage(lldb::opaque_compiler_type_t type) override;
+ lldb::TypeClass GetTypeClass(lldb::opaque_compiler_type_t type) override;
- CompilerType
- GetArrayElementType(lldb::opaque_compiler_type_t type, uint64_t *stride = nullptr) override;
+ lldb::LanguageType
+ GetMinimumLanguage(lldb::opaque_compiler_type_t type) override;
- CompilerType
- GetPointeeType(lldb::opaque_compiler_type_t type) override;
+ CompilerType GetArrayElementType(lldb::opaque_compiler_type_t type,
+ uint64_t *stride = nullptr) override;
- CompilerType
- GetPointerType(lldb::opaque_compiler_type_t type) override;
+ CompilerType GetPointeeType(lldb::opaque_compiler_type_t type) override;
- CompilerType
- GetCanonicalType(lldb::opaque_compiler_type_t type) override;
+ CompilerType GetPointerType(lldb::opaque_compiler_type_t type) override;
- CompilerType
- GetFullyUnqualifiedType(lldb::opaque_compiler_type_t type) override;
+ CompilerType GetCanonicalType(lldb::opaque_compiler_type_t type) override;
- CompilerType
- GetNonReferenceType(lldb::opaque_compiler_type_t type) override;
+ CompilerType
+ GetFullyUnqualifiedType(lldb::opaque_compiler_type_t type) override;
- CompilerType
- GetTypedefedType(lldb::opaque_compiler_type_t type) override;
+ CompilerType GetNonReferenceType(lldb::opaque_compiler_type_t type) override;
- CompilerType
- GetBasicTypeFromAST(lldb::BasicType basic_type) override;
+ CompilerType GetTypedefedType(lldb::opaque_compiler_type_t type) override;
- CompilerType
- GetBuiltinTypeForEncodingAndBitSize(lldb::Encoding encoding, size_t bit_size) override;
+ CompilerType GetBasicTypeFromAST(lldb::BasicType basic_type) override;
- size_t
- GetTypeBitAlign(lldb::opaque_compiler_type_t type) override;
+ CompilerType GetBuiltinTypeForEncodingAndBitSize(lldb::Encoding encoding,
+ size_t bit_size) override;
- lldb::BasicType
- GetBasicTypeEnumeration(lldb::opaque_compiler_type_t type) override;
+ size_t GetTypeBitAlign(lldb::opaque_compiler_type_t type) override;
- uint64_t
- GetBitSize(lldb::opaque_compiler_type_t type, ExecutionContextScope *exe_scope) override;
+ lldb::BasicType
+ GetBasicTypeEnumeration(lldb::opaque_compiler_type_t type) override;
- lldb::Encoding
- GetEncoding(lldb::opaque_compiler_type_t type, uint64_t &count) override;
+ uint64_t GetBitSize(lldb::opaque_compiler_type_t type,
+ ExecutionContextScope *exe_scope) override;
- lldb::Format
- GetFormat(lldb::opaque_compiler_type_t type) override;
+ lldb::Encoding GetEncoding(lldb::opaque_compiler_type_t type,
+ uint64_t &count) override;
- unsigned
- GetTypeQualifiers(lldb::opaque_compiler_type_t type) override;
+ lldb::Format GetFormat(lldb::opaque_compiler_type_t type) override;
- size_t
- GetNumTemplateArguments(lldb::opaque_compiler_type_t type) override;
+ unsigned GetTypeQualifiers(lldb::opaque_compiler_type_t type) override;
- CompilerType
- GetTemplateArgument(lldb::opaque_compiler_type_t type, size_t idx, lldb::TemplateArgumentKind &kind) override;
+ size_t GetNumTemplateArguments(lldb::opaque_compiler_type_t type) override;
- int
- GetFunctionArgumentCount(lldb::opaque_compiler_type_t type) override;
+ CompilerType GetTemplateArgument(lldb::opaque_compiler_type_t type,
+ size_t idx,
+ lldb::TemplateArgumentKind &kind) override;
- CompilerType
- GetFunctionArgumentTypeAtIndex(lldb::opaque_compiler_type_t type, size_t idx) override;
+ int GetFunctionArgumentCount(lldb::opaque_compiler_type_t type) override;
- CompilerType
- GetFunctionReturnType(lldb::opaque_compiler_type_t type) override;
+ CompilerType GetFunctionArgumentTypeAtIndex(lldb::opaque_compiler_type_t type,
+ size_t idx) override;
- size_t
- GetNumMemberFunctions(lldb::opaque_compiler_type_t type) override;
+ CompilerType
+ GetFunctionReturnType(lldb::opaque_compiler_type_t type) override;
- TypeMemberFunctionImpl
- GetMemberFunctionAtIndex(lldb::opaque_compiler_type_t type, size_t idx) override;
+ size_t GetNumMemberFunctions(lldb::opaque_compiler_type_t type) override;
- uint32_t
- GetNumFields(lldb::opaque_compiler_type_t type) override;
+ TypeMemberFunctionImpl
+ GetMemberFunctionAtIndex(lldb::opaque_compiler_type_t type,
+ size_t idx) override;
- CompilerType
- GetFieldAtIndex(lldb::opaque_compiler_type_t type, size_t idx, std::string &name, uint64_t *bit_offset_ptr,
- uint32_t *bitfield_bit_size_ptr, bool *is_bitfield_ptr) override;
+ uint32_t GetNumFields(lldb::opaque_compiler_type_t type) override;
- uint32_t
- GetNumChildren(lldb::opaque_compiler_type_t type, bool omit_empty_base_classes) override;
+ CompilerType GetFieldAtIndex(lldb::opaque_compiler_type_t type, size_t idx,
+ std::string &name, uint64_t *bit_offset_ptr,
+ uint32_t *bitfield_bit_size_ptr,
+ bool *is_bitfield_ptr) override;
- uint32_t
- GetNumDirectBaseClasses(lldb::opaque_compiler_type_t type) override;
+ uint32_t GetNumChildren(lldb::opaque_compiler_type_t type,
+ bool omit_empty_base_classes) override;
- uint32_t
- GetNumVirtualBaseClasses(lldb::opaque_compiler_type_t type) override;
+ uint32_t GetNumDirectBaseClasses(lldb::opaque_compiler_type_t type) override;
- CompilerType
- GetDirectBaseClassAtIndex(lldb::opaque_compiler_type_t type, size_t idx, uint32_t *bit_offset_ptr) override;
+ uint32_t GetNumVirtualBaseClasses(lldb::opaque_compiler_type_t type) override;
- CompilerType
- GetVirtualBaseClassAtIndex(lldb::opaque_compiler_type_t type, size_t idx, uint32_t *bit_offset_ptr) override;
+ CompilerType GetDirectBaseClassAtIndex(lldb::opaque_compiler_type_t type,
+ size_t idx,
+ uint32_t *bit_offset_ptr) override;
- size_t
- ConvertStringToFloatValue(lldb::opaque_compiler_type_t type, const char *s, uint8_t *dst, size_t dst_size) override;
+ CompilerType GetVirtualBaseClassAtIndex(lldb::opaque_compiler_type_t type,
+ size_t idx,
+ uint32_t *bit_offset_ptr) override;
- void
- DumpValue(lldb::opaque_compiler_type_t type, ExecutionContext *exe_ctx, Stream *s, lldb::Format format,
- const DataExtractor &data, lldb::offset_t data_offset, size_t data_byte_size, uint32_t bitfield_bit_size,
- uint32_t bitfield_bit_offset, bool show_types, bool show_summary, bool verbose, uint32_t depth) override;
+ size_t ConvertStringToFloatValue(lldb::opaque_compiler_type_t type,
+ const char *s, uint8_t *dst,
+ size_t dst_size) override;
- bool
- DumpTypeValue(lldb::opaque_compiler_type_t type, Stream *s, lldb::Format format, const DataExtractor &data,
- lldb::offset_t data_offset, size_t data_byte_size, uint32_t bitfield_bit_size,
- uint32_t bitfield_bit_offset, ExecutionContextScope *exe_scope) override;
+ void DumpValue(lldb::opaque_compiler_type_t type, ExecutionContext *exe_ctx,
+ Stream *s, lldb::Format format, const DataExtractor &data,
+ lldb::offset_t data_offset, size_t data_byte_size,
+ uint32_t bitfield_bit_size, uint32_t bitfield_bit_offset,
+ bool show_types, bool show_summary, bool verbose,
+ uint32_t depth) override;
- void
- DumpTypeDescription(lldb::opaque_compiler_type_t type) override;
+ bool DumpTypeValue(lldb::opaque_compiler_type_t type, Stream *s,
+ lldb::Format format, const DataExtractor &data,
+ lldb::offset_t data_offset, size_t data_byte_size,
+ uint32_t bitfield_bit_size, uint32_t bitfield_bit_offset,
+ ExecutionContextScope *exe_scope) override;
- void
- DumpTypeDescription(lldb::opaque_compiler_type_t type, Stream *s) override;
+ void DumpTypeDescription(lldb::opaque_compiler_type_t type) override;
- void
- DumpSummary(lldb::opaque_compiler_type_t type, ExecutionContext *exe_ctx, Stream *s, const DataExtractor &data,
- lldb::offset_t data_offset, size_t data_byte_size) override;
+ void DumpTypeDescription(lldb::opaque_compiler_type_t type,
+ Stream *s) override;
- CompilerType
- GetChildCompilerTypeAtIndex(lldb::opaque_compiler_type_t type, ExecutionContext *exe_ctx, size_t idx,
- bool transparent_pointers, bool omit_empty_base_classes, bool ignore_array_bounds,
- std::string &child_name, uint32_t &child_byte_size, int32_t &child_byte_offset,
- uint32_t &child_bitfield_bit_size, uint32_t &child_bitfield_bit_offset,
- bool &child_is_base_class, bool &child_is_deref_of_parent, ValueObject *valobj,
- uint64_t &language_flags) override;
+ void DumpSummary(lldb::opaque_compiler_type_t type, ExecutionContext *exe_ctx,
+ Stream *s, const DataExtractor &data,
+ lldb::offset_t data_offset, size_t data_byte_size) override;
- uint32_t
- GetIndexOfChildWithName(lldb::opaque_compiler_type_t type, const char *name, bool omit_empty_base_classes) override;
+ CompilerType GetChildCompilerTypeAtIndex(
+ lldb::opaque_compiler_type_t type, ExecutionContext *exe_ctx, size_t idx,
+ bool transparent_pointers, bool omit_empty_base_classes,
+ bool ignore_array_bounds, std::string &child_name,
+ uint32_t &child_byte_size, int32_t &child_byte_offset,
+ uint32_t &child_bitfield_bit_size, uint32_t &child_bitfield_bit_offset,
+ bool &child_is_base_class, bool &child_is_deref_of_parent,
+ ValueObject *valobj, uint64_t &language_flags) override;
- size_t
- GetIndexOfChildMemberWithName(lldb::opaque_compiler_type_t type, const char *name, bool omit_empty_base_classes,
- std::vector<uint32_t> &child_indexes) override;
+ uint32_t GetIndexOfChildWithName(lldb::opaque_compiler_type_t type,
+ const char *name,
+ bool omit_empty_base_classes) override;
- CompilerType
- GetLValueReferenceType(lldb::opaque_compiler_type_t type) override;
+ size_t
+ GetIndexOfChildMemberWithName(lldb::opaque_compiler_type_t type,
+ const char *name, bool omit_empty_base_classes,
+ std::vector<uint32_t> &child_indexes) override;
- ConstString
- DeclContextGetScopeQualifiedName(lldb::opaque_compiler_type_t opaque_decl_ctx) override;
+ CompilerType
+ GetLValueReferenceType(lldb::opaque_compiler_type_t type) override;
- CompilerType
- CreateBaseType(const ConstString &name);
+ ConstString DeclContextGetScopeQualifiedName(
+ lldb::opaque_compiler_type_t opaque_decl_ctx) override;
- CompilerType
- CreateObjectType(const ConstString &name, const ConstString &linkage_name, uint32_t byte_size);
+ CompilerType CreateBaseType(const ConstString &name);
- CompilerType
- CreateArrayType(const ConstString &linkage_name, const CompilerType &element_type,
- const DWARFExpression &length_expression, const lldb::addr_t data_offset);
+ CompilerType CreateObjectType(const ConstString &name,
+ const ConstString &linkage_name,
+ uint32_t byte_size);
- CompilerType
- CreateReferenceType(const CompilerType &pointee_type);
+ CompilerType CreateArrayType(const ConstString &linkage_name,
+ const CompilerType &element_type,
+ const DWARFExpression &length_expression,
+ const lldb::addr_t data_offset);
- void
- CompleteObjectType(const CompilerType &object_type);
+ CompilerType CreateReferenceType(const CompilerType &pointee_type);
- void
- AddBaseClassToObject(const CompilerType &object_type, const CompilerType &member_type, uint32_t member_offset);
+ void CompleteObjectType(const CompilerType &object_type);
- void
- AddMemberToObject(const CompilerType &object_type, const ConstString &name, const CompilerType &member_type,
- uint32_t member_offset);
+ void AddBaseClassToObject(const CompilerType &object_type,
+ const CompilerType &member_type,
+ uint32_t member_offset);
- void
- SetDynamicTypeId(const CompilerType &type, const DWARFExpression &type_id);
+ void AddMemberToObject(const CompilerType &object_type,
+ const ConstString &name,
+ const CompilerType &member_type,
+ uint32_t member_offset);
- static uint64_t
- CalculateDynamicTypeId(ExecutionContext *exe_ctx, const CompilerType &type, ValueObject &in_value);
+ void SetDynamicTypeId(const CompilerType &type,
+ const DWARFExpression &type_id);
- static ConstString
- GetLinkageName(const CompilerType &type);
+ static uint64_t CalculateDynamicTypeId(ExecutionContext *exe_ctx,
+ const CompilerType &type,
+ ValueObject &in_value);
- static uint32_t
- CalculateArraySize(const CompilerType &type, ValueObject &in_value);
+ static ConstString GetLinkageName(const CompilerType &type);
- static uint64_t
- CalculateArrayElementOffset(const CompilerType &type, size_t index);
+ static uint32_t CalculateArraySize(const CompilerType &type,
+ ValueObject &in_value);
- //------------------------------------------------------------------
- // llvm casting support
- //------------------------------------------------------------------
- static bool
- classof(const TypeSystem *ts)
- {
- return ts->getKind() == TypeSystem::eKindJava;
- }
+ static uint64_t CalculateArrayElementOffset(const CompilerType &type,
+ size_t index);
+
+ //------------------------------------------------------------------
+ // llvm casting support
+ //------------------------------------------------------------------
+ static bool classof(const TypeSystem *ts) {
+ return ts->getKind() == TypeSystem::eKindJava;
+ }
private:
- uint32_t m_pointer_byte_size;
- std::unique_ptr<DWARFASTParser> m_dwarf_ast_parser_ap;
- JavaTypeMap m_array_type_map;
- JavaTypeMap m_base_type_map;
- JavaTypeMap m_reference_type_map;
- JavaTypeMap m_object_type_map;
-
- JavaASTContext(const JavaASTContext &) = delete;
- const JavaASTContext &
- operator=(const JavaASTContext &) = delete;
+ uint32_t m_pointer_byte_size;
+ std::unique_ptr<DWARFASTParser> m_dwarf_ast_parser_ap;
+ JavaTypeMap m_array_type_map;
+ JavaTypeMap m_base_type_map;
+ JavaTypeMap m_reference_type_map;
+ JavaTypeMap m_object_type_map;
+
+ JavaASTContext(const JavaASTContext &) = delete;
+ const JavaASTContext &operator=(const JavaASTContext &) = delete;
};
}
#endif // liblldb_JavaASTContext_h_
Modified: lldb/trunk/include/lldb/Symbol/LineEntry.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Symbol/LineEntry.h?rev=280751&r1=280750&r2=280751&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Symbol/LineEntry.h (original)
+++ lldb/trunk/include/lldb/Symbol/LineEntry.h Tue Sep 6 15:57:50 2016
@@ -10,9 +10,9 @@
#ifndef liblldb_LineEntry_h_
#define liblldb_LineEntry_h_
-#include "lldb/lldb-private.h"
#include "lldb/Core/AddressRange.h"
#include "lldb/Host/FileSpec.h"
+#include "lldb/lldb-private.h"
namespace lldb_private {
@@ -20,176 +20,167 @@ namespace lldb_private {
/// @class LineEntry LineEntry.h "lldb/Symbol/LineEntry.h"
/// @brief A line table entry class.
//----------------------------------------------------------------------
-struct LineEntry
-{
- //------------------------------------------------------------------
- /// Default constructor.
- ///
- /// Initialize all member variables to invalid values.
- //------------------------------------------------------------------
- LineEntry ();
-
- LineEntry
- (
- const lldb::SectionSP §ion_sp,
- lldb::addr_t section_offset,
- lldb::addr_t byte_size,
- const FileSpec &file,
- uint32_t _line,
- uint16_t _column,
- bool _is_start_of_statement,
- bool _is_start_of_basic_block,
- bool _is_prologue_end,
- bool _is_epilogue_begin,
- bool _is_terminal_entry
- );
-
- //------------------------------------------------------------------
- /// Clear the object's state.
- ///
- /// Clears all member variables to invalid values.
- //------------------------------------------------------------------
- void
- Clear ();
-
- //------------------------------------------------------------------
- /// Dump a description of this object to a Stream.
- ///
- /// Dump a description of the contents of this object to the
- /// supplied stream \a s.
- ///
- /// @param[in] s
- /// The stream to which to dump the object description.
- ///
- /// @param[in] comp_unit
- /// The compile unit object that contains the support file
- /// list so the line entry can dump the file name (since this
- /// object contains a file index into the support file list).
- ///
- /// @param[in] show_file
- /// If \b true, display the filename with the line entry which
- /// requires that the compile unit object \a comp_unit be a
- /// valid pointer.
- ///
- /// @param[in] style
- /// The display style for the section offset address.
- ///
- /// @return
- /// Returns \b true if the address was able to be displayed
- /// using \a style. File and load addresses may be unresolved
- /// and it may not be possible to display a valid address value.
- /// Returns \b false if the address was not able to be properly
- /// dumped.
- ///
- /// @see Address::DumpStyle
- //------------------------------------------------------------------
- bool
- Dump (Stream *s, Target *target, bool show_file, Address::DumpStyle style, Address::DumpStyle fallback_style, bool show_range) const;
-
- bool
- GetDescription (Stream *s,
- lldb::DescriptionLevel level,
- CompileUnit* cu,
- Target *target,
- bool show_address_only) const;
-
- //------------------------------------------------------------------
- /// Dumps information specific to a process that stops at this
- /// line entry to the supplied stream \a s.
- ///
- /// @param[in] s
- /// The stream to which to dump the object description.
- ///
- /// @param[in] comp_unit
- /// The compile unit object that contains the support file
- /// list so the line entry can dump the file name (since this
- /// object contains a file index into the support file list).
- ///
- /// @return
- /// Returns \b true if the file and line were properly dumped,
- /// \b false otherwise.
- //------------------------------------------------------------------
- bool
- DumpStopContext (Stream *s, bool show_fullpaths) const;
-
- //------------------------------------------------------------------
- /// Check if a line entry object is valid.
- ///
- /// @return
- /// Returns \b true if the line entry contains a valid section
- /// offset address, file index, and line number, \b false
- /// otherwise.
- //------------------------------------------------------------------
- bool
- IsValid () const;
-
- //------------------------------------------------------------------
- /// Compare two LineEntry objects.
- ///
- /// @param[in] lhs
- /// The Left Hand Side const LineEntry object reference.
- ///
- /// @param[in] rhs
- /// The Right Hand Side const LineEntry object reference.
- ///
- /// @return
- /// @li -1 if lhs < rhs
- /// @li 0 if lhs == rhs
- /// @li 1 if lhs > rhs
- //------------------------------------------------------------------
- static int
- Compare (const LineEntry& lhs, const LineEntry& rhs);
-
- //------------------------------------------------------------------
- /// Give the range for this LineEntry + any additional LineEntries for
- /// this same source line that are contiguous.
- ///
- /// A compiler may emit multiple line entries for a single source line,
- /// e.g. to indicate subexpressions at different columns. This method
- /// will get the AddressRange for all of the LineEntries for this source
- /// line that are contiguous.
- //
- /// Line entries with a line number of 0 are treated specially - these
- /// are compiler-generated line table entries that the user did not
- /// write in their source code, and we want to skip past in the debugger.
- /// If this LineEntry is for line 32, and the following LineEntry is for
- /// line 0, we will extend the range to include the AddressRange of the
- /// line 0 LineEntry (and it will include the range of the following
- /// LineEntries that match either 32 or 0.)
- ///
- /// If the initial LineEntry this method is called on is a line #0, only
- /// the range of contiuous LineEntries with line #0 will be included in
- /// the complete range.
- ///
- /// @return
- /// The contiguous AddressRange for this source line.
- //------------------------------------------------------------------
- AddressRange
- GetSameLineContiguousAddressRange () const;
-
- //------------------------------------------------------------------
- /// Apply file mappings from target.source-map to the LineEntry's file.
- ///
- /// @param[in] target_sp
- /// Shared pointer to the target this LineEntry belongs to.
- //------------------------------------------------------------------
-
- void
- ApplyFileMappings(lldb::TargetSP target_sp);
-
- //------------------------------------------------------------------
- // Member variables.
- //------------------------------------------------------------------
- AddressRange range; ///< The section offset address range for this line entry.
- FileSpec file; ///< The source file, possibly mapped by the target.source-map setting
- FileSpec original_file; ///< The original source file, from debug info.
- uint32_t line; ///< The source line number, or zero if there is no line number information.
- uint16_t column; ///< The column number of the source line, or zero if there is no column information.
- uint16_t is_start_of_statement:1, ///< Indicates this entry is the beginning of a statement.
- is_start_of_basic_block:1, ///< Indicates this entry is the beginning of a basic block.
- is_prologue_end:1, ///< Indicates this entry is one (of possibly many) where execution should be suspended for an entry breakpoint of a function.
- is_epilogue_begin:1, ///< Indicates this entry is one (of possibly many) where execution should be suspended for an exit breakpoint of a function.
- is_terminal_entry:1; ///< Indicates this entry is that of the first byte after the end of a sequence of target machine instructions.
+struct LineEntry {
+ //------------------------------------------------------------------
+ /// Default constructor.
+ ///
+ /// Initialize all member variables to invalid values.
+ //------------------------------------------------------------------
+ LineEntry();
+
+ LineEntry(const lldb::SectionSP §ion_sp, lldb::addr_t section_offset,
+ lldb::addr_t byte_size, const FileSpec &file, uint32_t _line,
+ uint16_t _column, bool _is_start_of_statement,
+ bool _is_start_of_basic_block, bool _is_prologue_end,
+ bool _is_epilogue_begin, bool _is_terminal_entry);
+
+ //------------------------------------------------------------------
+ /// Clear the object's state.
+ ///
+ /// Clears all member variables to invalid values.
+ //------------------------------------------------------------------
+ void Clear();
+
+ //------------------------------------------------------------------
+ /// Dump a description of this object to a Stream.
+ ///
+ /// Dump a description of the contents of this object to the
+ /// supplied stream \a s.
+ ///
+ /// @param[in] s
+ /// The stream to which to dump the object description.
+ ///
+ /// @param[in] comp_unit
+ /// The compile unit object that contains the support file
+ /// list so the line entry can dump the file name (since this
+ /// object contains a file index into the support file list).
+ ///
+ /// @param[in] show_file
+ /// If \b true, display the filename with the line entry which
+ /// requires that the compile unit object \a comp_unit be a
+ /// valid pointer.
+ ///
+ /// @param[in] style
+ /// The display style for the section offset address.
+ ///
+ /// @return
+ /// Returns \b true if the address was able to be displayed
+ /// using \a style. File and load addresses may be unresolved
+ /// and it may not be possible to display a valid address value.
+ /// Returns \b false if the address was not able to be properly
+ /// dumped.
+ ///
+ /// @see Address::DumpStyle
+ //------------------------------------------------------------------
+ bool Dump(Stream *s, Target *target, bool show_file, Address::DumpStyle style,
+ Address::DumpStyle fallback_style, bool show_range) const;
+
+ bool GetDescription(Stream *s, lldb::DescriptionLevel level, CompileUnit *cu,
+ Target *target, bool show_address_only) const;
+
+ //------------------------------------------------------------------
+ /// Dumps information specific to a process that stops at this
+ /// line entry to the supplied stream \a s.
+ ///
+ /// @param[in] s
+ /// The stream to which to dump the object description.
+ ///
+ /// @param[in] comp_unit
+ /// The compile unit object that contains the support file
+ /// list so the line entry can dump the file name (since this
+ /// object contains a file index into the support file list).
+ ///
+ /// @return
+ /// Returns \b true if the file and line were properly dumped,
+ /// \b false otherwise.
+ //------------------------------------------------------------------
+ bool DumpStopContext(Stream *s, bool show_fullpaths) const;
+
+ //------------------------------------------------------------------
+ /// Check if a line entry object is valid.
+ ///
+ /// @return
+ /// Returns \b true if the line entry contains a valid section
+ /// offset address, file index, and line number, \b false
+ /// otherwise.
+ //------------------------------------------------------------------
+ bool IsValid() const;
+
+ //------------------------------------------------------------------
+ /// Compare two LineEntry objects.
+ ///
+ /// @param[in] lhs
+ /// The Left Hand Side const LineEntry object reference.
+ ///
+ /// @param[in] rhs
+ /// The Right Hand Side const LineEntry object reference.
+ ///
+ /// @return
+ /// @li -1 if lhs < rhs
+ /// @li 0 if lhs == rhs
+ /// @li 1 if lhs > rhs
+ //------------------------------------------------------------------
+ static int Compare(const LineEntry &lhs, const LineEntry &rhs);
+
+ //------------------------------------------------------------------
+ /// Give the range for this LineEntry + any additional LineEntries for
+ /// this same source line that are contiguous.
+ ///
+ /// A compiler may emit multiple line entries for a single source line,
+ /// e.g. to indicate subexpressions at different columns. This method
+ /// will get the AddressRange for all of the LineEntries for this source
+ /// line that are contiguous.
+ //
+ /// Line entries with a line number of 0 are treated specially - these
+ /// are compiler-generated line table entries that the user did not
+ /// write in their source code, and we want to skip past in the debugger.
+ /// If this LineEntry is for line 32, and the following LineEntry is for
+ /// line 0, we will extend the range to include the AddressRange of the
+ /// line 0 LineEntry (and it will include the range of the following
+ /// LineEntries that match either 32 or 0.)
+ ///
+ /// If the initial LineEntry this method is called on is a line #0, only
+ /// the range of contiuous LineEntries with line #0 will be included in
+ /// the complete range.
+ ///
+ /// @return
+ /// The contiguous AddressRange for this source line.
+ //------------------------------------------------------------------
+ AddressRange GetSameLineContiguousAddressRange() const;
+
+ //------------------------------------------------------------------
+ /// Apply file mappings from target.source-map to the LineEntry's file.
+ ///
+ /// @param[in] target_sp
+ /// Shared pointer to the target this LineEntry belongs to.
+ //------------------------------------------------------------------
+
+ void ApplyFileMappings(lldb::TargetSP target_sp);
+
+ //------------------------------------------------------------------
+ // Member variables.
+ //------------------------------------------------------------------
+ AddressRange range; ///< The section offset address range for this line entry.
+ FileSpec file; ///< The source file, possibly mapped by the target.source-map
+ ///setting
+ FileSpec original_file; ///< The original source file, from debug info.
+ uint32_t line; ///< The source line number, or zero if there is no line number
+ ///information.
+ uint16_t column; ///< The column number of the source line, or zero if there
+ ///is no column information.
+ uint16_t is_start_of_statement : 1, ///< Indicates this entry is the beginning
+ ///of a statement.
+ is_start_of_basic_block : 1, ///< Indicates this entry is the beginning of
+ ///a basic block.
+ is_prologue_end : 1, ///< Indicates this entry is one (of possibly many)
+ ///where execution should be suspended for an entry
+ ///breakpoint of a function.
+ is_epilogue_begin : 1, ///< Indicates this entry is one (of possibly many)
+ ///where execution should be suspended for an exit
+ ///breakpoint of a function.
+ is_terminal_entry : 1; ///< Indicates this entry is that of the first byte
+ ///after the end of a sequence of target machine
+ ///instructions.
};
//------------------------------------------------------------------
@@ -204,8 +195,8 @@ struct LineEntry
/// @return
/// Returns \b true if lhs < rhs, false otherwise.
//------------------------------------------------------------------
-bool operator<(const LineEntry& lhs, const LineEntry& rhs);
+bool operator<(const LineEntry &lhs, const LineEntry &rhs);
} // namespace lldb_private
-#endif // liblldb_LineEntry_h_
+#endif // liblldb_LineEntry_h_
Modified: lldb/trunk/include/lldb/Symbol/LineTable.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Symbol/LineTable.h?rev=280751&r1=280750&r2=280751&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Symbol/LineTable.h (original)
+++ lldb/trunk/include/lldb/Symbol/LineTable.h Tue Sep 6 15:57:50 2016
@@ -16,11 +16,11 @@
// Other libraries and framework includes
// Project includes
-#include "lldb/lldb-private.h"
-#include "lldb/Symbol/LineEntry.h"
#include "lldb/Core/ModuleChild.h"
-#include "lldb/Core/Section.h"
#include "lldb/Core/RangeMap.h"
+#include "lldb/Core/Section.h"
+#include "lldb/Symbol/LineEntry.h"
+#include "lldb/lldb-private.h"
namespace lldb_private {
@@ -28,392 +28,351 @@ namespace lldb_private {
/// @class LineSequence LineTable.h "lldb/Symbol/LineTable.h"
/// @brief An abstract base class used during symbol table creation.
//----------------------------------------------------------------------
-class LineSequence
-{
+class LineSequence {
public:
- LineSequence ();
+ LineSequence();
- virtual
- ~LineSequence() = default;
+ virtual ~LineSequence() = default;
- virtual void
- Clear() = 0;
+ virtual void Clear() = 0;
private:
- DISALLOW_COPY_AND_ASSIGN (LineSequence);
+ DISALLOW_COPY_AND_ASSIGN(LineSequence);
};
//----------------------------------------------------------------------
/// @class LineTable LineTable.h "lldb/Symbol/LineTable.h"
/// @brief A line table class.
//----------------------------------------------------------------------
-class LineTable
-{
+class LineTable {
public:
- //------------------------------------------------------------------
- /// Construct with compile unit.
- ///
- /// @param[in] comp_unit
- /// The compile unit to which this line table belongs.
- //------------------------------------------------------------------
- LineTable (CompileUnit* comp_unit);
-
- //------------------------------------------------------------------
- /// Destructor.
- //------------------------------------------------------------------
- ~LineTable ();
-
- //------------------------------------------------------------------
- /// Adds a new line entry to this line table.
- ///
- /// All line entries are maintained in file address order.
- ///
- /// @param[in] line_entry
- /// A const reference to a new line_entry to add to this line
- /// table.
- ///
- /// @see Address::DumpStyle
- //------------------------------------------------------------------
-// void
-// AddLineEntry (const LineEntry& line_entry);
-
- // Called when you can't guarantee the addresses are in increasing order
- void
- InsertLineEntry (lldb::addr_t file_addr,
- uint32_t line,
- uint16_t column,
- uint16_t file_idx,
- bool is_start_of_statement,
- bool is_start_of_basic_block,
- bool is_prologue_end,
- bool is_epilogue_begin,
- bool is_terminal_entry);
-
- // Used to instantiate the LineSequence helper class
- LineSequence*
- CreateLineSequenceContainer ();
-
- // Append an entry to a caller-provided collection that will later be
- // inserted in this line table.
- void
- AppendLineEntryToSequence (LineSequence* sequence,
- lldb::addr_t file_addr,
- uint32_t line,
- uint16_t column,
- uint16_t file_idx,
- bool is_start_of_statement,
- bool is_start_of_basic_block,
- bool is_prologue_end,
- bool is_epilogue_begin,
- bool is_terminal_entry);
-
- // Insert a sequence of entries into this line table.
- void
- InsertSequence (LineSequence* sequence);
-
- //------------------------------------------------------------------
- /// Dump all line entries in this line table to the stream \a s.
- ///
- /// @param[in] s
- /// The stream to which to dump the object description.
- ///
- /// @param[in] style
- /// The display style for the address.
- ///
- /// @see Address::DumpStyle
- //------------------------------------------------------------------
- void
- Dump (Stream *s, Target *target,
- Address::DumpStyle style,
- Address::DumpStyle fallback_style,
- bool show_line_ranges);
-
- void
- GetDescription (Stream *s,
- Target *target,
- lldb::DescriptionLevel level);
-
- //------------------------------------------------------------------
- /// Find a line entry that contains the section offset address \a
- /// so_addr.
- ///
- /// @param[in] so_addr
- /// A section offset address object containing the address we
- /// are searching for.
- ///
- /// @param[out] line_entry
- /// A copy of the line entry that was found if \b true is
- /// returned, otherwise \a entry is left unmodified.
- ///
- /// @param[out] index_ptr
- /// A pointer to a 32 bit integer that will get the actual line
- /// entry index if it is not nullptr.
- ///
- /// @return
- /// Returns \b true if \a so_addr is contained in a line entry
- /// in this line table, \b false otherwise.
- //------------------------------------------------------------------
- bool
- FindLineEntryByAddress(const Address &so_addr, LineEntry& line_entry, uint32_t *index_ptr = nullptr);
-
- //------------------------------------------------------------------
- /// Find a line entry index that has a matching file index and
- /// source line number.
- ///
- /// Finds the next line entry that has a matching \a file_idx and
- /// source line number \a line starting at the \a start_idx entries
- /// into the line entry collection.
- ///
- /// @param[in] start_idx
- /// The number of entries to skip when starting the search.
- ///
- /// @param[out] file_idx
- /// The file index to search for that should be found prior
- /// to calling this function using the following functions:
- /// CompileUnit::GetSupportFiles()
- /// FileSpecList::FindFileIndex (uint32_t, const FileSpec &) const
- ///
- /// @param[in] line
- /// The source line to match.
- ///
- /// @param[in] exact
- /// If true, match only if you find a line entry exactly matching \a line.
- /// If false, return the closest line entry greater than \a line.
- ///
- /// @param[out] line_entry
- /// A reference to a line entry object that will get a copy of
- /// the line entry if \b true is returned, otherwise \a
- /// line_entry is left untouched.
- ///
- /// @return
- /// Returns \b true if a matching line entry is found in this
- /// line table, \b false otherwise.
- ///
- /// @see CompileUnit::GetSupportFiles()
- /// @see FileSpecList::FindFileIndex (uint32_t, const FileSpec &) const
- //------------------------------------------------------------------
- uint32_t
- FindLineEntryIndexByFileIndex (uint32_t start_idx,
- uint32_t file_idx,
- uint32_t line,
- bool exact,
- LineEntry* line_entry_ptr);
-
- uint32_t
- FindLineEntryIndexByFileIndex (uint32_t start_idx,
- const std::vector<uint32_t> &file_indexes,
- uint32_t line,
- bool exact,
- LineEntry* line_entry_ptr);
-
- size_t
- FineLineEntriesForFileIndex (uint32_t file_idx,
- bool append,
- SymbolContextList &sc_list);
+ //------------------------------------------------------------------
+ /// Construct with compile unit.
+ ///
+ /// @param[in] comp_unit
+ /// The compile unit to which this line table belongs.
+ //------------------------------------------------------------------
+ LineTable(CompileUnit *comp_unit);
+
+ //------------------------------------------------------------------
+ /// Destructor.
+ //------------------------------------------------------------------
+ ~LineTable();
+
+ //------------------------------------------------------------------
+ /// Adds a new line entry to this line table.
+ ///
+ /// All line entries are maintained in file address order.
+ ///
+ /// @param[in] line_entry
+ /// A const reference to a new line_entry to add to this line
+ /// table.
+ ///
+ /// @see Address::DumpStyle
+ //------------------------------------------------------------------
+ // void
+ // AddLineEntry (const LineEntry& line_entry);
+
+ // Called when you can't guarantee the addresses are in increasing order
+ void InsertLineEntry(lldb::addr_t file_addr, uint32_t line, uint16_t column,
+ uint16_t file_idx, bool is_start_of_statement,
+ bool is_start_of_basic_block, bool is_prologue_end,
+ bool is_epilogue_begin, bool is_terminal_entry);
+
+ // Used to instantiate the LineSequence helper class
+ LineSequence *CreateLineSequenceContainer();
+
+ // Append an entry to a caller-provided collection that will later be
+ // inserted in this line table.
+ void AppendLineEntryToSequence(LineSequence *sequence, lldb::addr_t file_addr,
+ uint32_t line, uint16_t column,
+ uint16_t file_idx, bool is_start_of_statement,
+ bool is_start_of_basic_block,
+ bool is_prologue_end, bool is_epilogue_begin,
+ bool is_terminal_entry);
+
+ // Insert a sequence of entries into this line table.
+ void InsertSequence(LineSequence *sequence);
+
+ //------------------------------------------------------------------
+ /// Dump all line entries in this line table to the stream \a s.
+ ///
+ /// @param[in] s
+ /// The stream to which to dump the object description.
+ ///
+ /// @param[in] style
+ /// The display style for the address.
+ ///
+ /// @see Address::DumpStyle
+ //------------------------------------------------------------------
+ void Dump(Stream *s, Target *target, Address::DumpStyle style,
+ Address::DumpStyle fallback_style, bool show_line_ranges);
+
+ void GetDescription(Stream *s, Target *target, lldb::DescriptionLevel level);
+
+ //------------------------------------------------------------------
+ /// Find a line entry that contains the section offset address \a
+ /// so_addr.
+ ///
+ /// @param[in] so_addr
+ /// A section offset address object containing the address we
+ /// are searching for.
+ ///
+ /// @param[out] line_entry
+ /// A copy of the line entry that was found if \b true is
+ /// returned, otherwise \a entry is left unmodified.
+ ///
+ /// @param[out] index_ptr
+ /// A pointer to a 32 bit integer that will get the actual line
+ /// entry index if it is not nullptr.
+ ///
+ /// @return
+ /// Returns \b true if \a so_addr is contained in a line entry
+ /// in this line table, \b false otherwise.
+ //------------------------------------------------------------------
+ bool FindLineEntryByAddress(const Address &so_addr, LineEntry &line_entry,
+ uint32_t *index_ptr = nullptr);
+
+ //------------------------------------------------------------------
+ /// Find a line entry index that has a matching file index and
+ /// source line number.
+ ///
+ /// Finds the next line entry that has a matching \a file_idx and
+ /// source line number \a line starting at the \a start_idx entries
+ /// into the line entry collection.
+ ///
+ /// @param[in] start_idx
+ /// The number of entries to skip when starting the search.
+ ///
+ /// @param[out] file_idx
+ /// The file index to search for that should be found prior
+ /// to calling this function using the following functions:
+ /// CompileUnit::GetSupportFiles()
+ /// FileSpecList::FindFileIndex (uint32_t, const FileSpec &) const
+ ///
+ /// @param[in] line
+ /// The source line to match.
+ ///
+ /// @param[in] exact
+ /// If true, match only if you find a line entry exactly matching \a line.
+ /// If false, return the closest line entry greater than \a line.
+ ///
+ /// @param[out] line_entry
+ /// A reference to a line entry object that will get a copy of
+ /// the line entry if \b true is returned, otherwise \a
+ /// line_entry is left untouched.
+ ///
+ /// @return
+ /// Returns \b true if a matching line entry is found in this
+ /// line table, \b false otherwise.
+ ///
+ /// @see CompileUnit::GetSupportFiles()
+ /// @see FileSpecList::FindFileIndex (uint32_t, const FileSpec &) const
+ //------------------------------------------------------------------
+ uint32_t FindLineEntryIndexByFileIndex(uint32_t start_idx, uint32_t file_idx,
+ uint32_t line, bool exact,
+ LineEntry *line_entry_ptr);
+
+ uint32_t FindLineEntryIndexByFileIndex(
+ uint32_t start_idx, const std::vector<uint32_t> &file_indexes,
+ uint32_t line, bool exact, LineEntry *line_entry_ptr);
+
+ size_t FineLineEntriesForFileIndex(uint32_t file_idx, bool append,
+ SymbolContextList &sc_list);
+
+ //------------------------------------------------------------------
+ /// Get the line entry from the line table at index \a idx.
+ ///
+ /// @param[in] idx
+ /// An index into the line table entry collection.
+ ///
+ /// @return
+ /// A valid line entry if \a idx is a valid index, or an invalid
+ /// line entry if \a idx is not valid.
+ ///
+ /// @see LineTable::GetSize()
+ /// @see LineEntry::IsValid() const
+ //------------------------------------------------------------------
+ bool GetLineEntryAtIndex(uint32_t idx, LineEntry &line_entry);
+
+ //------------------------------------------------------------------
+ /// Gets the size of the line table in number of line table entries.
+ ///
+ /// @return
+ /// The number of line table entries in this line table.
+ //------------------------------------------------------------------
+ uint32_t GetSize() const;
+
+ typedef lldb_private::RangeArray<lldb::addr_t, lldb::addr_t, 32>
+ FileAddressRanges;
+
+ //------------------------------------------------------------------
+ /// Gets all contiguous file address ranges for the entire line table.
+ ///
+ /// @param[out] file_ranges
+ /// A collection of file address ranges that will be filled in
+ /// by this function.
+ ///
+ /// @param[out] append
+ /// If \b true, then append to \a file_ranges, otherwise clear
+ /// \a file_ranges prior to adding any ranges.
+ ///
+ /// @return
+ /// The number of address ranges added to \a file_ranges
+ //------------------------------------------------------------------
+ size_t GetContiguousFileAddressRanges(FileAddressRanges &file_ranges,
+ bool append);
+
+ //------------------------------------------------------------------
+ /// Given a file range link map, relink the current line table
+ /// and return a fixed up line table.
+ ///
+ /// @param[out] file_range_map
+ /// A collection of file ranges that maps to new file ranges
+ /// that will be used when linking the line table.
+ ///
+ /// @return
+ /// A new line table if at least one line table entry was able
+ /// to be mapped.
+ //------------------------------------------------------------------
+ typedef RangeDataVector<lldb::addr_t, lldb::addr_t, lldb::addr_t>
+ FileRangeMap;
- //------------------------------------------------------------------
- /// Get the line entry from the line table at index \a idx.
- ///
- /// @param[in] idx
- /// An index into the line table entry collection.
- ///
- /// @return
- /// A valid line entry if \a idx is a valid index, or an invalid
- /// line entry if \a idx is not valid.
- ///
- /// @see LineTable::GetSize()
- /// @see LineEntry::IsValid() const
- //------------------------------------------------------------------
- bool
- GetLineEntryAtIndex(uint32_t idx, LineEntry& line_entry);
-
- //------------------------------------------------------------------
- /// Gets the size of the line table in number of line table entries.
- ///
- /// @return
- /// The number of line table entries in this line table.
- //------------------------------------------------------------------
- uint32_t
- GetSize () const;
-
- typedef lldb_private::RangeArray<lldb::addr_t, lldb::addr_t, 32> FileAddressRanges;
-
- //------------------------------------------------------------------
- /// Gets all contiguous file address ranges for the entire line table.
- ///
- /// @param[out] file_ranges
- /// A collection of file address ranges that will be filled in
- /// by this function.
- ///
- /// @param[out] append
- /// If \b true, then append to \a file_ranges, otherwise clear
- /// \a file_ranges prior to adding any ranges.
- ///
- /// @return
- /// The number of address ranges added to \a file_ranges
- //------------------------------------------------------------------
- size_t
- GetContiguousFileAddressRanges (FileAddressRanges &file_ranges, bool append);
+ LineTable *LinkLineTable(const FileRangeMap &file_range_map);
- //------------------------------------------------------------------
- /// Given a file range link map, relink the current line table
- /// and return a fixed up line table.
- ///
- /// @param[out] file_range_map
- /// A collection of file ranges that maps to new file ranges
- /// that will be used when linking the line table.
- ///
- /// @return
- /// A new line table if at least one line table entry was able
- /// to be mapped.
- //------------------------------------------------------------------
- typedef RangeDataVector<lldb::addr_t, lldb::addr_t, lldb::addr_t> FileRangeMap;
+protected:
+ struct Entry {
+ Entry()
+ : file_addr(LLDB_INVALID_ADDRESS), line(0), column(0), file_idx(0),
+ is_start_of_statement(false), is_start_of_basic_block(false),
+ is_prologue_end(false), is_epilogue_begin(false),
+ is_terminal_entry(false) {}
+
+ Entry(lldb::addr_t _file_addr, uint32_t _line, uint16_t _column,
+ uint16_t _file_idx, bool _is_start_of_statement,
+ bool _is_start_of_basic_block, bool _is_prologue_end,
+ bool _is_epilogue_begin, bool _is_terminal_entry)
+ : file_addr(_file_addr), line(_line), column(_column),
+ file_idx(_file_idx), is_start_of_statement(_is_start_of_statement),
+ is_start_of_basic_block(_is_start_of_basic_block),
+ is_prologue_end(_is_prologue_end),
+ is_epilogue_begin(_is_epilogue_begin),
+ is_terminal_entry(_is_terminal_entry) {}
+
+ int bsearch_compare(const void *key, const void *arrmem);
+
+ void Clear() {
+ file_addr = LLDB_INVALID_ADDRESS;
+ line = 0;
+ column = 0;
+ file_idx = 0;
+ is_start_of_statement = false;
+ is_start_of_basic_block = false;
+ is_prologue_end = false;
+ is_epilogue_begin = false;
+ is_terminal_entry = false;
+ }
+
+ static int Compare(const Entry &lhs, const Entry &rhs) {
+// Compare the sections before calling
+#define SCALAR_COMPARE(a, b) \
+ if (a < b) \
+ return -1; \
+ if (a > b) \
+ return +1
+ SCALAR_COMPARE(lhs.file_addr, rhs.file_addr);
+ SCALAR_COMPARE(lhs.line, rhs.line);
+ SCALAR_COMPARE(lhs.column, rhs.column);
+ SCALAR_COMPARE(lhs.is_start_of_statement, rhs.is_start_of_statement);
+ SCALAR_COMPARE(lhs.is_start_of_basic_block, rhs.is_start_of_basic_block);
+ // rhs and lhs reversed on purpose below.
+ SCALAR_COMPARE(rhs.is_prologue_end, lhs.is_prologue_end);
+ SCALAR_COMPARE(lhs.is_epilogue_begin, rhs.is_epilogue_begin);
+ // rhs and lhs reversed on purpose below.
+ SCALAR_COMPARE(rhs.is_terminal_entry, lhs.is_terminal_entry);
+ SCALAR_COMPARE(lhs.file_idx, rhs.file_idx);
+#undef SCALAR_COMPARE
+ return 0;
+ }
- LineTable *
- LinkLineTable (const FileRangeMap &file_range_map);
+ class LessThanBinaryPredicate {
+ public:
+ LessThanBinaryPredicate(LineTable *line_table);
+ bool operator()(const LineTable::Entry &, const LineTable::Entry &) const;
-protected:
- struct Entry
- {
- Entry () :
- file_addr (LLDB_INVALID_ADDRESS),
- line (0),
- column (0),
- file_idx (0),
- is_start_of_statement (false),
- is_start_of_basic_block (false),
- is_prologue_end (false),
- is_epilogue_begin (false),
- is_terminal_entry (false)
- {
- }
-
- Entry ( lldb::addr_t _file_addr,
- uint32_t _line,
- uint16_t _column,
- uint16_t _file_idx,
- bool _is_start_of_statement,
- bool _is_start_of_basic_block,
- bool _is_prologue_end,
- bool _is_epilogue_begin,
- bool _is_terminal_entry) :
- file_addr (_file_addr),
- line (_line),
- column (_column),
- file_idx (_file_idx),
- is_start_of_statement (_is_start_of_statement),
- is_start_of_basic_block (_is_start_of_basic_block),
- is_prologue_end (_is_prologue_end),
- is_epilogue_begin (_is_epilogue_begin),
- is_terminal_entry (_is_terminal_entry)
- {
- }
-
- int
- bsearch_compare (const void *key, const void *arrmem);
-
- void
- Clear ()
- {
- file_addr = LLDB_INVALID_ADDRESS;
- line = 0;
- column = 0;
- file_idx = 0;
- is_start_of_statement = false;
- is_start_of_basic_block = false;
- is_prologue_end = false;
- is_epilogue_begin = false;
- is_terminal_entry = false;
- }
-
- static int
- Compare (const Entry& lhs, const Entry& rhs)
- {
- // Compare the sections before calling
- #define SCALAR_COMPARE(a,b) if (a < b) return -1; if (a > b) return +1
- SCALAR_COMPARE (lhs.file_addr, rhs.file_addr);
- SCALAR_COMPARE (lhs.line, rhs.line);
- SCALAR_COMPARE (lhs.column, rhs.column);
- SCALAR_COMPARE (lhs.is_start_of_statement, rhs.is_start_of_statement);
- SCALAR_COMPARE (lhs.is_start_of_basic_block, rhs.is_start_of_basic_block);
- // rhs and lhs reversed on purpose below.
- SCALAR_COMPARE (rhs.is_prologue_end, lhs.is_prologue_end);
- SCALAR_COMPARE (lhs.is_epilogue_begin, rhs.is_epilogue_begin);
- // rhs and lhs reversed on purpose below.
- SCALAR_COMPARE (rhs.is_terminal_entry, lhs.is_terminal_entry);
- SCALAR_COMPARE (lhs.file_idx, rhs.file_idx);
- #undef SCALAR_COMPARE
- return 0;
- }
-
- class LessThanBinaryPredicate
- {
- public:
- LessThanBinaryPredicate(LineTable *line_table);
- bool operator() (const LineTable::Entry&, const LineTable::Entry&) const;
-
- protected:
- LineTable *m_line_table;
- };
-
- static bool EntryAddressLessThan (const Entry& lhs, const Entry& rhs)
- {
- return lhs.file_addr < rhs.file_addr;
- }
-
- //------------------------------------------------------------------
- // Member variables.
- //------------------------------------------------------------------
- lldb::addr_t file_addr; ///< The file address for this line entry
- uint32_t line; ///< The source line number, or zero if there is no line number information.
- uint16_t column; ///< The column number of the source line, or zero if there is no column information.
- uint16_t file_idx:11, ///< The file index into CompileUnit's file table, or zero if there is no file information.
- is_start_of_statement:1, ///< Indicates this entry is the beginning of a statement.
- is_start_of_basic_block:1, ///< Indicates this entry is the beginning of a basic block.
- is_prologue_end:1, ///< Indicates this entry is one (of possibly many) where execution should be suspended for an entry breakpoint of a function.
- is_epilogue_begin:1, ///< Indicates this entry is one (of possibly many) where execution should be suspended for an exit breakpoint of a function.
- is_terminal_entry:1; ///< Indicates this entry is that of the first byte after the end of a sequence of target machine instructions.
+ protected:
+ LineTable *m_line_table;
};
- struct EntrySearchInfo
- {
- LineTable* line_table;
- lldb_private::Section *a_section;
- Entry *a_entry;
- };
+ static bool EntryAddressLessThan(const Entry &lhs, const Entry &rhs) {
+ return lhs.file_addr < rhs.file_addr;
+ }
//------------------------------------------------------------------
- // Types
- //------------------------------------------------------------------
- typedef std::vector<lldb_private::Section*> section_collection; ///< The collection type for the sections.
- typedef std::vector<Entry> entry_collection; ///< The collection type for the line entries.
- //------------------------------------------------------------------
// Member variables.
//------------------------------------------------------------------
- CompileUnit* m_comp_unit; ///< The compile unit that this line table belongs to.
- entry_collection m_entries; ///< The collection of line entries in this line table.
-
- //------------------------------------------------------------------
- // Helper class
- //------------------------------------------------------------------
- class LineSequenceImpl : public LineSequence
- {
- public:
- LineSequenceImpl() = default;
-
- ~LineSequenceImpl() override = default;
-
- void
- Clear() override;
-
- entry_collection m_entries; ///< The collection of line entries in this sequence.
- };
+ lldb::addr_t file_addr; ///< The file address for this line entry
+ uint32_t line; ///< The source line number, or zero if there is no line
+ ///number information.
+ uint16_t column; ///< The column number of the source line, or zero if there
+ ///is no column information.
+ uint16_t file_idx : 11, ///< The file index into CompileUnit's file table,
+ ///or zero if there is no file information.
+ is_start_of_statement : 1, ///< Indicates this entry is the beginning of
+ ///a statement.
+ is_start_of_basic_block : 1, ///< Indicates this entry is the beginning
+ ///of a basic block.
+ is_prologue_end : 1, ///< Indicates this entry is one (of possibly many)
+ ///where execution should be suspended for an entry
+ ///breakpoint of a function.
+ is_epilogue_begin : 1, ///< Indicates this entry is one (of possibly
+ ///many) where execution should be suspended for
+ ///an exit breakpoint of a function.
+ is_terminal_entry : 1; ///< Indicates this entry is that of the first
+ ///byte after the end of a sequence of target
+ ///machine instructions.
+ };
+
+ struct EntrySearchInfo {
+ LineTable *line_table;
+ lldb_private::Section *a_section;
+ Entry *a_entry;
+ };
+
+ //------------------------------------------------------------------
+ // Types
+ //------------------------------------------------------------------
+ typedef std::vector<lldb_private::Section *>
+ section_collection; ///< The collection type for the sections.
+ typedef std::vector<Entry>
+ entry_collection; ///< The collection type for the line entries.
+ //------------------------------------------------------------------
+ // Member variables.
+ //------------------------------------------------------------------
+ CompileUnit
+ *m_comp_unit; ///< The compile unit that this line table belongs to.
+ entry_collection
+ m_entries; ///< The collection of line entries in this line table.
+
+ //------------------------------------------------------------------
+ // Helper class
+ //------------------------------------------------------------------
+ class LineSequenceImpl : public LineSequence {
+ public:
+ LineSequenceImpl() = default;
+
+ ~LineSequenceImpl() override = default;
+
+ void Clear() override;
+
+ entry_collection
+ m_entries; ///< The collection of line entries in this sequence.
+ };
- bool
- ConvertEntryAtIndexToLineEntry (uint32_t idx, LineEntry &line_entry);
+ bool ConvertEntryAtIndexToLineEntry(uint32_t idx, LineEntry &line_entry);
private:
- DISALLOW_COPY_AND_ASSIGN (LineTable);
+ DISALLOW_COPY_AND_ASSIGN(LineTable);
};
} // namespace lldb_private
Modified: lldb/trunk/include/lldb/Symbol/OCamlASTContext.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Symbol/OCamlASTContext.h?rev=280751&r1=280750&r2=280751&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Symbol/OCamlASTContext.h (original)
+++ lldb/trunk/include/lldb/Symbol/OCamlASTContext.h Tue Sep 6 15:57:50 2016
@@ -1,4 +1,5 @@
-//===-- OCamlASTContext.h ------------------------------------------*- C++ -*-===//
+//===-- OCamlASTContext.h ------------------------------------------*- C++
+//-*-===//
//
// The LLVM Compiler Infrastructure
//
@@ -21,334 +22,303 @@
// Other libraries and framework includes
// Project includes
#include "lldb/Core/ConstString.h"
-#include "lldb/Symbol/TypeSystem.h"
#include "lldb/Symbol/CompilerType.h"
+#include "lldb/Symbol/TypeSystem.h"
-namespace lldb_private
-{
+namespace lldb_private {
-class OCamlASTContext : public TypeSystem
-{
- public:
- class OCamlType;
- typedef std::map<ConstString, std::unique_ptr<OCamlType>> OCamlTypeMap;
+class OCamlASTContext : public TypeSystem {
+public:
+ class OCamlType;
+ typedef std::map<ConstString, std::unique_ptr<OCamlType>> OCamlTypeMap;
- OCamlASTContext();
- ~OCamlASTContext() override;
+ OCamlASTContext();
+ ~OCamlASTContext() override;
- ConstString
- GetPluginName() override;
+ ConstString GetPluginName() override;
- uint32_t
- GetPluginVersion() override;
+ uint32_t GetPluginVersion() override;
- static ConstString
- GetPluginNameStatic ();
+ static ConstString GetPluginNameStatic();
- static lldb::TypeSystemSP
- CreateInstance (lldb::LanguageType language, Module *module, Target *target);
+ static lldb::TypeSystemSP CreateInstance(lldb::LanguageType language,
+ Module *module, Target *target);
- static void
- EnumerateSupportedLanguages(std::set<lldb::LanguageType> &languages_for_types,
- std::set<lldb::LanguageType> &languages_for_expressions);
+ static void EnumerateSupportedLanguages(
+ std::set<lldb::LanguageType> &languages_for_types,
+ std::set<lldb::LanguageType> &languages_for_expressions);
- static void
- Initialize ();
+ static void Initialize();
- static void
- Terminate ();
+ static void Terminate();
- DWARFASTParser *GetDWARFParser() override;
+ DWARFASTParser *GetDWARFParser() override;
- void
- SetAddressByteSize(int byte_size)
- {
- m_pointer_byte_size = byte_size;
- }
+ void SetAddressByteSize(int byte_size) { m_pointer_byte_size = byte_size; }
- static bool classof(const TypeSystem *ts)
- {
- return ts->getKind() == TypeSystem::eKindOCaml;
- }
+ static bool classof(const TypeSystem *ts) {
+ return ts->getKind() == TypeSystem::eKindOCaml;
+ }
- ConstString
- DeclGetName (void *opaque_decl) override
- {
- return ConstString();
- }
+ ConstString DeclGetName(void *opaque_decl) override { return ConstString(); }
- bool
- DeclContextIsStructUnionOrClass(void *opaque_decl_ctx) override
- {
- return false;
- }
+ bool DeclContextIsStructUnionOrClass(void *opaque_decl_ctx) override {
+ return false;
+ }
- ConstString
- DeclContextGetName(void *opaque_decl_ctx) override
- {
- return ConstString();
- }
+ ConstString DeclContextGetName(void *opaque_decl_ctx) override {
+ return ConstString();
+ }
- ConstString
- DeclContextGetScopeQualifiedName(void *opaque_decl_ctx) override
- {
- return ConstString();
- }
+ ConstString DeclContextGetScopeQualifiedName(void *opaque_decl_ctx) override {
+ return ConstString();
+ }
- bool
- DeclContextIsClassMethod(void *opaque_decl_ctx, lldb::LanguageType *language_ptr,
- bool *is_instance_method_ptr,
- ConstString *language_object_name_ptr) override
- {
- return false;
- }
+ bool
+ DeclContextIsClassMethod(void *opaque_decl_ctx,
+ lldb::LanguageType *language_ptr,
+ bool *is_instance_method_ptr,
+ ConstString *language_object_name_ptr) override {
+ return false;
+ }
- bool SupportsLanguage (lldb::LanguageType language) override;
- uint32_t GetPointerByteSize() override;
+ bool SupportsLanguage(lldb::LanguageType language) override;
+ uint32_t GetPointerByteSize() override;
- bool
- IsArrayType(lldb::opaque_compiler_type_t type, CompilerType *element_type,
- uint64_t *size, bool *is_incomplete) override;
+ bool IsArrayType(lldb::opaque_compiler_type_t type,
+ CompilerType *element_type, uint64_t *size,
+ bool *is_incomplete) override;
- bool IsAggregateType(lldb::opaque_compiler_type_t type) override;
+ bool IsAggregateType(lldb::opaque_compiler_type_t type) override;
- bool IsCharType(lldb::opaque_compiler_type_t type) override;
+ bool IsCharType(lldb::opaque_compiler_type_t type) override;
- bool IsCompleteType(lldb::opaque_compiler_type_t type) override;
+ bool IsCompleteType(lldb::opaque_compiler_type_t type) override;
- bool IsDefined(lldb::opaque_compiler_type_t type) override;
+ bool IsDefined(lldb::opaque_compiler_type_t type) override;
- bool IsFloatingPointType(lldb::opaque_compiler_type_t type, uint32_t &count, bool &is_complex) override;
+ bool IsFloatingPointType(lldb::opaque_compiler_type_t type, uint32_t &count,
+ bool &is_complex) override;
- bool IsFunctionType(lldb::opaque_compiler_type_t type, bool *is_variadic_ptr = nullptr) override;
+ bool IsFunctionType(lldb::opaque_compiler_type_t type,
+ bool *is_variadic_ptr = nullptr) override;
- size_t GetNumberOfFunctionArguments(lldb::opaque_compiler_type_t type) override;
+ size_t
+ GetNumberOfFunctionArguments(lldb::opaque_compiler_type_t type) override;
- CompilerType GetFunctionArgumentAtIndex(lldb::opaque_compiler_type_t type, const size_t index) override;
+ CompilerType GetFunctionArgumentAtIndex(lldb::opaque_compiler_type_t type,
+ const size_t index) override;
- bool IsFunctionPointerType(lldb::opaque_compiler_type_t type) override;
+ bool IsFunctionPointerType(lldb::opaque_compiler_type_t type) override;
- bool IsBlockPointerType (lldb::opaque_compiler_type_t type,
- CompilerType *function_pointer_type_ptr) override;
+ bool IsBlockPointerType(lldb::opaque_compiler_type_t type,
+ CompilerType *function_pointer_type_ptr) override;
- bool
- IsIntegerType(lldb::opaque_compiler_type_t type, bool &is_signed) override;
+ bool IsIntegerType(lldb::opaque_compiler_type_t type,
+ bool &is_signed) override;
- bool
- IsPossibleDynamicType(lldb::opaque_compiler_type_t type,
- CompilerType *target_type,
- bool check_cplusplus, bool check_objc) override;
+ bool IsPossibleDynamicType(lldb::opaque_compiler_type_t type,
+ CompilerType *target_type, bool check_cplusplus,
+ bool check_objc) override;
- bool IsPointerType(lldb::opaque_compiler_type_t type, CompilerType *pointee_type = nullptr) override;
+ bool IsPointerType(lldb::opaque_compiler_type_t type,
+ CompilerType *pointee_type = nullptr) override;
- bool IsScalarType(lldb::opaque_compiler_type_t type) override;
+ bool IsScalarType(lldb::opaque_compiler_type_t type) override;
- bool IsVoidType(lldb::opaque_compiler_type_t type) override;
+ bool IsVoidType(lldb::opaque_compiler_type_t type) override;
- bool GetCompleteType(lldb::opaque_compiler_type_t type) override;
+ bool GetCompleteType(lldb::opaque_compiler_type_t type) override;
- ConstString GetTypeName(lldb::opaque_compiler_type_t type) override;
+ ConstString GetTypeName(lldb::opaque_compiler_type_t type) override;
- uint32_t
- GetTypeInfo(lldb::opaque_compiler_type_t type,
- CompilerType *pointee_or_element_compiler_type = nullptr) override;
+ uint32_t GetTypeInfo(
+ lldb::opaque_compiler_type_t type,
+ CompilerType *pointee_or_element_compiler_type = nullptr) override;
- lldb::LanguageType GetMinimumLanguage(lldb::opaque_compiler_type_t type) override;
+ lldb::LanguageType
+ GetMinimumLanguage(lldb::opaque_compiler_type_t type) override;
- lldb::TypeClass GetTypeClass(lldb::opaque_compiler_type_t type) override;
+ lldb::TypeClass GetTypeClass(lldb::opaque_compiler_type_t type) override;
- CompilerType
- GetArrayElementType(lldb::opaque_compiler_type_t type, uint64_t *stride = nullptr) override;
+ CompilerType GetArrayElementType(lldb::opaque_compiler_type_t type,
+ uint64_t *stride = nullptr) override;
- CompilerType GetCanonicalType(lldb::opaque_compiler_type_t type) override;
+ CompilerType GetCanonicalType(lldb::opaque_compiler_type_t type) override;
- int GetFunctionArgumentCount(lldb::opaque_compiler_type_t type) override;
+ int GetFunctionArgumentCount(lldb::opaque_compiler_type_t type) override;
- CompilerType
- GetFunctionArgumentTypeAtIndex(lldb::opaque_compiler_type_t type, size_t idx) override;
+ CompilerType GetFunctionArgumentTypeAtIndex(lldb::opaque_compiler_type_t type,
+ size_t idx) override;
- CompilerType
- GetFunctionReturnType(lldb::opaque_compiler_type_t type) override;
+ CompilerType
+ GetFunctionReturnType(lldb::opaque_compiler_type_t type) override;
- size_t
- GetNumMemberFunctions(lldb::opaque_compiler_type_t type) override;
+ size_t GetNumMemberFunctions(lldb::opaque_compiler_type_t type) override;
- TypeMemberFunctionImpl
- GetMemberFunctionAtIndex(lldb::opaque_compiler_type_t type, size_t idx) override;
+ TypeMemberFunctionImpl
+ GetMemberFunctionAtIndex(lldb::opaque_compiler_type_t type,
+ size_t idx) override;
- CompilerType
- GetPointeeType(lldb::opaque_compiler_type_t type) override;
+ CompilerType GetPointeeType(lldb::opaque_compiler_type_t type) override;
- CompilerType
- GetPointerType(lldb::opaque_compiler_type_t type) override;
+ CompilerType GetPointerType(lldb::opaque_compiler_type_t type) override;
- uint64_t
- GetBitSize(lldb::opaque_compiler_type_t type, ExecutionContextScope *exe_scope) override;
+ uint64_t GetBitSize(lldb::opaque_compiler_type_t type,
+ ExecutionContextScope *exe_scope) override;
- lldb::Encoding
- GetEncoding(lldb::opaque_compiler_type_t type, uint64_t &count) override;
+ lldb::Encoding GetEncoding(lldb::opaque_compiler_type_t type,
+ uint64_t &count) override;
- lldb::Format
- GetFormat(lldb::opaque_compiler_type_t type) override;
+ lldb::Format GetFormat(lldb::opaque_compiler_type_t type) override;
- uint32_t
- GetNumChildren(lldb::opaque_compiler_type_t type, bool omit_empty_base_classes) override;
+ uint32_t GetNumChildren(lldb::opaque_compiler_type_t type,
+ bool omit_empty_base_classes) override;
- lldb::BasicType
- GetBasicTypeEnumeration(lldb::opaque_compiler_type_t type) override;
+ lldb::BasicType
+ GetBasicTypeEnumeration(lldb::opaque_compiler_type_t type) override;
- CompilerType
- GetBuiltinTypeForEncodingAndBitSize(lldb::Encoding encoding, size_t bit_size) override;
+ CompilerType GetBuiltinTypeForEncodingAndBitSize(lldb::Encoding encoding,
+ size_t bit_size) override;
- uint32_t
- GetNumFields(lldb::opaque_compiler_type_t type) override;
+ uint32_t GetNumFields(lldb::opaque_compiler_type_t type) override;
- CompilerType
- GetFieldAtIndex(lldb::opaque_compiler_type_t type, size_t idx, std::string &name, uint64_t *bit_offset_ptr,
- uint32_t *bitfield_bit_size_ptr, bool *is_bitfield_ptr) override;
+ CompilerType GetFieldAtIndex(lldb::opaque_compiler_type_t type, size_t idx,
+ std::string &name, uint64_t *bit_offset_ptr,
+ uint32_t *bitfield_bit_size_ptr,
+ bool *is_bitfield_ptr) override;
- uint32_t
- GetNumDirectBaseClasses(lldb::opaque_compiler_type_t type) override
- {
- return 0;
- }
+ uint32_t GetNumDirectBaseClasses(lldb::opaque_compiler_type_t type) override {
+ return 0;
+ }
- uint32_t
- GetNumVirtualBaseClasses(lldb::opaque_compiler_type_t type) override
- {
- return 0;
- }
+ uint32_t
+ GetNumVirtualBaseClasses(lldb::opaque_compiler_type_t type) override {
+ return 0;
+ }
- CompilerType
- GetDirectBaseClassAtIndex(lldb::opaque_compiler_type_t type, size_t idx, uint32_t *bit_offset_ptr) override
- {
- return CompilerType();
- }
+ CompilerType GetDirectBaseClassAtIndex(lldb::opaque_compiler_type_t type,
+ size_t idx,
+ uint32_t *bit_offset_ptr) override {
+ return CompilerType();
+ }
- CompilerType
- GetVirtualBaseClassAtIndex(lldb::opaque_compiler_type_t type, size_t idx, uint32_t *bit_offset_ptr) override
- {
- return CompilerType();
- }
+ CompilerType GetVirtualBaseClassAtIndex(lldb::opaque_compiler_type_t type,
+ size_t idx,
+ uint32_t *bit_offset_ptr) override {
+ return CompilerType();
+ }
- CompilerType
- GetChildCompilerTypeAtIndex(lldb::opaque_compiler_type_t type,
- ExecutionContext *exe_ctx, size_t idx,
- bool transparent_pointers, bool omit_empty_base_classes,
- bool ignore_array_bounds, std::string &child_name,
- uint32_t &child_byte_size, int32_t &child_byte_offset,
- uint32_t &child_bitfield_bit_size,
- uint32_t &child_bitfield_bit_offset, bool &child_is_base_class,
- bool &child_is_deref_of_parent, ValueObject *valobj,
- uint64_t &language_flags) override;
+ CompilerType GetChildCompilerTypeAtIndex(
+ lldb::opaque_compiler_type_t type, ExecutionContext *exe_ctx, size_t idx,
+ bool transparent_pointers, bool omit_empty_base_classes,
+ bool ignore_array_bounds, std::string &child_name,
+ uint32_t &child_byte_size, int32_t &child_byte_offset,
+ uint32_t &child_bitfield_bit_size, uint32_t &child_bitfield_bit_offset,
+ bool &child_is_base_class, bool &child_is_deref_of_parent,
+ ValueObject *valobj, uint64_t &language_flags) override;
- uint32_t
- GetIndexOfChildWithName(lldb::opaque_compiler_type_t type, const char *name, bool omit_empty_base_classes) override;
+ uint32_t GetIndexOfChildWithName(lldb::opaque_compiler_type_t type,
+ const char *name,
+ bool omit_empty_base_classes) override;
- size_t
- GetIndexOfChildMemberWithName(lldb::opaque_compiler_type_t type,
- const char *name, bool omit_empty_base_classes,
- std::vector<uint32_t> &child_indexes) override;
+ size_t
+ GetIndexOfChildMemberWithName(lldb::opaque_compiler_type_t type,
+ const char *name, bool omit_empty_base_classes,
+ std::vector<uint32_t> &child_indexes) override;
- size_t
- GetNumTemplateArguments(lldb::opaque_compiler_type_t type) override
- {
- return 0;
- }
+ size_t GetNumTemplateArguments(lldb::opaque_compiler_type_t type) override {
+ return 0;
+ }
- CompilerType
- GetTemplateArgument(lldb::opaque_compiler_type_t type,
- size_t idx, lldb::TemplateArgumentKind &kind) override
- {
- return CompilerType();
- }
+ CompilerType GetTemplateArgument(lldb::opaque_compiler_type_t type,
+ size_t idx,
+ lldb::TemplateArgumentKind &kind) override {
+ return CompilerType();
+ }
- void DumpValue(lldb::opaque_compiler_type_t type, ExecutionContext *exe_ctx,
- Stream *s, lldb::Format format, const DataExtractor &data,
- lldb::offset_t data_offset, size_t data_byte_size,
- uint32_t bitfield_bit_size, uint32_t bitfield_bit_offset,
- bool show_types, bool show_summary,
- bool verbose, uint32_t depth) override;
+ void DumpValue(lldb::opaque_compiler_type_t type, ExecutionContext *exe_ctx,
+ Stream *s, lldb::Format format, const DataExtractor &data,
+ lldb::offset_t data_offset, size_t data_byte_size,
+ uint32_t bitfield_bit_size, uint32_t bitfield_bit_offset,
+ bool show_types, bool show_summary, bool verbose,
+ uint32_t depth) override;
- bool DumpTypeValue(lldb::opaque_compiler_type_t type, Stream *s,
- lldb::Format format, const DataExtractor &data,
- lldb::offset_t data_offset, size_t data_byte_size,
- uint32_t bitfield_bit_size, uint32_t bitfield_bit_offset,
- ExecutionContextScope *exe_scope) override;
+ bool DumpTypeValue(lldb::opaque_compiler_type_t type, Stream *s,
+ lldb::Format format, const DataExtractor &data,
+ lldb::offset_t data_offset, size_t data_byte_size,
+ uint32_t bitfield_bit_size, uint32_t bitfield_bit_offset,
+ ExecutionContextScope *exe_scope) override;
- void
- DumpTypeDescription(lldb::opaque_compiler_type_t type) override;
+ void DumpTypeDescription(lldb::opaque_compiler_type_t type) override;
- void
- DumpTypeDescription(lldb::opaque_compiler_type_t type, Stream *s) override;
+ void DumpTypeDescription(lldb::opaque_compiler_type_t type,
+ Stream *s) override;
- bool IsRuntimeGeneratedType(lldb::opaque_compiler_type_t type) override;
+ bool IsRuntimeGeneratedType(lldb::opaque_compiler_type_t type) override;
- void
- DumpSummary(lldb::opaque_compiler_type_t type, ExecutionContext *exe_ctx,
- Stream *s, const DataExtractor &data,
- lldb::offset_t data_offset, size_t data_byte_size) override;
+ void DumpSummary(lldb::opaque_compiler_type_t type, ExecutionContext *exe_ctx,
+ Stream *s, const DataExtractor &data,
+ lldb::offset_t data_offset, size_t data_byte_size) override;
- size_t
- ConvertStringToFloatValue(lldb::opaque_compiler_type_t type, const char *s,
- uint8_t *dst, size_t dst_size) override;
+ size_t ConvertStringToFloatValue(lldb::opaque_compiler_type_t type,
+ const char *s, uint8_t *dst,
+ size_t dst_size) override;
- bool IsPointerOrReferenceType(lldb::opaque_compiler_type_t type,
- CompilerType *pointee_type = nullptr) override;
+ bool IsPointerOrReferenceType(lldb::opaque_compiler_type_t type,
+ CompilerType *pointee_type = nullptr) override;
- unsigned GetTypeQualifiers(lldb::opaque_compiler_type_t type) override;
+ unsigned GetTypeQualifiers(lldb::opaque_compiler_type_t type) override;
- bool IsCStringType(lldb::opaque_compiler_type_t type, uint32_t &length) override;
+ bool IsCStringType(lldb::opaque_compiler_type_t type,
+ uint32_t &length) override;
- size_t GetTypeBitAlign(lldb::opaque_compiler_type_t type) override;
+ size_t GetTypeBitAlign(lldb::opaque_compiler_type_t type) override;
- CompilerType GetBasicTypeFromAST(lldb::BasicType basic_type) override;
+ CompilerType GetBasicTypeFromAST(lldb::BasicType basic_type) override;
- bool IsBeingDefined(lldb::opaque_compiler_type_t type) override;
+ bool IsBeingDefined(lldb::opaque_compiler_type_t type) override;
- bool IsConst(lldb::opaque_compiler_type_t type) override;
+ bool IsConst(lldb::opaque_compiler_type_t type) override;
- uint32_t
- IsHomogeneousAggregate(lldb::opaque_compiler_type_t type, CompilerType *base_type_ptr) override;
+ uint32_t IsHomogeneousAggregate(lldb::opaque_compiler_type_t type,
+ CompilerType *base_type_ptr) override;
- bool IsPolymorphicClass(lldb::opaque_compiler_type_t type) override;
+ bool IsPolymorphicClass(lldb::opaque_compiler_type_t type) override;
- bool IsTypedefType(lldb::opaque_compiler_type_t type) override;
+ bool IsTypedefType(lldb::opaque_compiler_type_t type) override;
- CompilerType GetTypedefedType(lldb::opaque_compiler_type_t type) override;
+ CompilerType GetTypedefedType(lldb::opaque_compiler_type_t type) override;
- bool
- IsVectorType(lldb::opaque_compiler_type_t type, CompilerType *element_type,
- uint64_t *size) override;
+ bool IsVectorType(lldb::opaque_compiler_type_t type,
+ CompilerType *element_type, uint64_t *size) override;
- CompilerType GetFullyUnqualifiedType(lldb::opaque_compiler_type_t type) override;
+ CompilerType
+ GetFullyUnqualifiedType(lldb::opaque_compiler_type_t type) override;
- CompilerType GetNonReferenceType(lldb::opaque_compiler_type_t type) override;
+ CompilerType GetNonReferenceType(lldb::opaque_compiler_type_t type) override;
- bool
- IsReferenceType(lldb::opaque_compiler_type_t type,
- CompilerType *pointee_type = nullptr,
- bool *is_rvalue = nullptr) override;
+ bool IsReferenceType(lldb::opaque_compiler_type_t type,
+ CompilerType *pointee_type = nullptr,
+ bool *is_rvalue = nullptr) override;
- CompilerType CreateBaseType(const ConstString &name, uint64_t);
+ CompilerType CreateBaseType(const ConstString &name, uint64_t);
- private:
- int m_pointer_byte_size;
- std::unique_ptr<DWARFASTParser> m_dwarf_ast_parser_ap;
- OCamlTypeMap m_base_type_map;
+private:
+ int m_pointer_byte_size;
+ std::unique_ptr<DWARFASTParser> m_dwarf_ast_parser_ap;
+ OCamlTypeMap m_base_type_map;
- OCamlASTContext(const OCamlASTContext &) = delete;
- const OCamlASTContext &operator=(const OCamlASTContext &) = delete;
+ OCamlASTContext(const OCamlASTContext &) = delete;
+ const OCamlASTContext &operator=(const OCamlASTContext &) = delete;
};
-class OCamlASTContextForExpr : public OCamlASTContext
-{
- public:
- OCamlASTContextForExpr(lldb::TargetSP target) : m_target_wp(target) {}
+class OCamlASTContextForExpr : public OCamlASTContext {
+public:
+ OCamlASTContextForExpr(lldb::TargetSP target) : m_target_wp(target) {}
- private:
- lldb::TargetWP m_target_wp;
+private:
+ lldb::TargetWP m_target_wp;
};
-
}
#endif // liblldb_OCamlASTContext_h_
Modified: lldb/trunk/include/lldb/Symbol/ObjectContainer.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Symbol/ObjectContainer.h?rev=280751&r1=280750&r2=280751&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Symbol/ObjectContainer.h (original)
+++ lldb/trunk/include/lldb/Symbol/ObjectContainer.h Tue Sep 6 15:57:50 2016
@@ -14,12 +14,12 @@
// C++ Includes
// Other libraries and framework includes
// Project includes
-#include "lldb/lldb-private.h"
#include "lldb/Core/DataExtractor.h"
-#include "lldb/Host/FileSpec.h"
#include "lldb/Core/ModuleChild.h"
#include "lldb/Core/PluginInterface.h"
#include "lldb/Host/Endian.h"
+#include "lldb/Host/FileSpec.h"
+#include "lldb/lldb-private.h"
namespace lldb_private {
@@ -34,197 +34,168 @@ namespace lldb_private {
/// contain multiple named object files, and universal files that contain
/// multiple architectures.
//----------------------------------------------------------------------
-class ObjectContainer :
- public PluginInterface,
- public ModuleChild
-{
+class ObjectContainer : public PluginInterface, public ModuleChild {
public:
- //------------------------------------------------------------------
- /// Construct with a parent module, offset, and header data.
- ///
- /// Object files belong to modules and a valid module must be
- /// supplied upon construction. The at an offset within a file for
- /// objects that contain more than one architecture or object.
- //------------------------------------------------------------------
- ObjectContainer (const lldb::ModuleSP &module_sp,
- const FileSpec *file,
- lldb::offset_t file_offset,
- lldb::offset_t length,
- lldb::DataBufferSP& data_sp,
- lldb::offset_t data_offset) :
- ModuleChild (module_sp),
- m_file (), // This file can be different than the module's file spec
- m_offset (file_offset),
- m_length (length),
- m_data ()
- {
- if (file)
- m_file = *file;
- if (data_sp)
- m_data.SetData (data_sp, data_offset, length);
- }
-
- //------------------------------------------------------------------
- /// Destructor.
- ///
- /// The destructor is virtual since this class is designed to be
- /// inherited from by the plug-in instance.
- //------------------------------------------------------------------
- ~ObjectContainer() override = default;
-
- //------------------------------------------------------------------
- /// Dump a description of this object to a Stream.
- ///
- /// Dump a description of the current contents of this object
- /// to the supplied stream \a s. The dumping should include the
- /// section list if it has been parsed, and the symbol table
- /// if it has been parsed.
- ///
- /// @param[in] s
- /// The stream to which to dump the object description.
- //------------------------------------------------------------------
- virtual void
- Dump (Stream *s) const = 0;
-
- //------------------------------------------------------------------
- /// Gets the architecture given an index.
- ///
- /// Copies the architecture specification for index \a idx.
- ///
- /// @param[in] idx
- /// The architecture index to extract.
- ///
- /// @param[out] arch
- /// A architecture object that will be filled in if \a idx is a
- /// architecture valid index.
- ///
- /// @return
- /// Returns \b true if \a idx is valid and \a arch has been
- /// filled in, \b false otherwise.
- ///
- /// @see ObjectContainer::GetNumArchitectures() const
- //------------------------------------------------------------------
- virtual bool
- GetArchitectureAtIndex (uint32_t idx, ArchSpec& arch) const
- {
- return false;
- }
-
- //------------------------------------------------------------------
- /// Returns the offset into a file at which this object resides.
- ///
- /// Some files contain many object files, and this function allows
- /// access to an object's offset within the file.
- ///
- /// @return
- /// The offset in bytes into the file. Defaults to zero for
- /// simple object files that a represented by an entire file.
- //------------------------------------------------------------------
- virtual lldb::addr_t
- GetOffset () const
- { return m_offset; }
-
- virtual lldb::addr_t
- GetByteSize () const
- { return m_length; }
-
- //------------------------------------------------------------------
- /// Get the number of objects within this object file (archives).
- ///
- /// @return
- /// Zero for object files that are not archives, or the number
- /// of objects contained in the archive.
- //------------------------------------------------------------------
- virtual size_t
- GetNumObjects () const
- { return 0; }
-
- //------------------------------------------------------------------
- /// Get the number of architectures in this object file.
- ///
- /// The default implementation returns 1 as for object files that
- /// contain a single architecture. ObjectContainer instances that
- /// contain more than one architecture should override this function
- /// and return an appropriate value.
- ///
- /// @return
- /// The number of architectures contained in this object file.
- //------------------------------------------------------------------
- virtual size_t
- GetNumArchitectures () const
- { return 0; }
-
- //------------------------------------------------------------------
- /// Attempts to parse the object header.
- ///
- /// This function is used as a test to see if a given plug-in
- /// instance can parse the header data already contained in
- /// ObjectContainer::m_data. If an object file parser does not
- /// recognize that magic bytes in a header, false should be returned
- /// and the next plug-in can attempt to parse an object file.
- ///
- /// @return
- /// Returns \b true if the header was parsed successfully, \b
- /// false otherwise.
- //------------------------------------------------------------------
- virtual bool
- ParseHeader () = 0;
-
- //------------------------------------------------------------------
- /// Selects an architecture in an object file.
- ///
- /// Object files that contain a single architecture should verify
- /// that the specified \a arch matches the architecture in in
- /// object file and return \b true or \b false accordingly.
- ///
- /// Object files that contain more than one architecture should
- /// attempt to select that architecture, and if successful, clear
- /// out any previous state from any previously selected architecture
- /// and prepare to return information for the new architecture.
- ///
- /// @return
- /// Returns a pointer to the object file of the requested \a
- /// arch and optional \a name. Returns nullptr of no such object
- /// file exists in the container.
- //------------------------------------------------------------------
- virtual lldb::ObjectFileSP
- GetObjectFile (const FileSpec *file) = 0;
-
- virtual bool
- ObjectAtIndexIsContainer (uint32_t object_idx)
- {
- return false;
- }
-
- virtual ObjectFile *
- GetObjectFileAtIndex (uint32_t object_idx)
- {
- return nullptr;
- }
-
- virtual ObjectContainer *
- GetObjectContainerAtIndex (uint32_t object_idx)
- {
- return nullptr;
- }
-
- virtual const char *
- GetObjectNameAtIndex (uint32_t object_idx) const
- {
- return nullptr;
- }
+ //------------------------------------------------------------------
+ /// Construct with a parent module, offset, and header data.
+ ///
+ /// Object files belong to modules and a valid module must be
+ /// supplied upon construction. The at an offset within a file for
+ /// objects that contain more than one architecture or object.
+ //------------------------------------------------------------------
+ ObjectContainer(const lldb::ModuleSP &module_sp, const FileSpec *file,
+ lldb::offset_t file_offset, lldb::offset_t length,
+ lldb::DataBufferSP &data_sp, lldb::offset_t data_offset)
+ : ModuleChild(module_sp),
+ m_file(), // This file can be different than the module's file spec
+ m_offset(file_offset), m_length(length), m_data() {
+ if (file)
+ m_file = *file;
+ if (data_sp)
+ m_data.SetData(data_sp, data_offset, length);
+ }
+
+ //------------------------------------------------------------------
+ /// Destructor.
+ ///
+ /// The destructor is virtual since this class is designed to be
+ /// inherited from by the plug-in instance.
+ //------------------------------------------------------------------
+ ~ObjectContainer() override = default;
+
+ //------------------------------------------------------------------
+ /// Dump a description of this object to a Stream.
+ ///
+ /// Dump a description of the current contents of this object
+ /// to the supplied stream \a s. The dumping should include the
+ /// section list if it has been parsed, and the symbol table
+ /// if it has been parsed.
+ ///
+ /// @param[in] s
+ /// The stream to which to dump the object description.
+ //------------------------------------------------------------------
+ virtual void Dump(Stream *s) const = 0;
+
+ //------------------------------------------------------------------
+ /// Gets the architecture given an index.
+ ///
+ /// Copies the architecture specification for index \a idx.
+ ///
+ /// @param[in] idx
+ /// The architecture index to extract.
+ ///
+ /// @param[out] arch
+ /// A architecture object that will be filled in if \a idx is a
+ /// architecture valid index.
+ ///
+ /// @return
+ /// Returns \b true if \a idx is valid and \a arch has been
+ /// filled in, \b false otherwise.
+ ///
+ /// @see ObjectContainer::GetNumArchitectures() const
+ //------------------------------------------------------------------
+ virtual bool GetArchitectureAtIndex(uint32_t idx, ArchSpec &arch) const {
+ return false;
+ }
+
+ //------------------------------------------------------------------
+ /// Returns the offset into a file at which this object resides.
+ ///
+ /// Some files contain many object files, and this function allows
+ /// access to an object's offset within the file.
+ ///
+ /// @return
+ /// The offset in bytes into the file. Defaults to zero for
+ /// simple object files that a represented by an entire file.
+ //------------------------------------------------------------------
+ virtual lldb::addr_t GetOffset() const { return m_offset; }
+
+ virtual lldb::addr_t GetByteSize() const { return m_length; }
+
+ //------------------------------------------------------------------
+ /// Get the number of objects within this object file (archives).
+ ///
+ /// @return
+ /// Zero for object files that are not archives, or the number
+ /// of objects contained in the archive.
+ //------------------------------------------------------------------
+ virtual size_t GetNumObjects() const { return 0; }
+
+ //------------------------------------------------------------------
+ /// Get the number of architectures in this object file.
+ ///
+ /// The default implementation returns 1 as for object files that
+ /// contain a single architecture. ObjectContainer instances that
+ /// contain more than one architecture should override this function
+ /// and return an appropriate value.
+ ///
+ /// @return
+ /// The number of architectures contained in this object file.
+ //------------------------------------------------------------------
+ virtual size_t GetNumArchitectures() const { return 0; }
+
+ //------------------------------------------------------------------
+ /// Attempts to parse the object header.
+ ///
+ /// This function is used as a test to see if a given plug-in
+ /// instance can parse the header data already contained in
+ /// ObjectContainer::m_data. If an object file parser does not
+ /// recognize that magic bytes in a header, false should be returned
+ /// and the next plug-in can attempt to parse an object file.
+ ///
+ /// @return
+ /// Returns \b true if the header was parsed successfully, \b
+ /// false otherwise.
+ //------------------------------------------------------------------
+ virtual bool ParseHeader() = 0;
+
+ //------------------------------------------------------------------
+ /// Selects an architecture in an object file.
+ ///
+ /// Object files that contain a single architecture should verify
+ /// that the specified \a arch matches the architecture in in
+ /// object file and return \b true or \b false accordingly.
+ ///
+ /// Object files that contain more than one architecture should
+ /// attempt to select that architecture, and if successful, clear
+ /// out any previous state from any previously selected architecture
+ /// and prepare to return information for the new architecture.
+ ///
+ /// @return
+ /// Returns a pointer to the object file of the requested \a
+ /// arch and optional \a name. Returns nullptr of no such object
+ /// file exists in the container.
+ //------------------------------------------------------------------
+ virtual lldb::ObjectFileSP GetObjectFile(const FileSpec *file) = 0;
+
+ virtual bool ObjectAtIndexIsContainer(uint32_t object_idx) { return false; }
+
+ virtual ObjectFile *GetObjectFileAtIndex(uint32_t object_idx) {
+ return nullptr;
+ }
+
+ virtual ObjectContainer *GetObjectContainerAtIndex(uint32_t object_idx) {
+ return nullptr;
+ }
+
+ virtual const char *GetObjectNameAtIndex(uint32_t object_idx) const {
+ return nullptr;
+ }
protected:
- //------------------------------------------------------------------
- // Member variables.
- //------------------------------------------------------------------
- FileSpec m_file; ///< The file that represents this container objects (which can be different from the module's file).
- lldb::addr_t m_offset; ///< The offset in bytes into the file, or the address in memory
- lldb::addr_t m_length; ///< The size in bytes if known (can be zero).
- DataExtractor m_data; ///< The data for this object file so things can be parsed lazily.
+ //------------------------------------------------------------------
+ // Member variables.
+ //------------------------------------------------------------------
+ FileSpec m_file; ///< The file that represents this container objects (which
+ ///can be different from the module's file).
+ lldb::addr_t
+ m_offset; ///< The offset in bytes into the file, or the address in memory
+ lldb::addr_t m_length; ///< The size in bytes if known (can be zero).
+ DataExtractor
+ m_data; ///< The data for this object file so things can be parsed lazily.
private:
- DISALLOW_COPY_AND_ASSIGN (ObjectContainer);
+ DISALLOW_COPY_AND_ASSIGN(ObjectContainer);
};
} // namespace lldb_private
Modified: lldb/trunk/include/lldb/Symbol/ObjectFile.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Symbol/ObjectFile.h?rev=280751&r1=280750&r2=280751&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Symbol/ObjectFile.h (original)
+++ lldb/trunk/include/lldb/Symbol/ObjectFile.h Tue Sep 6 15:57:50 2016
@@ -10,46 +10,35 @@
#ifndef liblldb_ObjectFile_h_
#define liblldb_ObjectFile_h_
-#include "lldb/lldb-private.h"
#include "lldb/Core/DataExtractor.h"
-#include "lldb/Host/FileSpec.h"
#include "lldb/Core/FileSpecList.h"
#include "lldb/Core/ModuleChild.h"
#include "lldb/Core/PluginInterface.h"
#include "lldb/Host/Endian.h"
+#include "lldb/Host/FileSpec.h"
#include "lldb/Symbol/Symtab.h"
#include "lldb/Symbol/UnwindTable.h"
+#include "lldb/lldb-private.h"
namespace lldb_private {
-
-class ObjectFileJITDelegate
-{
+
+class ObjectFileJITDelegate {
public:
- ObjectFileJITDelegate ()
- {
- }
-
- virtual
- ~ObjectFileJITDelegate()
- {
- }
-
- virtual lldb::ByteOrder
- GetByteOrder () const = 0;
-
- virtual uint32_t
- GetAddressByteSize () const = 0;
-
- virtual void
- PopulateSymtab (lldb_private::ObjectFile *obj_file,
- lldb_private::Symtab &symtab) = 0;
-
- virtual void
- PopulateSectionList (lldb_private::ObjectFile *obj_file,
- lldb_private::SectionList §ion_list) = 0;
-
- virtual bool
- GetArchitecture (lldb_private::ArchSpec &arch) = 0;
+ ObjectFileJITDelegate() {}
+
+ virtual ~ObjectFileJITDelegate() {}
+
+ virtual lldb::ByteOrder GetByteOrder() const = 0;
+
+ virtual uint32_t GetAddressByteSize() const = 0;
+
+ virtual void PopulateSymtab(lldb_private::ObjectFile *obj_file,
+ lldb_private::Symtab &symtab) = 0;
+
+ virtual void PopulateSectionList(lldb_private::ObjectFile *obj_file,
+ lldb_private::SectionList §ion_list) = 0;
+
+ virtual bool GetArchitecture(lldb_private::ArchSpec &arch) = 0;
};
//----------------------------------------------------------------------
@@ -68,849 +57,764 @@ public:
/// Once an architecture is selected the object file information can be
/// extracted from this abstract class.
//----------------------------------------------------------------------
-class ObjectFile:
- public std::enable_shared_from_this<ObjectFile>,
- public PluginInterface,
- public ModuleChild
-{
-friend class lldb_private::Module;
+class ObjectFile : public std::enable_shared_from_this<ObjectFile>,
+ public PluginInterface,
+ public ModuleChild {
+ friend class lldb_private::Module;
public:
- typedef enum
- {
- eTypeInvalid = 0,
- eTypeCoreFile, /// A core file that has a checkpoint of a program's execution state
- eTypeExecutable, /// A normal executable
- eTypeDebugInfo, /// An object file that contains only debug information
- eTypeDynamicLinker, /// The platform's dynamic linker executable
- eTypeObjectFile, /// An intermediate object file
- eTypeSharedLibrary, /// A shared library that can be used during execution
- eTypeStubLibrary, /// A library that can be linked against but not used for execution
- eTypeJIT, /// JIT code that has symbols, sections and possibly debug info
- eTypeUnknown
- } Type;
-
- typedef enum
- {
- eStrataInvalid = 0,
- eStrataUnknown,
- eStrataUser,
- eStrataKernel,
- eStrataRawImage,
- eStrataJIT
- } Strata;
-
- //------------------------------------------------------------------
- /// Construct with a parent module, offset, and header data.
- ///
- /// Object files belong to modules and a valid module must be
- /// supplied upon construction. The at an offset within a file for
- /// objects that contain more than one architecture or object.
- //------------------------------------------------------------------
- ObjectFile (const lldb::ModuleSP &module_sp,
- const FileSpec *file_spec_ptr,
- lldb::offset_t file_offset,
- lldb::offset_t length,
- const lldb::DataBufferSP& data_sp,
- lldb::offset_t data_offset);
-
- ObjectFile (const lldb::ModuleSP &module_sp,
- const lldb::ProcessSP &process_sp,
- lldb::addr_t header_addr,
- lldb::DataBufferSP& data_sp);
-
- //------------------------------------------------------------------
- /// Destructor.
- ///
- /// The destructor is virtual since this class is designed to be
- /// inherited from by the plug-in instance.
- //------------------------------------------------------------------
- ~ObjectFile() override;
-
- //------------------------------------------------------------------
- /// Dump a description of this object to a Stream.
- ///
- /// Dump a description of the current contents of this object
- /// to the supplied stream \a s. The dumping should include the
- /// section list if it has been parsed, and the symbol table
- /// if it has been parsed.
- ///
- /// @param[in] s
- /// The stream to which to dump the object description.
- //------------------------------------------------------------------
- virtual void
- Dump (Stream *s) = 0;
-
- //------------------------------------------------------------------
- /// Find a ObjectFile plug-in that can parse \a file_spec.
- ///
- /// Scans all loaded plug-in interfaces that implement versions of
- /// the ObjectFile plug-in interface and returns the first
- /// instance that can parse the file.
- ///
- /// @param[in] module
- /// The parent module that owns this object file.
- ///
- /// @param[in] file_spec
- /// A file specification that indicates which file to use as the
- /// object file.
- ///
- /// @param[in] file_offset
- /// The offset into the file at which to start parsing the
- /// object. This is for files that contain multiple
- /// architectures or objects.
- ///
- /// @param[in] file_size
- /// The size of the current object file if it can be determined
- /// or if it is known. This can be zero.
- ///
- /// @see ObjectFile::ParseHeader()
- //------------------------------------------------------------------
- static lldb::ObjectFileSP
- FindPlugin (const lldb::ModuleSP &module_sp,
- const FileSpec* file_spec,
- lldb::offset_t file_offset,
- lldb::offset_t file_size,
- lldb::DataBufferSP &data_sp,
- lldb::offset_t &data_offset);
-
- //------------------------------------------------------------------
- /// Find a ObjectFile plug-in that can parse a file in memory.
- ///
- /// Scans all loaded plug-in interfaces that implement versions of
- /// the ObjectFile plug-in interface and returns the first
- /// instance that can parse the file.
- ///
- /// @param[in] module
- /// The parent module that owns this object file.
- ///
- /// @param[in] process_sp
- /// A shared pointer to the process whose memory space contains
- /// an object file. This will be stored as a std::weak_ptr.
- ///
- /// @param[in] header_addr
- /// The address of the header for the object file in memory.
- //------------------------------------------------------------------
- static lldb::ObjectFileSP
- FindPlugin (const lldb::ModuleSP &module_sp,
- const lldb::ProcessSP &process_sp,
- lldb::addr_t header_addr,
- lldb::DataBufferSP &file_data_sp);
-
-
- static size_t
- GetModuleSpecifications (const FileSpec &file,
- lldb::offset_t file_offset,
- lldb::offset_t file_size,
- ModuleSpecList &specs);
-
- static size_t
- GetModuleSpecifications (const lldb_private::FileSpec& file,
- lldb::DataBufferSP& data_sp,
- lldb::offset_t data_offset,
- lldb::offset_t file_offset,
- lldb::offset_t file_size,
- lldb_private::ModuleSpecList &specs);
- //------------------------------------------------------------------
- /// Split a path into a file path with object name.
- ///
- /// For paths like "/tmp/foo.a(bar.o)" we often need to split a path
- /// up into the actual path name and into the object name so we can
- /// make a valid object file from it.
- ///
- /// @param[in] path_with_object
- /// A path that might contain an archive path with a .o file
- /// specified in parens in the basename of the path.
- ///
- /// @param[out] archive_file
- /// If \b true is returned, \a file_spec will be filled in with
- /// the path to the archive.
- ///
- /// @param[out] archive_object
- /// If \b true is returned, \a object will be filled in with
- /// the name of the object inside the archive.
- ///
- /// @return
- /// \b true if the path matches the pattern of archive + object
- /// and \a archive_file and \a archive_object are modified,
- /// \b false otherwise and \a archive_file and \a archive_object
- /// are guaranteed to be remain unchanged.
- //------------------------------------------------------------------
- static bool
- SplitArchivePathWithObject (const char *path_with_object,
- lldb_private::FileSpec &archive_file,
- lldb_private::ConstString &archive_object,
- bool must_exist);
-
- //------------------------------------------------------------------
- /// Gets the address size in bytes for the current object file.
- ///
- /// @return
- /// The size of an address in bytes for the currently selected
- /// architecture (and object for archives). Returns zero if no
- /// architecture or object has been selected.
- //------------------------------------------------------------------
- virtual uint32_t
- GetAddressByteSize () const = 0;
-
- //------------------------------------------------------------------
- /// Get the address type given a file address in an object file.
- ///
- /// Many binary file formats know what kinds
- /// This is primarily for ARM binaries, though it can be applied to
- /// any executable file format that supports different opcode types
- /// within the same binary. ARM binaries support having both ARM and
- /// Thumb within the same executable container. We need to be able
- /// to get
- /// @return
- /// The size of an address in bytes for the currently selected
- /// architecture (and object for archives). Returns zero if no
- /// architecture or object has been selected.
- //------------------------------------------------------------------
- virtual lldb::AddressClass
- GetAddressClass (lldb::addr_t file_addr);
-
- //------------------------------------------------------------------
- /// Extract the dependent modules from an object file.
- ///
- /// If an object file has information about which other images it
- /// depends on (such as shared libraries), this function will
- /// provide the list. Since many executables or shared libraries
- /// may depend on the same files,
- /// FileSpecList::AppendIfUnique(const FileSpec &) should be
- /// used to make sure any files that are added are not already in
- /// the list.
- ///
- /// @param[out] file_list
- /// A list of file specification objects that gets dependent
- /// files appended to.
- ///
- /// @return
- /// The number of new files that were appended to \a file_list.
- ///
- /// @see FileSpecList::AppendIfUnique(const FileSpec &)
- //------------------------------------------------------------------
- virtual uint32_t
- GetDependentModules (FileSpecList& file_list) = 0;
-
- //------------------------------------------------------------------
- /// Tells whether this object file is capable of being the main executable
- /// for a process.
- ///
- /// @return
- /// \b true if it is, \b false otherwise.
- //------------------------------------------------------------------
- virtual bool
- IsExecutable () const = 0;
-
- //------------------------------------------------------------------
- /// Returns the offset into a file at which this object resides.
- ///
- /// Some files contain many object files, and this function allows
- /// access to an object's offset within the file.
- ///
- /// @return
- /// The offset in bytes into the file. Defaults to zero for
- /// simple object files that a represented by an entire file.
- //------------------------------------------------------------------
- virtual lldb::addr_t
- GetFileOffset () const
- { return m_file_offset; }
-
- virtual lldb::addr_t
- GetByteSize () const
- { return m_length; }
-
- //------------------------------------------------------------------
- /// Get accessor to the object file specification.
- ///
- /// @return
- /// The file specification object pointer if there is one, or
- /// NULL if this object is only from memory.
- //------------------------------------------------------------------
- virtual FileSpec&
- GetFileSpec() { return m_file; }
-
- //------------------------------------------------------------------
- /// Get const accessor to the object file specification.
- ///
- /// @return
- /// The const file specification object pointer if there is one,
- /// or NULL if this object is only from memory.
- //------------------------------------------------------------------
- virtual const FileSpec&
- GetFileSpec() const { return m_file; }
-
- //------------------------------------------------------------------
- /// Get the name of the cpu, vendor and OS for this object file.
- ///
- /// This value is a string that represents the target triple where
- /// the cpu type, the vendor and the OS are encoded into a string.
- ///
- /// @param[out] target_triple
- /// The string value of the target triple.
- ///
- /// @return
- /// \b True if the target triple was able to be computed, \b
- /// false otherwise.
- //------------------------------------------------------------------
- virtual bool
- GetArchitecture (ArchSpec &arch) = 0;
-
- //------------------------------------------------------------------
- /// Gets the section list for the currently selected architecture
- /// (and object for archives).
- ///
- /// Section list parsing can be deferred by ObjectFile instances
- /// until this accessor is called the first time.
- ///
- /// @return
- /// The list of sections contained in this object file.
- //------------------------------------------------------------------
- virtual SectionList *
- GetSectionList (bool update_module_section_list = true);
-
- virtual void
- CreateSections (SectionList &unified_section_list) = 0;
-
- //------------------------------------------------------------------
- /// Notify the ObjectFile that the file addresses in the Sections
- /// for this module have been changed.
- //------------------------------------------------------------------
- virtual void
- SectionFileAddressesChanged ()
- {
- }
-
- //------------------------------------------------------------------
- /// Gets the symbol table for the currently selected architecture
- /// (and object for archives).
- ///
- /// Symbol table parsing can be deferred by ObjectFile instances
- /// until this accessor is called the first time.
- ///
- /// @return
- /// The symbol table for this object file.
- //------------------------------------------------------------------
- virtual Symtab *
- GetSymtab () = 0;
-
- //------------------------------------------------------------------
- /// Appends a Symbol for the specified so_addr to the symbol table.
- ///
- /// If verify_unique is false, the symbol table is not searched
- /// to determine if a Symbol found at this address has already been
- /// added to the symbol table. When verify_unique is true, this
- /// method resolves the Symbol as the first match in the SymbolTable
- /// and appends a Symbol only if required/found.
- ///
- /// @return
- /// The resolved symbol or nullptr. Returns nullptr if a
- /// a Symbol could not be found for the specified so_addr.
- //------------------------------------------------------------------
- virtual Symbol *
- ResolveSymbolForAddress(const Address &so_addr, bool verify_unique)
- {
- // Typically overridden to lazily add stripped symbols recoverable from
- // the exception handling unwind information (i.e. without parsing
- // the entire eh_frame section.
- //
- // The availability of LC_FUNCTION_STARTS allows ObjectFileMachO
- // to efficiently add stripped symbols when the symbol table is
- // first constructed. Poorer cousins are PECoff and ELF.
- return nullptr;
- }
-
- //------------------------------------------------------------------
- /// Detect if this object file has been stripped of local symbols.
- //------------------------------------------------------------------
- /// Detect if this object file has been stripped of local symbols.
- ///
- /// @return
- /// Return \b true if the object file has been stripped of local
- /// symbols.
- //------------------------------------------------------------------
- virtual bool
- IsStripped () = 0;
-
- //------------------------------------------------------------------
- /// Frees the symbol table.
- ///
- /// This function should only be used when an object file is
- ///
- /// @param[in] flags
- /// eSymtabFromUnifiedSectionList: Whether to clear symbol table
- /// for unified module section list, or object file.
- ///
- /// @return
- /// The symbol table for this object file.
- //------------------------------------------------------------------
- virtual void
- ClearSymtab ();
-
- //------------------------------------------------------------------
- /// Gets the UUID for this object file.
- ///
- /// If the object file format contains a UUID, the value should be
- /// returned. Else ObjectFile instances should return the MD5
- /// checksum of all of the bytes for the object file (or memory for
- /// memory based object files).
- ///
- /// @return
- /// Returns \b true if a UUID was successfully extracted into
- /// \a uuid, \b false otherwise.
- //------------------------------------------------------------------
- virtual bool
- GetUUID (lldb_private::UUID* uuid) = 0;
-
- //------------------------------------------------------------------
- /// Gets the symbol file spec list for this object file.
- ///
- /// If the object file format contains a debug symbol file link,
- /// the values will be returned in the FileSpecList.
- ///
- /// @return
- /// Returns filespeclist.
- //------------------------------------------------------------------
- virtual lldb_private::FileSpecList
- GetDebugSymbolFilePaths()
- {
- return FileSpecList();
- }
-
- //------------------------------------------------------------------
- /// Gets the file spec list of libraries re-exported by this object file.
- ///
- /// If the object file format has the notion of one library re-exporting the symbols from another,
- /// the re-exported libraries will be returned in the FileSpecList.
- ///
- /// @return
- /// Returns filespeclist.
- //------------------------------------------------------------------
- virtual lldb_private::FileSpecList
- GetReExportedLibraries ()
- {
- return FileSpecList();
- }
-
- //------------------------------------------------------------------
- /// Sets the load address for an entire module, assuming a rigid
- /// slide of sections, if possible in the implementation.
- ///
- /// @return
- /// Returns true iff any section's load address changed.
- //------------------------------------------------------------------
- virtual bool
- SetLoadAddress(Target &target,
- lldb::addr_t value,
- bool value_is_offset)
- {
- return false;
- }
-
- //------------------------------------------------------------------
- /// Gets whether endian swapping should occur when extracting data
- /// from this object file.
- ///
- /// @return
- /// Returns \b true if endian swapping is needed, \b false
- /// otherwise.
- //------------------------------------------------------------------
- virtual lldb::ByteOrder
- GetByteOrder () const = 0;
-
- //------------------------------------------------------------------
- /// Attempts to parse the object header.
- ///
- /// This function is used as a test to see if a given plug-in
- /// instance can parse the header data already contained in
- /// ObjectFile::m_data. If an object file parser does not
- /// recognize that magic bytes in a header, false should be returned
- /// and the next plug-in can attempt to parse an object file.
- ///
- /// @return
- /// Returns \b true if the header was parsed successfully, \b
- /// false otherwise.
- //------------------------------------------------------------------
- virtual bool
- ParseHeader () = 0;
-
- //------------------------------------------------------------------
- /// Returns a reference to the UnwindTable for this ObjectFile
- ///
- /// The UnwindTable contains FuncUnwinders objects for any function in
- /// this ObjectFile. If a FuncUnwinders object hasn't been created yet
- /// (i.e. the function has yet to be unwound in a stack walk), it
- /// will be created when requested. Specifically, we do not create
- /// FuncUnwinders objects for functions until they are needed.
- ///
- /// @return
- /// Returns the unwind table for this object file.
- //------------------------------------------------------------------
- virtual lldb_private::UnwindTable&
- GetUnwindTable () { return m_unwind_table; }
-
- //------------------------------------------------------------------
- /// Returns if the function bounds for symbols in this symbol file
- /// are likely accurate.
- ///
- /// The unwinder can emulate the instructions of functions to understand
- /// prologue/epilogue code sequences, where registers are spilled on
- /// the stack, etc. This feature relies on having the correct start
- /// addresses of all functions. If the ObjectFile has a way to tell
- /// that symbols have been stripped and there's no way to reconstruct
- /// start addresses (e.g. LC_FUNCTION_STARTS on Mach-O, or eh_frame
- /// unwind info), the ObjectFile should indicate that assembly emulation
- /// should not be used for this module.
- ///
- /// It is uncommon for this to return false. An ObjectFile needs to
- /// be sure that symbol start addresses are unavailable before false
- /// is returned. If it is unclear, this should return true.
- ///
- /// @return
- /// Returns true if assembly emulation should be used for this
- /// module.
- /// Only returns false if the ObjectFile is sure that symbol
- /// addresses are insufficient for accurate assembly emulation.
- //------------------------------------------------------------------
- virtual bool
- AllowAssemblyEmulationUnwindPlans ()
- {
- return true;
- }
-
- //------------------------------------------------------------------
- /// Similar to Process::GetImageInfoAddress().
- ///
- /// Some platforms embed auxiliary structures useful to debuggers in the
- /// address space of the inferior process. This method returns the address
- /// of such a structure if the information can be resolved via entries in
- /// the object file. ELF, for example, provides a means to hook into the
- /// runtime linker so that a debugger may monitor the loading and unloading
- /// of shared libraries.
- ///
- /// @return
- /// The address of any auxiliary tables, or an invalid address if this
- /// object file format does not support or contain such information.
- virtual lldb_private::Address
- GetImageInfoAddress (Target *target) { return Address(); }
-
- //------------------------------------------------------------------
- /// Returns the address of the Entry Point in this object file - if
- /// the object file doesn't have an entry point (because it is not an
- /// executable file) then an invalid address is returned.
- ///
- /// @return
- /// Returns the entry address for this module.
- //------------------------------------------------------------------
- virtual lldb_private::Address
- GetEntryPointAddress () { return Address();}
-
- //------------------------------------------------------------------
- /// Returns the address that represents the header of this object
- /// file.
- ///
- /// The header address is defined as where the header for the object
- /// file is that describes the content of the file. If the header
- /// doesn't appear in a section that is defined in the object file,
- /// an address with no section is returned that has the file offset
- /// set in the m_file_offset member of the lldb_private::Address object.
- ///
- /// @return
- /// Returns the entry address for this module.
- //------------------------------------------------------------------
- virtual lldb_private::Address
- GetHeaderAddress () { return Address(m_memory_addr);}
-
- virtual uint32_t
- GetNumThreadContexts ()
- {
- return 0;
- }
-
- virtual lldb::RegisterContextSP
- GetThreadContextAtIndex (uint32_t idx, lldb_private::Thread &thread)
- {
- return lldb::RegisterContextSP();
- }
-
- //------------------------------------------------------------------
- /// The object file should be able to calculate its type by looking
- /// at its file header and possibly the sections or other data in
- /// the object file. The file type is used in the debugger to help
- /// select the correct plug-ins for the job at hand, so this is
- /// important to get right. If any eTypeXXX definitions do not match
- /// up with the type of file you are loading, please feel free to
- /// add a new enumeration value.
- ///
- /// @return
- /// The calculated file type for the current object file.
- //------------------------------------------------------------------
- virtual Type
- CalculateType() = 0;
-
- //------------------------------------------------------------------
- /// In cases where the type can't be calculated (elf files), this
- /// routine allows someone to explicitly set it. As an example,
- /// SymbolVendorELF uses this routine to set eTypeDebugInfo when
- /// loading debug link files.
- virtual void
- SetType (Type type)
- {
- m_type = type;
- }
-
- //------------------------------------------------------------------
- /// The object file should be able to calculate the strata of the
- /// object file.
- ///
- /// Many object files for platforms might be for either user space
- /// debugging or for kernel debugging. If your object file subclass
- /// can figure this out, it will help with debugger plug-in selection
- /// when it comes time to debug.
- ///
- /// @return
- /// The calculated object file strata for the current object
- /// file.
- //------------------------------------------------------------------
- virtual Strata
- CalculateStrata() = 0;
-
- //------------------------------------------------------------------
- /// Get the object file version numbers.
- ///
- /// Many object files have a set of version numbers that describe
- /// the version of the executable or shared library. Typically there
- /// are major, minor and build, but there may be more. This function
- /// will extract the versions from object files if they are available.
- ///
- /// If \a versions is NULL, or if \a num_versions is 0, the return
- /// value will indicate how many version numbers are available in
- /// this object file. Then a subsequent call can be made to this
- /// function with a value of \a versions and \a num_versions that
- /// has enough storage to store some or all version numbers.
- ///
- /// @param[out] versions
- /// A pointer to an array of uint32_t types that is \a num_versions
- /// long. If this value is NULL, the return value will indicate
- /// how many version numbers are required for a subsequent call
- /// to this function so that all versions can be retrieved. If
- /// the value is non-NULL, then at most \a num_versions of the
- /// existing versions numbers will be filled into \a versions.
- /// If there is no version information available, \a versions
- /// will be filled with \a num_versions UINT32_MAX values
- /// and zero will be returned.
- ///
- /// @param[in] num_versions
- /// The maximum number of entries to fill into \a versions. If
- /// this value is zero, then the return value will indicate
- /// how many version numbers there are in total so another call
- /// to this function can be make with adequate storage in
- /// \a versions to get all of the version numbers. If \a
- /// num_versions is less than the actual number of version
- /// numbers in this object file, only \a num_versions will be
- /// filled into \a versions (if \a versions is non-NULL).
- ///
- /// @return
- /// This function always returns the number of version numbers
- /// that this object file has regardless of the number of
- /// version numbers that were copied into \a versions.
- //------------------------------------------------------------------
- virtual uint32_t
- GetVersion (uint32_t *versions, uint32_t num_versions)
- {
- if (versions && num_versions)
- {
- for (uint32_t i=0; i<num_versions; ++i)
- versions[i] = UINT32_MAX;
- }
- return 0;
- }
-
- //------------------------------------------------------------------
- /// Get the minimum OS version this object file can run on.
- ///
- /// Some object files have information that specifies the minimum OS
- /// version that they can be used on.
- ///
- /// If \a versions is NULL, or if \a num_versions is 0, the return
- /// value will indicate how many version numbers are available in
- /// this object file. Then a subsequent call can be made to this
- /// function with a value of \a versions and \a num_versions that
- /// has enough storage to store some or all version numbers.
- ///
- /// @param[out] versions
- /// A pointer to an array of uint32_t types that is \a num_versions
- /// long. If this value is NULL, the return value will indicate
- /// how many version numbers are required for a subsequent call
- /// to this function so that all versions can be retrieved. If
- /// the value is non-NULL, then at most \a num_versions of the
- /// existing versions numbers will be filled into \a versions.
- /// If there is no version information available, \a versions
- /// will be filled with \a num_versions UINT32_MAX values
- /// and zero will be returned.
- ///
- /// @param[in] num_versions
- /// The maximum number of entries to fill into \a versions. If
- /// this value is zero, then the return value will indicate
- /// how many version numbers there are in total so another call
- /// to this function can be make with adequate storage in
- /// \a versions to get all of the version numbers. If \a
- /// num_versions is less than the actual number of version
- /// numbers in this object file, only \a num_versions will be
- /// filled into \a versions (if \a versions is non-NULL).
- ///
- /// @return
- /// This function always returns the number of version numbers
- /// that this object file has regardless of the number of
- /// version numbers that were copied into \a versions.
- //------------------------------------------------------------------
- virtual uint32_t
- GetMinimumOSVersion (uint32_t *versions, uint32_t num_versions)
- {
- if (versions && num_versions)
- {
- for (uint32_t i=0; i<num_versions; ++i)
- versions[i] = UINT32_MAX;
- }
- return 0;
- }
-
- //------------------------------------------------------------------
- /// Get the SDK OS version this object file was built with.
- ///
- /// The versions arguments and returns values are the same as the
- /// GetMinimumOSVersion()
- //------------------------------------------------------------------
- virtual uint32_t
- GetSDKVersion (uint32_t *versions, uint32_t num_versions)
- {
- if (versions && num_versions)
- {
- for (uint32_t i=0; i<num_versions; ++i)
- versions[i] = UINT32_MAX;
- }
- return 0;
- }
-
- //------------------------------------------------------------------
- /// Return true if this file is a dynamic link editor (dyld)
- ///
- /// Often times dyld has symbols that mirror symbols in libc and
- /// other shared libraries (like "malloc" and "free") and the user
- /// does _not_ want to stop in these shared libraries by default.
- /// We can ask the ObjectFile if it is such a file and should be
- /// avoided for things like settings breakpoints and doing function
- /// lookups for expressions.
- //------------------------------------------------------------------
- virtual bool
- GetIsDynamicLinkEditor()
- {
- return false;
- }
-
- //------------------------------------------------------------------
- // Member Functions
- //------------------------------------------------------------------
- Type
- GetType ()
- {
- if (m_type == eTypeInvalid)
- m_type = CalculateType();
- return m_type;
- }
-
- Strata
- GetStrata ()
- {
- if (m_strata == eStrataInvalid)
- m_strata = CalculateStrata();
- return m_strata;
- }
-
- // When an object file is in memory, subclasses should try and lock
- // the process weak pointer. If the process weak pointer produces a
- // valid ProcessSP, then subclasses can call this function to read
- // memory.
- static lldb::DataBufferSP
- ReadMemory (const lldb::ProcessSP &process_sp,
- lldb::addr_t addr,
- size_t byte_size);
-
- size_t
- GetData (lldb::offset_t offset, size_t length, DataExtractor &data) const;
-
- size_t
- CopyData (lldb::offset_t offset, size_t length, void *dst) const;
-
- virtual size_t
- ReadSectionData (const Section *section,
- lldb::offset_t section_offset,
- void *dst,
- size_t dst_len) const;
-
- virtual size_t
- ReadSectionData (const Section *section,
- DataExtractor& section_data) const;
-
- size_t
- MemoryMapSectionData (const Section *section,
- DataExtractor& section_data) const;
-
- bool
- IsInMemory () const
- {
- return m_memory_addr != LLDB_INVALID_ADDRESS;
- }
-
- // Strip linker annotations (such as @@VERSION) from symbol names.
- virtual std::string
- StripLinkerSymbolAnnotations(llvm::StringRef symbol_name) const
- {
- return symbol_name.str();
- }
-
- static lldb::SymbolType
- GetSymbolTypeFromName (llvm::StringRef name,
- lldb::SymbolType symbol_type_hint = lldb::eSymbolTypeUndefined);
+ typedef enum {
+ eTypeInvalid = 0,
+ eTypeCoreFile, /// A core file that has a checkpoint of a program's
+ /// execution state
+ eTypeExecutable, /// A normal executable
+ eTypeDebugInfo, /// An object file that contains only debug information
+ eTypeDynamicLinker, /// The platform's dynamic linker executable
+ eTypeObjectFile, /// An intermediate object file
+ eTypeSharedLibrary, /// A shared library that can be used during execution
+ eTypeStubLibrary, /// A library that can be linked against but not used for
+ /// execution
+ eTypeJIT, /// JIT code that has symbols, sections and possibly debug info
+ eTypeUnknown
+ } Type;
+
+ typedef enum {
+ eStrataInvalid = 0,
+ eStrataUnknown,
+ eStrataUser,
+ eStrataKernel,
+ eStrataRawImage,
+ eStrataJIT
+ } Strata;
+
+ //------------------------------------------------------------------
+ /// Construct with a parent module, offset, and header data.
+ ///
+ /// Object files belong to modules and a valid module must be
+ /// supplied upon construction. The at an offset within a file for
+ /// objects that contain more than one architecture or object.
+ //------------------------------------------------------------------
+ ObjectFile(const lldb::ModuleSP &module_sp, const FileSpec *file_spec_ptr,
+ lldb::offset_t file_offset, lldb::offset_t length,
+ const lldb::DataBufferSP &data_sp, lldb::offset_t data_offset);
+
+ ObjectFile(const lldb::ModuleSP &module_sp, const lldb::ProcessSP &process_sp,
+ lldb::addr_t header_addr, lldb::DataBufferSP &data_sp);
+
+ //------------------------------------------------------------------
+ /// Destructor.
+ ///
+ /// The destructor is virtual since this class is designed to be
+ /// inherited from by the plug-in instance.
+ //------------------------------------------------------------------
+ ~ObjectFile() override;
+
+ //------------------------------------------------------------------
+ /// Dump a description of this object to a Stream.
+ ///
+ /// Dump a description of the current contents of this object
+ /// to the supplied stream \a s. The dumping should include the
+ /// section list if it has been parsed, and the symbol table
+ /// if it has been parsed.
+ ///
+ /// @param[in] s
+ /// The stream to which to dump the object description.
+ //------------------------------------------------------------------
+ virtual void Dump(Stream *s) = 0;
+
+ //------------------------------------------------------------------
+ /// Find a ObjectFile plug-in that can parse \a file_spec.
+ ///
+ /// Scans all loaded plug-in interfaces that implement versions of
+ /// the ObjectFile plug-in interface and returns the first
+ /// instance that can parse the file.
+ ///
+ /// @param[in] module
+ /// The parent module that owns this object file.
+ ///
+ /// @param[in] file_spec
+ /// A file specification that indicates which file to use as the
+ /// object file.
+ ///
+ /// @param[in] file_offset
+ /// The offset into the file at which to start parsing the
+ /// object. This is for files that contain multiple
+ /// architectures or objects.
+ ///
+ /// @param[in] file_size
+ /// The size of the current object file if it can be determined
+ /// or if it is known. This can be zero.
+ ///
+ /// @see ObjectFile::ParseHeader()
+ //------------------------------------------------------------------
+ static lldb::ObjectFileSP
+ FindPlugin(const lldb::ModuleSP &module_sp, const FileSpec *file_spec,
+ lldb::offset_t file_offset, lldb::offset_t file_size,
+ lldb::DataBufferSP &data_sp, lldb::offset_t &data_offset);
+
+ //------------------------------------------------------------------
+ /// Find a ObjectFile plug-in that can parse a file in memory.
+ ///
+ /// Scans all loaded plug-in interfaces that implement versions of
+ /// the ObjectFile plug-in interface and returns the first
+ /// instance that can parse the file.
+ ///
+ /// @param[in] module
+ /// The parent module that owns this object file.
+ ///
+ /// @param[in] process_sp
+ /// A shared pointer to the process whose memory space contains
+ /// an object file. This will be stored as a std::weak_ptr.
+ ///
+ /// @param[in] header_addr
+ /// The address of the header for the object file in memory.
+ //------------------------------------------------------------------
+ static lldb::ObjectFileSP FindPlugin(const lldb::ModuleSP &module_sp,
+ const lldb::ProcessSP &process_sp,
+ lldb::addr_t header_addr,
+ lldb::DataBufferSP &file_data_sp);
+
+ static size_t GetModuleSpecifications(const FileSpec &file,
+ lldb::offset_t file_offset,
+ lldb::offset_t file_size,
+ ModuleSpecList &specs);
+
+ static size_t GetModuleSpecifications(const lldb_private::FileSpec &file,
+ lldb::DataBufferSP &data_sp,
+ lldb::offset_t data_offset,
+ lldb::offset_t file_offset,
+ lldb::offset_t file_size,
+ lldb_private::ModuleSpecList &specs);
+ //------------------------------------------------------------------
+ /// Split a path into a file path with object name.
+ ///
+ /// For paths like "/tmp/foo.a(bar.o)" we often need to split a path
+ /// up into the actual path name and into the object name so we can
+ /// make a valid object file from it.
+ ///
+ /// @param[in] path_with_object
+ /// A path that might contain an archive path with a .o file
+ /// specified in parens in the basename of the path.
+ ///
+ /// @param[out] archive_file
+ /// If \b true is returned, \a file_spec will be filled in with
+ /// the path to the archive.
+ ///
+ /// @param[out] archive_object
+ /// If \b true is returned, \a object will be filled in with
+ /// the name of the object inside the archive.
+ ///
+ /// @return
+ /// \b true if the path matches the pattern of archive + object
+ /// and \a archive_file and \a archive_object are modified,
+ /// \b false otherwise and \a archive_file and \a archive_object
+ /// are guaranteed to be remain unchanged.
+ //------------------------------------------------------------------
+ static bool SplitArchivePathWithObject(
+ const char *path_with_object, lldb_private::FileSpec &archive_file,
+ lldb_private::ConstString &archive_object, bool must_exist);
+
+ //------------------------------------------------------------------
+ /// Gets the address size in bytes for the current object file.
+ ///
+ /// @return
+ /// The size of an address in bytes for the currently selected
+ /// architecture (and object for archives). Returns zero if no
+ /// architecture or object has been selected.
+ //------------------------------------------------------------------
+ virtual uint32_t GetAddressByteSize() const = 0;
+
+ //------------------------------------------------------------------
+ /// Get the address type given a file address in an object file.
+ ///
+ /// Many binary file formats know what kinds
+ /// This is primarily for ARM binaries, though it can be applied to
+ /// any executable file format that supports different opcode types
+ /// within the same binary. ARM binaries support having both ARM and
+ /// Thumb within the same executable container. We need to be able
+ /// to get
+ /// @return
+ /// The size of an address in bytes for the currently selected
+ /// architecture (and object for archives). Returns zero if no
+ /// architecture or object has been selected.
+ //------------------------------------------------------------------
+ virtual lldb::AddressClass GetAddressClass(lldb::addr_t file_addr);
+
+ //------------------------------------------------------------------
+ /// Extract the dependent modules from an object file.
+ ///
+ /// If an object file has information about which other images it
+ /// depends on (such as shared libraries), this function will
+ /// provide the list. Since many executables or shared libraries
+ /// may depend on the same files,
+ /// FileSpecList::AppendIfUnique(const FileSpec &) should be
+ /// used to make sure any files that are added are not already in
+ /// the list.
+ ///
+ /// @param[out] file_list
+ /// A list of file specification objects that gets dependent
+ /// files appended to.
+ ///
+ /// @return
+ /// The number of new files that were appended to \a file_list.
+ ///
+ /// @see FileSpecList::AppendIfUnique(const FileSpec &)
+ //------------------------------------------------------------------
+ virtual uint32_t GetDependentModules(FileSpecList &file_list) = 0;
+
+ //------------------------------------------------------------------
+ /// Tells whether this object file is capable of being the main executable
+ /// for a process.
+ ///
+ /// @return
+ /// \b true if it is, \b false otherwise.
+ //------------------------------------------------------------------
+ virtual bool IsExecutable() const = 0;
+
+ //------------------------------------------------------------------
+ /// Returns the offset into a file at which this object resides.
+ ///
+ /// Some files contain many object files, and this function allows
+ /// access to an object's offset within the file.
+ ///
+ /// @return
+ /// The offset in bytes into the file. Defaults to zero for
+ /// simple object files that a represented by an entire file.
+ //------------------------------------------------------------------
+ virtual lldb::addr_t GetFileOffset() const { return m_file_offset; }
+
+ virtual lldb::addr_t GetByteSize() const { return m_length; }
+
+ //------------------------------------------------------------------
+ /// Get accessor to the object file specification.
+ ///
+ /// @return
+ /// The file specification object pointer if there is one, or
+ /// NULL if this object is only from memory.
+ //------------------------------------------------------------------
+ virtual FileSpec &GetFileSpec() { return m_file; }
+
+ //------------------------------------------------------------------
+ /// Get const accessor to the object file specification.
+ ///
+ /// @return
+ /// The const file specification object pointer if there is one,
+ /// or NULL if this object is only from memory.
+ //------------------------------------------------------------------
+ virtual const FileSpec &GetFileSpec() const { return m_file; }
+
+ //------------------------------------------------------------------
+ /// Get the name of the cpu, vendor and OS for this object file.
+ ///
+ /// This value is a string that represents the target triple where
+ /// the cpu type, the vendor and the OS are encoded into a string.
+ ///
+ /// @param[out] target_triple
+ /// The string value of the target triple.
+ ///
+ /// @return
+ /// \b True if the target triple was able to be computed, \b
+ /// false otherwise.
+ //------------------------------------------------------------------
+ virtual bool GetArchitecture(ArchSpec &arch) = 0;
+
+ //------------------------------------------------------------------
+ /// Gets the section list for the currently selected architecture
+ /// (and object for archives).
+ ///
+ /// Section list parsing can be deferred by ObjectFile instances
+ /// until this accessor is called the first time.
+ ///
+ /// @return
+ /// The list of sections contained in this object file.
+ //------------------------------------------------------------------
+ virtual SectionList *GetSectionList(bool update_module_section_list = true);
+
+ virtual void CreateSections(SectionList &unified_section_list) = 0;
+
+ //------------------------------------------------------------------
+ /// Notify the ObjectFile that the file addresses in the Sections
+ /// for this module have been changed.
+ //------------------------------------------------------------------
+ virtual void SectionFileAddressesChanged() {}
+
+ //------------------------------------------------------------------
+ /// Gets the symbol table for the currently selected architecture
+ /// (and object for archives).
+ ///
+ /// Symbol table parsing can be deferred by ObjectFile instances
+ /// until this accessor is called the first time.
+ ///
+ /// @return
+ /// The symbol table for this object file.
+ //------------------------------------------------------------------
+ virtual Symtab *GetSymtab() = 0;
+
+ //------------------------------------------------------------------
+ /// Appends a Symbol for the specified so_addr to the symbol table.
+ ///
+ /// If verify_unique is false, the symbol table is not searched
+ /// to determine if a Symbol found at this address has already been
+ /// added to the symbol table. When verify_unique is true, this
+ /// method resolves the Symbol as the first match in the SymbolTable
+ /// and appends a Symbol only if required/found.
+ ///
+ /// @return
+ /// The resolved symbol or nullptr. Returns nullptr if a
+ /// a Symbol could not be found for the specified so_addr.
+ //------------------------------------------------------------------
+ virtual Symbol *ResolveSymbolForAddress(const Address &so_addr,
+ bool verify_unique) {
+ // Typically overridden to lazily add stripped symbols recoverable from
+ // the exception handling unwind information (i.e. without parsing
+ // the entire eh_frame section.
+ //
+ // The availability of LC_FUNCTION_STARTS allows ObjectFileMachO
+ // to efficiently add stripped symbols when the symbol table is
+ // first constructed. Poorer cousins are PECoff and ELF.
+ return nullptr;
+ }
+
+ //------------------------------------------------------------------
+ /// Detect if this object file has been stripped of local symbols.
+ //------------------------------------------------------------------
+ /// Detect if this object file has been stripped of local symbols.
+ ///
+ /// @return
+ /// Return \b true if the object file has been stripped of local
+ /// symbols.
+ //------------------------------------------------------------------
+ virtual bool IsStripped() = 0;
+
+ //------------------------------------------------------------------
+ /// Frees the symbol table.
+ ///
+ /// This function should only be used when an object file is
+ ///
+ /// @param[in] flags
+ /// eSymtabFromUnifiedSectionList: Whether to clear symbol table
+ /// for unified module section list, or object file.
+ ///
+ /// @return
+ /// The symbol table for this object file.
+ //------------------------------------------------------------------
+ virtual void ClearSymtab();
+
+ //------------------------------------------------------------------
+ /// Gets the UUID for this object file.
+ ///
+ /// If the object file format contains a UUID, the value should be
+ /// returned. Else ObjectFile instances should return the MD5
+ /// checksum of all of the bytes for the object file (or memory for
+ /// memory based object files).
+ ///
+ /// @return
+ /// Returns \b true if a UUID was successfully extracted into
+ /// \a uuid, \b false otherwise.
+ //------------------------------------------------------------------
+ virtual bool GetUUID(lldb_private::UUID *uuid) = 0;
+
+ //------------------------------------------------------------------
+ /// Gets the symbol file spec list for this object file.
+ ///
+ /// If the object file format contains a debug symbol file link,
+ /// the values will be returned in the FileSpecList.
+ ///
+ /// @return
+ /// Returns filespeclist.
+ //------------------------------------------------------------------
+ virtual lldb_private::FileSpecList GetDebugSymbolFilePaths() {
+ return FileSpecList();
+ }
+
+ //------------------------------------------------------------------
+ /// Gets the file spec list of libraries re-exported by this object file.
+ ///
+ /// If the object file format has the notion of one library re-exporting the
+ /// symbols from another,
+ /// the re-exported libraries will be returned in the FileSpecList.
+ ///
+ /// @return
+ /// Returns filespeclist.
+ //------------------------------------------------------------------
+ virtual lldb_private::FileSpecList GetReExportedLibraries() {
+ return FileSpecList();
+ }
+
+ //------------------------------------------------------------------
+ /// Sets the load address for an entire module, assuming a rigid
+ /// slide of sections, if possible in the implementation.
+ ///
+ /// @return
+ /// Returns true iff any section's load address changed.
+ //------------------------------------------------------------------
+ virtual bool SetLoadAddress(Target &target, lldb::addr_t value,
+ bool value_is_offset) {
+ return false;
+ }
+
+ //------------------------------------------------------------------
+ /// Gets whether endian swapping should occur when extracting data
+ /// from this object file.
+ ///
+ /// @return
+ /// Returns \b true if endian swapping is needed, \b false
+ /// otherwise.
+ //------------------------------------------------------------------
+ virtual lldb::ByteOrder GetByteOrder() const = 0;
+
+ //------------------------------------------------------------------
+ /// Attempts to parse the object header.
+ ///
+ /// This function is used as a test to see if a given plug-in
+ /// instance can parse the header data already contained in
+ /// ObjectFile::m_data. If an object file parser does not
+ /// recognize that magic bytes in a header, false should be returned
+ /// and the next plug-in can attempt to parse an object file.
+ ///
+ /// @return
+ /// Returns \b true if the header was parsed successfully, \b
+ /// false otherwise.
+ //------------------------------------------------------------------
+ virtual bool ParseHeader() = 0;
+
+ //------------------------------------------------------------------
+ /// Returns a reference to the UnwindTable for this ObjectFile
+ ///
+ /// The UnwindTable contains FuncUnwinders objects for any function in
+ /// this ObjectFile. If a FuncUnwinders object hasn't been created yet
+ /// (i.e. the function has yet to be unwound in a stack walk), it
+ /// will be created when requested. Specifically, we do not create
+ /// FuncUnwinders objects for functions until they are needed.
+ ///
+ /// @return
+ /// Returns the unwind table for this object file.
+ //------------------------------------------------------------------
+ virtual lldb_private::UnwindTable &GetUnwindTable() { return m_unwind_table; }
+
+ //------------------------------------------------------------------
+ /// Returns if the function bounds for symbols in this symbol file
+ /// are likely accurate.
+ ///
+ /// The unwinder can emulate the instructions of functions to understand
+ /// prologue/epilogue code sequences, where registers are spilled on
+ /// the stack, etc. This feature relies on having the correct start
+ /// addresses of all functions. If the ObjectFile has a way to tell
+ /// that symbols have been stripped and there's no way to reconstruct
+ /// start addresses (e.g. LC_FUNCTION_STARTS on Mach-O, or eh_frame
+ /// unwind info), the ObjectFile should indicate that assembly emulation
+ /// should not be used for this module.
+ ///
+ /// It is uncommon for this to return false. An ObjectFile needs to
+ /// be sure that symbol start addresses are unavailable before false
+ /// is returned. If it is unclear, this should return true.
+ ///
+ /// @return
+ /// Returns true if assembly emulation should be used for this
+ /// module.
+ /// Only returns false if the ObjectFile is sure that symbol
+ /// addresses are insufficient for accurate assembly emulation.
+ //------------------------------------------------------------------
+ virtual bool AllowAssemblyEmulationUnwindPlans() { return true; }
+
+ //------------------------------------------------------------------
+ /// Similar to Process::GetImageInfoAddress().
+ ///
+ /// Some platforms embed auxiliary structures useful to debuggers in the
+ /// address space of the inferior process. This method returns the address
+ /// of such a structure if the information can be resolved via entries in
+ /// the object file. ELF, for example, provides a means to hook into the
+ /// runtime linker so that a debugger may monitor the loading and unloading
+ /// of shared libraries.
+ ///
+ /// @return
+ /// The address of any auxiliary tables, or an invalid address if this
+ /// object file format does not support or contain such information.
+ virtual lldb_private::Address GetImageInfoAddress(Target *target) {
+ return Address();
+ }
+
+ //------------------------------------------------------------------
+ /// Returns the address of the Entry Point in this object file - if
+ /// the object file doesn't have an entry point (because it is not an
+ /// executable file) then an invalid address is returned.
+ ///
+ /// @return
+ /// Returns the entry address for this module.
+ //------------------------------------------------------------------
+ virtual lldb_private::Address GetEntryPointAddress() { return Address(); }
+
+ //------------------------------------------------------------------
+ /// Returns the address that represents the header of this object
+ /// file.
+ ///
+ /// The header address is defined as where the header for the object
+ /// file is that describes the content of the file. If the header
+ /// doesn't appear in a section that is defined in the object file,
+ /// an address with no section is returned that has the file offset
+ /// set in the m_file_offset member of the lldb_private::Address object.
+ ///
+ /// @return
+ /// Returns the entry address for this module.
+ //------------------------------------------------------------------
+ virtual lldb_private::Address GetHeaderAddress() {
+ return Address(m_memory_addr);
+ }
+
+ virtual uint32_t GetNumThreadContexts() { return 0; }
+
+ virtual lldb::RegisterContextSP
+ GetThreadContextAtIndex(uint32_t idx, lldb_private::Thread &thread) {
+ return lldb::RegisterContextSP();
+ }
+
+ //------------------------------------------------------------------
+ /// The object file should be able to calculate its type by looking
+ /// at its file header and possibly the sections or other data in
+ /// the object file. The file type is used in the debugger to help
+ /// select the correct plug-ins for the job at hand, so this is
+ /// important to get right. If any eTypeXXX definitions do not match
+ /// up with the type of file you are loading, please feel free to
+ /// add a new enumeration value.
+ ///
+ /// @return
+ /// The calculated file type for the current object file.
+ //------------------------------------------------------------------
+ virtual Type CalculateType() = 0;
+
+ //------------------------------------------------------------------
+ /// In cases where the type can't be calculated (elf files), this
+ /// routine allows someone to explicitly set it. As an example,
+ /// SymbolVendorELF uses this routine to set eTypeDebugInfo when
+ /// loading debug link files.
+ virtual void SetType(Type type) { m_type = type; }
+
+ //------------------------------------------------------------------
+ /// The object file should be able to calculate the strata of the
+ /// object file.
+ ///
+ /// Many object files for platforms might be for either user space
+ /// debugging or for kernel debugging. If your object file subclass
+ /// can figure this out, it will help with debugger plug-in selection
+ /// when it comes time to debug.
+ ///
+ /// @return
+ /// The calculated object file strata for the current object
+ /// file.
+ //------------------------------------------------------------------
+ virtual Strata CalculateStrata() = 0;
+
+ //------------------------------------------------------------------
+ /// Get the object file version numbers.
+ ///
+ /// Many object files have a set of version numbers that describe
+ /// the version of the executable or shared library. Typically there
+ /// are major, minor and build, but there may be more. This function
+ /// will extract the versions from object files if they are available.
+ ///
+ /// If \a versions is NULL, or if \a num_versions is 0, the return
+ /// value will indicate how many version numbers are available in
+ /// this object file. Then a subsequent call can be made to this
+ /// function with a value of \a versions and \a num_versions that
+ /// has enough storage to store some or all version numbers.
+ ///
+ /// @param[out] versions
+ /// A pointer to an array of uint32_t types that is \a num_versions
+ /// long. If this value is NULL, the return value will indicate
+ /// how many version numbers are required for a subsequent call
+ /// to this function so that all versions can be retrieved. If
+ /// the value is non-NULL, then at most \a num_versions of the
+ /// existing versions numbers will be filled into \a versions.
+ /// If there is no version information available, \a versions
+ /// will be filled with \a num_versions UINT32_MAX values
+ /// and zero will be returned.
+ ///
+ /// @param[in] num_versions
+ /// The maximum number of entries to fill into \a versions. If
+ /// this value is zero, then the return value will indicate
+ /// how many version numbers there are in total so another call
+ /// to this function can be make with adequate storage in
+ /// \a versions to get all of the version numbers. If \a
+ /// num_versions is less than the actual number of version
+ /// numbers in this object file, only \a num_versions will be
+ /// filled into \a versions (if \a versions is non-NULL).
+ ///
+ /// @return
+ /// This function always returns the number of version numbers
+ /// that this object file has regardless of the number of
+ /// version numbers that were copied into \a versions.
+ //------------------------------------------------------------------
+ virtual uint32_t GetVersion(uint32_t *versions, uint32_t num_versions) {
+ if (versions && num_versions) {
+ for (uint32_t i = 0; i < num_versions; ++i)
+ versions[i] = UINT32_MAX;
+ }
+ return 0;
+ }
+
+ //------------------------------------------------------------------
+ /// Get the minimum OS version this object file can run on.
+ ///
+ /// Some object files have information that specifies the minimum OS
+ /// version that they can be used on.
+ ///
+ /// If \a versions is NULL, or if \a num_versions is 0, the return
+ /// value will indicate how many version numbers are available in
+ /// this object file. Then a subsequent call can be made to this
+ /// function with a value of \a versions and \a num_versions that
+ /// has enough storage to store some or all version numbers.
+ ///
+ /// @param[out] versions
+ /// A pointer to an array of uint32_t types that is \a num_versions
+ /// long. If this value is NULL, the return value will indicate
+ /// how many version numbers are required for a subsequent call
+ /// to this function so that all versions can be retrieved. If
+ /// the value is non-NULL, then at most \a num_versions of the
+ /// existing versions numbers will be filled into \a versions.
+ /// If there is no version information available, \a versions
+ /// will be filled with \a num_versions UINT32_MAX values
+ /// and zero will be returned.
+ ///
+ /// @param[in] num_versions
+ /// The maximum number of entries to fill into \a versions. If
+ /// this value is zero, then the return value will indicate
+ /// how many version numbers there are in total so another call
+ /// to this function can be make with adequate storage in
+ /// \a versions to get all of the version numbers. If \a
+ /// num_versions is less than the actual number of version
+ /// numbers in this object file, only \a num_versions will be
+ /// filled into \a versions (if \a versions is non-NULL).
+ ///
+ /// @return
+ /// This function always returns the number of version numbers
+ /// that this object file has regardless of the number of
+ /// version numbers that were copied into \a versions.
+ //------------------------------------------------------------------
+ virtual uint32_t GetMinimumOSVersion(uint32_t *versions,
+ uint32_t num_versions) {
+ if (versions && num_versions) {
+ for (uint32_t i = 0; i < num_versions; ++i)
+ versions[i] = UINT32_MAX;
+ }
+ return 0;
+ }
+
+ //------------------------------------------------------------------
+ /// Get the SDK OS version this object file was built with.
+ ///
+ /// The versions arguments and returns values are the same as the
+ /// GetMinimumOSVersion()
+ //------------------------------------------------------------------
+ virtual uint32_t GetSDKVersion(uint32_t *versions, uint32_t num_versions) {
+ if (versions && num_versions) {
+ for (uint32_t i = 0; i < num_versions; ++i)
+ versions[i] = UINT32_MAX;
+ }
+ return 0;
+ }
+
+ //------------------------------------------------------------------
+ /// Return true if this file is a dynamic link editor (dyld)
+ ///
+ /// Often times dyld has symbols that mirror symbols in libc and
+ /// other shared libraries (like "malloc" and "free") and the user
+ /// does _not_ want to stop in these shared libraries by default.
+ /// We can ask the ObjectFile if it is such a file and should be
+ /// avoided for things like settings breakpoints and doing function
+ /// lookups for expressions.
+ //------------------------------------------------------------------
+ virtual bool GetIsDynamicLinkEditor() { return false; }
+
+ //------------------------------------------------------------------
+ // Member Functions
+ //------------------------------------------------------------------
+ Type GetType() {
+ if (m_type == eTypeInvalid)
+ m_type = CalculateType();
+ return m_type;
+ }
+
+ Strata GetStrata() {
+ if (m_strata == eStrataInvalid)
+ m_strata = CalculateStrata();
+ return m_strata;
+ }
+
+ // When an object file is in memory, subclasses should try and lock
+ // the process weak pointer. If the process weak pointer produces a
+ // valid ProcessSP, then subclasses can call this function to read
+ // memory.
+ static lldb::DataBufferSP ReadMemory(const lldb::ProcessSP &process_sp,
+ lldb::addr_t addr, size_t byte_size);
+
+ size_t GetData(lldb::offset_t offset, size_t length,
+ DataExtractor &data) const;
+
+ size_t CopyData(lldb::offset_t offset, size_t length, void *dst) const;
+
+ virtual size_t ReadSectionData(const Section *section,
+ lldb::offset_t section_offset, void *dst,
+ size_t dst_len) const;
+
+ virtual size_t ReadSectionData(const Section *section,
+ DataExtractor §ion_data) const;
+
+ size_t MemoryMapSectionData(const Section *section,
+ DataExtractor §ion_data) const;
+
+ bool IsInMemory() const { return m_memory_addr != LLDB_INVALID_ADDRESS; }
+
+ // Strip linker annotations (such as @@VERSION) from symbol names.
+ virtual std::string
+ StripLinkerSymbolAnnotations(llvm::StringRef symbol_name) const {
+ return symbol_name.str();
+ }
+
+ static lldb::SymbolType GetSymbolTypeFromName(
+ llvm::StringRef name,
+ lldb::SymbolType symbol_type_hint = lldb::eSymbolTypeUndefined);
protected:
- //------------------------------------------------------------------
- // Member variables.
- //------------------------------------------------------------------
- FileSpec m_file;
- Type m_type;
- Strata m_strata;
- lldb::addr_t m_file_offset; ///< The offset in bytes into the file, or the address in memory
- lldb::addr_t m_length; ///< The length of this object file if it is known (can be zero if length is unknown or can't be determined).
- DataExtractor m_data; ///< The data for this object file so things can be parsed lazily.
- lldb_private::UnwindTable m_unwind_table; /// < Table of FuncUnwinders objects created for this ObjectFile's functions
- lldb::ProcessWP m_process_wp;
- const lldb::addr_t m_memory_addr;
- std::unique_ptr<lldb_private::SectionList> m_sections_ap;
- std::unique_ptr<lldb_private::Symtab> m_symtab_ap;
- uint32_t m_synthetic_symbol_idx;
-
- //------------------------------------------------------------------
- /// Sets the architecture for a module. At present the architecture
- /// can only be set if it is invalid. It is not allowed to switch from
- /// one concrete architecture to another.
- ///
- /// @param[in] new_arch
- /// The architecture this module will be set to.
- ///
- /// @return
- /// Returns \b true if the architecture was changed, \b
- /// false otherwise.
- //------------------------------------------------------------------
- bool
- SetModulesArchitecture (const ArchSpec &new_arch);
+ //------------------------------------------------------------------
+ // Member variables.
+ //------------------------------------------------------------------
+ FileSpec m_file;
+ Type m_type;
+ Strata m_strata;
+ lldb::addr_t m_file_offset; ///< The offset in bytes into the file, or the
+ ///address in memory
+ lldb::addr_t m_length; ///< The length of this object file if it is known (can
+ ///be zero if length is unknown or can't be
+ ///determined).
+ DataExtractor
+ m_data; ///< The data for this object file so things can be parsed lazily.
+ lldb_private::UnwindTable m_unwind_table; /// < Table of FuncUnwinders objects
+ /// created for this ObjectFile's
+ /// functions
+ lldb::ProcessWP m_process_wp;
+ const lldb::addr_t m_memory_addr;
+ std::unique_ptr<lldb_private::SectionList> m_sections_ap;
+ std::unique_ptr<lldb_private::Symtab> m_symtab_ap;
+ uint32_t m_synthetic_symbol_idx;
+
+ //------------------------------------------------------------------
+ /// Sets the architecture for a module. At present the architecture
+ /// can only be set if it is invalid. It is not allowed to switch from
+ /// one concrete architecture to another.
+ ///
+ /// @param[in] new_arch
+ /// The architecture this module will be set to.
+ ///
+ /// @return
+ /// Returns \b true if the architecture was changed, \b
+ /// false otherwise.
+ //------------------------------------------------------------------
+ bool SetModulesArchitecture(const ArchSpec &new_arch);
- ConstString
- GetNextSyntheticSymbolName();
+ ConstString GetNextSyntheticSymbolName();
private:
- DISALLOW_COPY_AND_ASSIGN (ObjectFile);
+ DISALLOW_COPY_AND_ASSIGN(ObjectFile);
};
} // namespace lldb_private
Modified: lldb/trunk/include/lldb/Symbol/Symbol.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Symbol/Symbol.h?rev=280751&r1=280750&r2=280751&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Symbol/Symbol.h (original)
+++ lldb/trunk/include/lldb/Symbol/Symbol.h Tue Sep 6 15:57:50 2016
@@ -10,407 +10,272 @@
#ifndef liblldb_Symbol_h_
#define liblldb_Symbol_h_
-#include "lldb/lldb-private.h"
#include "lldb/Core/AddressRange.h"
#include "lldb/Core/Mangled.h"
#include "lldb/Core/UserID.h"
#include "lldb/Symbol/SymbolContextScope.h"
+#include "lldb/lldb-private.h"
namespace lldb_private {
-class Symbol :
- public SymbolContextScope
-{
+class Symbol : public SymbolContextScope {
public:
- // ObjectFile readers can classify their symbol table entries and searches can be made
- // on specific types where the symbol values will have drastically different meanings
- // and sorting requirements.
- Symbol();
-
- Symbol (uint32_t symID,
- const char *name,
- bool name_is_mangled,
- lldb::SymbolType type,
- bool external,
- bool is_debug,
- bool is_trampoline,
- bool is_artificial,
- const lldb::SectionSP §ion_sp,
- lldb::addr_t value,
- lldb::addr_t size,
- bool size_is_valid,
- bool contains_linker_annotations,
- uint32_t flags);
-
- Symbol (uint32_t symID,
- const Mangled &mangled,
- lldb::SymbolType type,
- bool external,
- bool is_debug,
- bool is_trampoline,
- bool is_artificial,
- const AddressRange &range,
- bool size_is_valid,
- bool contains_linker_annotations,
- uint32_t flags);
-
- Symbol (const Symbol& rhs);
-
- const Symbol&
- operator= (const Symbol& rhs);
-
- void
- Clear();
-
- bool
- Compare (const ConstString& name, lldb::SymbolType type) const;
-
- void
- Dump (Stream *s, Target *target, uint32_t index) const;
-
- bool
- ValueIsAddress() const;
-
- //------------------------------------------------------------------
- // The GetAddressRef() accessor functions should only be called if
- // you previously call ValueIsAddress() otherwise you might get an
- // reference to an Address object that contains an constant integer
- // value in m_addr_range.m_base_addr.m_offset which could be
- // incorrectly used to represent an absolute address since it has
- // no section.
- //------------------------------------------------------------------
- Address &
- GetAddressRef()
- {
- return m_addr_range.GetBaseAddress();
- }
+ // ObjectFile readers can classify their symbol table entries and searches can
+ // be made
+ // on specific types where the symbol values will have drastically different
+ // meanings
+ // and sorting requirements.
+ Symbol();
- const Address &
- GetAddressRef() const
- {
- return m_addr_range.GetBaseAddress();
- }
+ Symbol(uint32_t symID, const char *name, bool name_is_mangled,
+ lldb::SymbolType type, bool external, bool is_debug,
+ bool is_trampoline, bool is_artificial,
+ const lldb::SectionSP §ion_sp, lldb::addr_t value,
+ lldb::addr_t size, bool size_is_valid,
+ bool contains_linker_annotations, uint32_t flags);
- //------------------------------------------------------------------
- // Makes sure the symbol's value is an address and returns the file
- // address. Returns LLDB_INVALID_ADDRESS if the symbol's value isn't
- // an address.
- //------------------------------------------------------------------
- lldb::addr_t
- GetFileAddress () const;
-
- //------------------------------------------------------------------
- // Makes sure the symbol's value is an address and gets the load
- // address using \a target if it is. Returns LLDB_INVALID_ADDRESS
- // if the symbol's value isn't an address or if the section isn't
- // loaded in \a target.
- //------------------------------------------------------------------
- lldb::addr_t
- GetLoadAddress (Target *target) const;
-
- //------------------------------------------------------------------
- // Access the address value. Do NOT hand out the AddressRange as an
- // object as the byte size of the address range may not be filled in
- // and it should be accessed via GetByteSize().
- //------------------------------------------------------------------
- Address
- GetAddress() const
- {
- // Make sure the our value is an address before we hand a copy out.
- // We use the Address inside m_addr_range to contain the value for
- // symbols that are not address based symbols so we are using it
- // for more than just addresses. For example undefined symbols on
- // MacOSX have a nlist.n_value of 0 (zero) and this will get placed
- // into m_addr_range.m_base_addr.m_offset and it will have no section.
- // So in the GetAddress() accessor, we need to hand out an invalid
- // address if the symbol's value isn't an address.
- if (ValueIsAddress())
- return m_addr_range.GetBaseAddress();
- else
- return Address();
- }
+ Symbol(uint32_t symID, const Mangled &mangled, lldb::SymbolType type,
+ bool external, bool is_debug, bool is_trampoline, bool is_artificial,
+ const AddressRange &range, bool size_is_valid,
+ bool contains_linker_annotations, uint32_t flags);
- // When a symbol's value isn't an address, we need to access the raw
- // value. This function will ensure this symbol's value isn't an address
- // and return the integer value if this checks out, otherwise it will
- // return "fail_value" if the symbol is an address value.
- uint64_t
- GetIntegerValue (uint64_t fail_value = 0) const
- {
- if (ValueIsAddress())
- {
- // This symbol's value is an address. Use Symbol::GetAddress() to get the address.
- return fail_value;
- }
- else
- {
- // The value is stored in the base address' offset
- return m_addr_range.GetBaseAddress().GetOffset();
- }
- }
+ Symbol(const Symbol &rhs);
- lldb::addr_t
- ResolveCallableAddress(Target &target) const;
+ const Symbol &operator=(const Symbol &rhs);
- ConstString
- GetName () const;
+ void Clear();
- ConstString
- GetNameNoArguments () const;
+ bool Compare(const ConstString &name, lldb::SymbolType type) const;
- ConstString
- GetDisplayName () const;
-
- uint32_t
- GetID() const
- {
- return m_uid;
- }
+ void Dump(Stream *s, Target *target, uint32_t index) const;
- lldb::LanguageType
- GetLanguage() const
- {
- // TODO: See if there is a way to determine the language for a symbol somehow, for now just return our best guess
- return m_mangled.GuessLanguage();
- }
+ bool ValueIsAddress() const;
- void
- SetID(uint32_t uid)
- {
- m_uid = uid;
- }
+ //------------------------------------------------------------------
+ // The GetAddressRef() accessor functions should only be called if
+ // you previously call ValueIsAddress() otherwise you might get an
+ // reference to an Address object that contains an constant integer
+ // value in m_addr_range.m_base_addr.m_offset which could be
+ // incorrectly used to represent an absolute address since it has
+ // no section.
+ //------------------------------------------------------------------
+ Address &GetAddressRef() { return m_addr_range.GetBaseAddress(); }
- Mangled&
- GetMangled ()
- {
- return m_mangled;
- }
+ const Address &GetAddressRef() const { return m_addr_range.GetBaseAddress(); }
- const Mangled&
- GetMangled () const
- {
- return m_mangled;
- }
+ //------------------------------------------------------------------
+ // Makes sure the symbol's value is an address and returns the file
+ // address. Returns LLDB_INVALID_ADDRESS if the symbol's value isn't
+ // an address.
+ //------------------------------------------------------------------
+ lldb::addr_t GetFileAddress() const;
- ConstString
- GetReExportedSymbolName() const;
+ //------------------------------------------------------------------
+ // Makes sure the symbol's value is an address and gets the load
+ // address using \a target if it is. Returns LLDB_INVALID_ADDRESS
+ // if the symbol's value isn't an address or if the section isn't
+ // loaded in \a target.
+ //------------------------------------------------------------------
+ lldb::addr_t GetLoadAddress(Target *target) const;
- FileSpec
- GetReExportedSymbolSharedLibrary () const;
-
- void
- SetReExportedSymbolName(const ConstString &name);
-
- bool
- SetReExportedSymbolSharedLibrary (const FileSpec &fspec);
-
- Symbol *
- ResolveReExportedSymbol (Target &target) const;
-
- uint32_t
- GetSiblingIndex () const;
-
- lldb::SymbolType
- GetType () const
- {
- return (lldb::SymbolType)m_type;
- }
+ //------------------------------------------------------------------
+ // Access the address value. Do NOT hand out the AddressRange as an
+ // object as the byte size of the address range may not be filled in
+ // and it should be accessed via GetByteSize().
+ //------------------------------------------------------------------
+ Address GetAddress() const {
+ // Make sure the our value is an address before we hand a copy out.
+ // We use the Address inside m_addr_range to contain the value for
+ // symbols that are not address based symbols so we are using it
+ // for more than just addresses. For example undefined symbols on
+ // MacOSX have a nlist.n_value of 0 (zero) and this will get placed
+ // into m_addr_range.m_base_addr.m_offset and it will have no section.
+ // So in the GetAddress() accessor, we need to hand out an invalid
+ // address if the symbol's value isn't an address.
+ if (ValueIsAddress())
+ return m_addr_range.GetBaseAddress();
+ else
+ return Address();
+ }
- void
- SetType (lldb::SymbolType type)
- {
- m_type = (lldb::SymbolType)type;
+ // When a symbol's value isn't an address, we need to access the raw
+ // value. This function will ensure this symbol's value isn't an address
+ // and return the integer value if this checks out, otherwise it will
+ // return "fail_value" if the symbol is an address value.
+ uint64_t GetIntegerValue(uint64_t fail_value = 0) const {
+ if (ValueIsAddress()) {
+ // This symbol's value is an address. Use Symbol::GetAddress() to get the
+ // address.
+ return fail_value;
+ } else {
+ // The value is stored in the base address' offset
+ return m_addr_range.GetBaseAddress().GetOffset();
}
+ }
- const char *
- GetTypeAsString () const;
+ lldb::addr_t ResolveCallableAddress(Target &target) const;
- uint32_t
- GetFlags () const
- {
- return m_flags;
- }
+ ConstString GetName() const;
- void
- SetFlags (uint32_t flags)
- {
- m_flags = flags;
- }
+ ConstString GetNameNoArguments() const;
- void
- GetDescription (Stream *s, lldb::DescriptionLevel level, Target *target) const;
+ ConstString GetDisplayName() const;
- bool
- IsSynthetic () const
- {
- return m_is_synthetic;
- }
+ uint32_t GetID() const { return m_uid; }
- void
- SetIsSynthetic (bool b)
- {
- m_is_synthetic = b;
- }
+ lldb::LanguageType GetLanguage() const {
+ // TODO: See if there is a way to determine the language for a symbol
+ // somehow, for now just return our best guess
+ return m_mangled.GuessLanguage();
+ }
-
- bool
- GetSizeIsSynthesized() const
- {
- return m_size_is_synthesized;
- }
-
- void
- SetSizeIsSynthesized(bool b)
- {
- m_size_is_synthesized = b;
- }
+ void SetID(uint32_t uid) { m_uid = uid; }
- bool
- IsDebug () const
- {
- return m_is_debug;
- }
+ Mangled &GetMangled() { return m_mangled; }
- void
- SetDebug (bool b)
- {
- m_is_debug = b;
- }
+ const Mangled &GetMangled() const { return m_mangled; }
- bool
- IsExternal () const
- {
- return m_is_external;
- }
+ ConstString GetReExportedSymbolName() const;
- void
- SetExternal (bool b)
- {
- m_is_external = b;
- }
+ FileSpec GetReExportedSymbolSharedLibrary() const;
- bool
- IsTrampoline () const;
+ void SetReExportedSymbolName(const ConstString &name);
- bool
- IsIndirect () const;
+ bool SetReExportedSymbolSharedLibrary(const FileSpec &fspec);
- bool
- GetByteSizeIsValid () const
- {
- return m_size_is_valid;
- }
+ Symbol *ResolveReExportedSymbol(Target &target) const;
- lldb::addr_t
- GetByteSize () const;
-
- void
- SetByteSize (lldb::addr_t size)
- {
- m_size_is_valid = size > 0;
- m_addr_range.SetByteSize(size);
- }
+ uint32_t GetSiblingIndex() const;
- bool
- GetSizeIsSibling () const
- {
- return m_size_is_sibling;
- }
+ lldb::SymbolType GetType() const { return (lldb::SymbolType)m_type; }
- void
- SetSizeIsSibling (bool b)
- {
- m_size_is_sibling = b;
- }
+ void SetType(lldb::SymbolType type) { m_type = (lldb::SymbolType)type; }
- // If m_type is "Code" or "Function" then this will return the prologue size
- // in bytes, else it will return zero.
- uint32_t
- GetPrologueByteSize ();
-
- bool
- GetDemangledNameIsSynthesized() const
- {
- return m_demangled_is_synthesized;
- }
+ const char *GetTypeAsString() const;
- void
- SetDemangledNameIsSynthesized(bool b)
- {
- m_demangled_is_synthesized = b;
- }
+ uint32_t GetFlags() const { return m_flags; }
- bool
- ContainsLinkerAnnotations() const
- {
- return m_contains_linker_annotations;
- }
- void
- SetContainsLinkerAnnotations(bool b)
- {
- m_contains_linker_annotations = b;
- }
- //------------------------------------------------------------------
- /// @copydoc SymbolContextScope::CalculateSymbolContext(SymbolContext*)
- ///
- /// @see SymbolContextScope
- //------------------------------------------------------------------
- void
- CalculateSymbolContext(SymbolContext *sc) override;
-
- lldb::ModuleSP
- CalculateSymbolContextModule() override;
-
- Symbol *
- CalculateSymbolContextSymbol() override;
-
- //------------------------------------------------------------------
- /// @copydoc SymbolContextScope::DumpSymbolContext(Stream*)
- ///
- /// @see SymbolContextScope
- //------------------------------------------------------------------
- void
- DumpSymbolContext(Stream *s) override;
-
- lldb::DisassemblerSP
- GetInstructions (const ExecutionContext &exe_ctx,
- const char *flavor,
- bool prefer_file_cache);
-
- bool
- GetDisassembly (const ExecutionContext &exe_ctx,
- const char *flavor,
- bool prefer_file_cache,
- Stream &strm);
+ void SetFlags(uint32_t flags) { m_flags = flags; }
+
+ void GetDescription(Stream *s, lldb::DescriptionLevel level,
+ Target *target) const;
+
+ bool IsSynthetic() const { return m_is_synthetic; }
+
+ void SetIsSynthetic(bool b) { m_is_synthetic = b; }
+
+ bool GetSizeIsSynthesized() const { return m_size_is_synthesized; }
+
+ void SetSizeIsSynthesized(bool b) { m_size_is_synthesized = b; }
+
+ bool IsDebug() const { return m_is_debug; }
+
+ void SetDebug(bool b) { m_is_debug = b; }
+
+ bool IsExternal() const { return m_is_external; }
+
+ void SetExternal(bool b) { m_is_external = b; }
+
+ bool IsTrampoline() const;
+
+ bool IsIndirect() const;
+
+ bool GetByteSizeIsValid() const { return m_size_is_valid; }
+
+ lldb::addr_t GetByteSize() const;
+
+ void SetByteSize(lldb::addr_t size) {
+ m_size_is_valid = size > 0;
+ m_addr_range.SetByteSize(size);
+ }
+
+ bool GetSizeIsSibling() const { return m_size_is_sibling; }
+
+ void SetSizeIsSibling(bool b) { m_size_is_sibling = b; }
+
+ // If m_type is "Code" or "Function" then this will return the prologue size
+ // in bytes, else it will return zero.
+ uint32_t GetPrologueByteSize();
+
+ bool GetDemangledNameIsSynthesized() const {
+ return m_demangled_is_synthesized;
+ }
+
+ void SetDemangledNameIsSynthesized(bool b) { m_demangled_is_synthesized = b; }
+
+ bool ContainsLinkerAnnotations() const {
+ return m_contains_linker_annotations;
+ }
+ void SetContainsLinkerAnnotations(bool b) {
+ m_contains_linker_annotations = b;
+ }
+ //------------------------------------------------------------------
+ /// @copydoc SymbolContextScope::CalculateSymbolContext(SymbolContext*)
+ ///
+ /// @see SymbolContextScope
+ //------------------------------------------------------------------
+ void CalculateSymbolContext(SymbolContext *sc) override;
+
+ lldb::ModuleSP CalculateSymbolContextModule() override;
+
+ Symbol *CalculateSymbolContextSymbol() override;
+
+ //------------------------------------------------------------------
+ /// @copydoc SymbolContextScope::DumpSymbolContext(Stream*)
+ ///
+ /// @see SymbolContextScope
+ //------------------------------------------------------------------
+ void DumpSymbolContext(Stream *s) override;
+
+ lldb::DisassemblerSP GetInstructions(const ExecutionContext &exe_ctx,
+ const char *flavor,
+ bool prefer_file_cache);
+
+ bool GetDisassembly(const ExecutionContext &exe_ctx, const char *flavor,
+ bool prefer_file_cache, Stream &strm);
- bool
- ContainsFileAddress (lldb::addr_t file_addr) const;
+ bool ContainsFileAddress(lldb::addr_t file_addr) const;
protected:
- // This is the internal guts of ResolveReExportedSymbol, it assumes reexport_name is not null, and that module_spec
- // is valid. We track the modules we've already seen to make sure we don't get caught in a cycle.
-
- Symbol *
- ResolveReExportedSymbolInModuleSpec (Target &target,
- ConstString &reexport_name,
- lldb_private::ModuleSpec &module_spec,
- lldb_private::ModuleList &seen_modules) const;
-
- uint32_t m_uid; // User ID (usually the original symbol table index)
- uint16_t m_type_data; // data specific to m_type
- uint16_t m_type_data_resolved:1, // True if the data in m_type_data has already been calculated
- m_is_synthetic:1, // non-zero if this symbol is not actually in the symbol table, but synthesized from other info in the object file.
- m_is_debug:1, // non-zero if this symbol is debug information in a symbol
- m_is_external:1, // non-zero if this symbol is globally visible
- m_size_is_sibling:1, // m_size contains the index of this symbol's sibling
- m_size_is_synthesized:1,// non-zero if this symbol's size was calculated using a delta between this symbol and the next
- m_size_is_valid:1,
- m_demangled_is_synthesized:1, // The demangled name was created should not be used for expressions or other lookups
- m_contains_linker_annotations:1, // The symbol name contains linker annotations, which are optional when doing name lookups
- m_type:7;
- Mangled m_mangled; // uniqued symbol name/mangled name pair
- AddressRange m_addr_range; // Contains the value, or the section offset address when the value is an address in a section, and the size (if any)
- uint32_t m_flags; // A copy of the flags from the original symbol table, the ObjectFile plug-in can interpret these
+ // This is the internal guts of ResolveReExportedSymbol, it assumes
+ // reexport_name is not null, and that module_spec
+ // is valid. We track the modules we've already seen to make sure we don't
+ // get caught in a cycle.
+
+ Symbol *ResolveReExportedSymbolInModuleSpec(
+ Target &target, ConstString &reexport_name,
+ lldb_private::ModuleSpec &module_spec,
+ lldb_private::ModuleList &seen_modules) const;
+
+ uint32_t m_uid; // User ID (usually the original symbol table index)
+ uint16_t m_type_data; // data specific to m_type
+ uint16_t m_type_data_resolved : 1, // True if the data in m_type_data has
+ // already been calculated
+ m_is_synthetic : 1, // non-zero if this symbol is not actually in the
+ // symbol table, but synthesized from other info in
+ // the object file.
+ m_is_debug : 1, // non-zero if this symbol is debug information in a
+ // symbol
+ m_is_external : 1, // non-zero if this symbol is globally visible
+ m_size_is_sibling : 1, // m_size contains the index of this symbol's
+ // sibling
+ m_size_is_synthesized : 1, // non-zero if this symbol's size was
+ // calculated using a delta between this symbol
+ // and the next
+ m_size_is_valid : 1,
+ m_demangled_is_synthesized : 1, // The demangled name was created should
+ // not be used for expressions or other
+ // lookups
+ m_contains_linker_annotations : 1, // The symbol name contains linker
+ // annotations, which are optional when
+ // doing name lookups
+ m_type : 7;
+ Mangled m_mangled; // uniqued symbol name/mangled name pair
+ AddressRange m_addr_range; // Contains the value, or the section offset
+ // address when the value is an address in a
+ // section, and the size (if any)
+ uint32_t m_flags; // A copy of the flags from the original symbol table, the
+ // ObjectFile plug-in can interpret these
};
} // namespace lldb_private
Modified: lldb/trunk/include/lldb/Symbol/SymbolContext.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Symbol/SymbolContext.h?rev=280751&r1=280750&r2=280751&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Symbol/SymbolContext.h (original)
+++ lldb/trunk/include/lldb/Symbol/SymbolContext.h Tue Sep 6 15:57:50 2016
@@ -18,11 +18,11 @@
// Other libraries and framework includes
// Project includes
-#include "lldb/lldb-private.h"
#include "lldb/Core/Address.h"
#include "lldb/Core/Mangled.h"
#include "lldb/Symbol/LineEntry.h"
#include "lldb/Utility/Iterable.h"
+#include "lldb/lldb-private.h"
namespace lldb_private {
@@ -39,409 +39,380 @@ class SymbolContextScope;
/// queries include
/// @li Looking up a load address.
//----------------------------------------------------------------------
-class SymbolContext
-{
+class SymbolContext {
public:
- //------------------------------------------------------------------
- /// Default constructor.
- ///
- /// Initialize all pointer members to nullptr and all struct members
- /// to their default state.
- //------------------------------------------------------------------
- SymbolContext ();
-
- //------------------------------------------------------------------
- /// Construct with an object that knows how to reconstruct its
- /// symbol context.
- ///
- /// @param[in] sc_scope
- /// A symbol context scope object that knows how to reconstruct
- /// it's context.
- //------------------------------------------------------------------
- explicit
- SymbolContext (SymbolContextScope *sc_scope);
-
- //------------------------------------------------------------------
- /// Construct with module, and optional compile unit, function,
- /// block, line table, line entry and symbol.
- ///
- /// Initialize all pointer to the specified values.
- ///
- /// @param[in] module
- /// A Module pointer to the module for this context.
- ///
- /// @param[in] comp_unit
- /// A CompileUnit pointer to the compile unit for this context.
- ///
- /// @param[in] function
- /// A Function pointer to the function for this context.
- ///
- /// @param[in] block
- /// A Block pointer to the deepest block for this context.
- ///
- /// @param[in] line_entry
- /// A LineEntry pointer to the line entry for this context.
- ///
- /// @param[in] symbol
- /// A Symbol pointer to the symbol for this context.
- //------------------------------------------------------------------
- explicit
- SymbolContext(const lldb::TargetSP &target_sp,
- const lldb::ModuleSP &module_sp,
- CompileUnit *comp_unit = nullptr,
- Function *function = nullptr,
- Block *block = nullptr,
- LineEntry *line_entry = nullptr,
- Symbol *symbol = nullptr);
-
- // This version sets the target to a NULL TargetSP if you don't know it.
- explicit
- SymbolContext(const lldb::ModuleSP &module_sp,
- CompileUnit *comp_unit = nullptr,
- Function *function = nullptr,
- Block *block = nullptr,
- LineEntry *line_entry = nullptr,
- Symbol *symbol = nullptr);
-
- //------------------------------------------------------------------
- /// Copy constructor
- ///
- /// Makes a copy of the another SymbolContext object \a rhs.
- ///
- /// @param[in] rhs
- /// A const SymbolContext object reference to copy.
- //------------------------------------------------------------------
- SymbolContext (const SymbolContext& rhs);
-
- ~SymbolContext ();
-
- //------------------------------------------------------------------
- /// Assignment operator.
- ///
- /// Copies the address value from another SymbolContext object \a
- /// rhs into \a this object.
- ///
- /// @param[in] rhs
- /// A const SymbolContext object reference to copy.
- ///
- /// @return
- /// A const SymbolContext object reference to \a this.
- //------------------------------------------------------------------
- const SymbolContext&
- operator= (const SymbolContext& rhs);
-
- //------------------------------------------------------------------
- /// Clear the object's state.
- ///
- /// Resets all pointer members to nullptr, and clears any class objects
- /// to their default state.
- //------------------------------------------------------------------
- void
- Clear (bool clear_target);
-
- //------------------------------------------------------------------
- /// Dump a description of this object to a Stream.
- ///
- /// Dump a description of the contents of this object to the
- /// supplied stream \a s.
- ///
- /// @param[in] s
- /// The stream to which to dump the object description.
- //------------------------------------------------------------------
- void
- Dump (Stream *s, Target *target) const;
-
- //------------------------------------------------------------------
- /// Dump the stop context in this object to a Stream.
- ///
- /// Dump the best description of this object to the stream. The
- /// information displayed depends on the amount and quality of the
- /// information in this context. If a module, function, file and
- /// line number are available, they will be dumped. If only a
- /// module and function or symbol name with offset is available,
- /// that will be output. Else just the address at which the target
- /// was stopped will be displayed.
- ///
- /// @param[in] s
- /// The stream to which to dump the object description.
- ///
- /// @param[in] so_addr
- /// The resolved section offset address.
- ///
- /// @param[in] show_fullpaths
- /// When printing file paths (with the Module), whether the
- /// base name of the Module should be printed or the full path.
- ///
- /// @param[in] show_module
- /// Whether the module name should be printed followed by a
- /// grave accent "`" character.
- ///
- /// @param[in] show_inlined_frames
- /// If a given pc is in inlined function(s), whether the inlined
- /// functions should be printed on separate lines in addition to
- /// the concrete function containing the pc.
- ///
- /// @param[in] show_function_arguments
- /// If false, this method will try to elide the function argument
- /// types when printing the function name. This may be ambiguous
- /// for languages that have function overloading - but it may
- /// make the "function name" too long to include all the argument
- /// types.
- ///
- /// @param[in] show_function_name
- /// Normally this should be true - the function/symbol name should
- /// be printed. In disassembly formatting, where we want a format
- /// like "<*+36>", this should be false and "*" will be printed
- /// instead.
- //------------------------------------------------------------------
- bool
- DumpStopContext (Stream *s,
- ExecutionContextScope *exe_scope,
- const Address &so_addr,
- bool show_fullpaths,
- bool show_module,
- bool show_inlined_frames,
- bool show_function_arguments,
- bool show_function_name) const;
-
- //------------------------------------------------------------------
- /// Get the address range contained within a symbol context.
- ///
- /// Address range priority is as follows:
- /// - line_entry address range if line_entry is valid and eSymbolContextLineEntry is set in \a scope
- /// - block address range if block is not nullptr and eSymbolContextBlock is set in \a scope
- /// - function address range if function is not nullptr and eSymbolContextFunction is set in \a scope
- /// - symbol address range if symbol is not nullptr and eSymbolContextSymbol is set in \a scope
- ///
- /// @param[in] scope
- /// A mask of symbol context bits telling this function which
- /// address ranges it can use when trying to extract one from
- /// the valid (non-nullptr) symbol context classes.
- ///
- /// @param[in] range_idx
- /// The address range index to grab. Since many functions and
- /// blocks are not always contiguous, they may have more than
- /// one address range.
- ///
- /// @param[in] use_inline_block_range
- /// If \a scope has the eSymbolContextBlock bit set, and there
- /// is a valid block in the symbol context, return the block
- /// address range for the containing inline function block, not
- /// the deepest most block. This allows us to extract information
- /// for the address range of the inlined function block, not
- /// the deepest lexical block.
- ///
- /// @param[out] range
- /// An address range object that will be filled in if \b true
- /// is returned.
- ///
- /// @return
- /// \b True if this symbol context contains items that describe
- /// an address range, \b false otherwise.
- //------------------------------------------------------------------
- bool
- GetAddressRange (uint32_t scope,
- uint32_t range_idx,
- bool use_inline_block_range,
- AddressRange &range) const;
-
- bool
- GetAddressRangeFromHereToEndLine(uint32_t end_line, AddressRange &range, Error &error);
-
- void
- GetDescription(Stream *s,
- lldb::DescriptionLevel level,
- Target *target) const;
-
- uint32_t
- GetResolvedMask () const;
-
- lldb::LanguageType
- GetLanguage () const;
-
- //------------------------------------------------------------------
- /// Find a block that defines the function represented by this
- /// symbol context.
- ///
- /// If this symbol context points to a block that is an inlined
- /// function, or is contained within an inlined function, the block
- /// that defines the inlined function is returned.
- ///
- /// If this symbol context has no block in it, or the block is not
- /// itself an inlined function block or contained within one, we
- /// return the top level function block.
- ///
- /// This is a handy function to call when you want to get the block
- /// whose variable list will include the arguments for the function
- /// that is represented by this symbol context (whether the function
- /// is an inline function or not).
- ///
- /// @return
- /// The block object pointer that defines the function that is
- /// represented by this symbol context object, nullptr otherwise.
- //------------------------------------------------------------------
- Block *
- GetFunctionBlock ();
-
- //------------------------------------------------------------------
- /// If this symbol context represents a function that is a method,
- /// return true and provide information about the method.
- ///
- /// @param[out] language
- /// If \b true is returned, the language for the method.
- ///
- /// @param[out] is_instance_method
- /// If \b true is returned, \b true if this is a instance method,
- /// \b false if this is a static/class function.
- ///
- /// @param[out] language_object_name
- /// If \b true is returned, the name of the artificial variable
- /// for the language ("this" for C++, "self" for ObjC).
- ///
- /// @return
- /// \b True if this symbol context represents a function that
- /// is a method of a class, \b false otherwise.
- //------------------------------------------------------------------
- bool
- GetFunctionMethodInfo (lldb::LanguageType &language,
- bool &is_instance_method,
- ConstString &language_object_name);
-
- //------------------------------------------------------------------
- /// Sorts the types in TypeMap according to SymbolContext
- /// to TypeList
- ///
- //------------------------------------------------------------------
- void
- SortTypeList(TypeMap &type_map, TypeList &type_list) const;
-
- //------------------------------------------------------------------
- /// Find a name of the innermost function for the symbol context.
- ///
- /// For instance, if the symbol context contains an inlined block,
- /// it will return the inlined function name.
- ///
- /// @param[in] prefer_mangled
- /// if \btrue, then the mangled name will be returned if there
- /// is one. Otherwise the unmangled name will be returned if it
- /// is available.
- ///
- /// @return
- /// The name of the function represented by this symbol context.
- //------------------------------------------------------------------
- ConstString
- GetFunctionName (Mangled::NamePreference preference = Mangled::ePreferDemangled) const;
-
- //------------------------------------------------------------------
- /// Get the line entry that corresponds to the function.
- ///
- /// If the symbol context contains an inlined block, the line entry
- /// for the start address of the inlined function will be returned,
- /// otherwise the line entry for the start address of the function
- /// will be returned. This can be used after doing a
- /// Module::FindFunctions(...) or ModuleList::FindFunctions(...)
- /// call in order to get the correct line table information for
- /// the symbol context.
- /// it will return the inlined function name.
- ///
- /// @param[in] prefer_mangled
- /// if \btrue, then the mangled name will be returned if there
- /// is one. Otherwise the unmangled name will be returned if it
- /// is available.
- ///
- /// @return
- /// The name of the function represented by this symbol context.
- //------------------------------------------------------------------
- LineEntry
- GetFunctionStartLineEntry () const;
-
- //------------------------------------------------------------------
- /// Find the block containing the inlined block that contains this block.
- ///
- /// For instance, if the symbol context contains an inlined block,
- /// it will return the inlined function name.
- ///
- /// @param[in] curr_frame_pc
- /// The address within the block of this object.
- ///
- /// @param[out] next_frame_sc
- /// A new symbol context that does what the title says it does.
- ///
- /// @param[out] next_frame_addr
- /// This is what you should report as the PC in \a next_frame_sc.
- ///
- /// @return
- /// \b true if this SymbolContext specifies a block contained in an
- /// inlined block. If this returns \b true, \a next_frame_sc and
- /// \a next_frame_addr will be filled in correctly.
- //------------------------------------------------------------------
- bool
- GetParentOfInlinedScope (const Address &curr_frame_pc,
- SymbolContext &next_frame_sc,
- Address &inlined_frame_addr) const;
-
- //------------------------------------------------------------------
- // Member variables
- //------------------------------------------------------------------
- lldb::TargetSP target_sp; ///< The Target for a given query
- lldb::ModuleSP module_sp; ///< The Module for a given query
- CompileUnit * comp_unit; ///< The CompileUnit for a given query
- Function * function; ///< The Function for a given query
- Block * block; ///< The Block for a given query
- LineEntry line_entry; ///< The LineEntry for a given query
- Symbol * symbol; ///< The Symbol for a given query
- Variable * variable; ///< The global variable matching the given query
+ //------------------------------------------------------------------
+ /// Default constructor.
+ ///
+ /// Initialize all pointer members to nullptr and all struct members
+ /// to their default state.
+ //------------------------------------------------------------------
+ SymbolContext();
+
+ //------------------------------------------------------------------
+ /// Construct with an object that knows how to reconstruct its
+ /// symbol context.
+ ///
+ /// @param[in] sc_scope
+ /// A symbol context scope object that knows how to reconstruct
+ /// it's context.
+ //------------------------------------------------------------------
+ explicit SymbolContext(SymbolContextScope *sc_scope);
+
+ //------------------------------------------------------------------
+ /// Construct with module, and optional compile unit, function,
+ /// block, line table, line entry and symbol.
+ ///
+ /// Initialize all pointer to the specified values.
+ ///
+ /// @param[in] module
+ /// A Module pointer to the module for this context.
+ ///
+ /// @param[in] comp_unit
+ /// A CompileUnit pointer to the compile unit for this context.
+ ///
+ /// @param[in] function
+ /// A Function pointer to the function for this context.
+ ///
+ /// @param[in] block
+ /// A Block pointer to the deepest block for this context.
+ ///
+ /// @param[in] line_entry
+ /// A LineEntry pointer to the line entry for this context.
+ ///
+ /// @param[in] symbol
+ /// A Symbol pointer to the symbol for this context.
+ //------------------------------------------------------------------
+ explicit SymbolContext(const lldb::TargetSP &target_sp,
+ const lldb::ModuleSP &module_sp,
+ CompileUnit *comp_unit = nullptr,
+ Function *function = nullptr, Block *block = nullptr,
+ LineEntry *line_entry = nullptr,
+ Symbol *symbol = nullptr);
+
+ // This version sets the target to a NULL TargetSP if you don't know it.
+ explicit SymbolContext(const lldb::ModuleSP &module_sp,
+ CompileUnit *comp_unit = nullptr,
+ Function *function = nullptr, Block *block = nullptr,
+ LineEntry *line_entry = nullptr,
+ Symbol *symbol = nullptr);
+
+ //------------------------------------------------------------------
+ /// Copy constructor
+ ///
+ /// Makes a copy of the another SymbolContext object \a rhs.
+ ///
+ /// @param[in] rhs
+ /// A const SymbolContext object reference to copy.
+ //------------------------------------------------------------------
+ SymbolContext(const SymbolContext &rhs);
+
+ ~SymbolContext();
+
+ //------------------------------------------------------------------
+ /// Assignment operator.
+ ///
+ /// Copies the address value from another SymbolContext object \a
+ /// rhs into \a this object.
+ ///
+ /// @param[in] rhs
+ /// A const SymbolContext object reference to copy.
+ ///
+ /// @return
+ /// A const SymbolContext object reference to \a this.
+ //------------------------------------------------------------------
+ const SymbolContext &operator=(const SymbolContext &rhs);
+
+ //------------------------------------------------------------------
+ /// Clear the object's state.
+ ///
+ /// Resets all pointer members to nullptr, and clears any class objects
+ /// to their default state.
+ //------------------------------------------------------------------
+ void Clear(bool clear_target);
+
+ //------------------------------------------------------------------
+ /// Dump a description of this object to a Stream.
+ ///
+ /// Dump a description of the contents of this object to the
+ /// supplied stream \a s.
+ ///
+ /// @param[in] s
+ /// The stream to which to dump the object description.
+ //------------------------------------------------------------------
+ void Dump(Stream *s, Target *target) const;
+
+ //------------------------------------------------------------------
+ /// Dump the stop context in this object to a Stream.
+ ///
+ /// Dump the best description of this object to the stream. The
+ /// information displayed depends on the amount and quality of the
+ /// information in this context. If a module, function, file and
+ /// line number are available, they will be dumped. If only a
+ /// module and function or symbol name with offset is available,
+ /// that will be output. Else just the address at which the target
+ /// was stopped will be displayed.
+ ///
+ /// @param[in] s
+ /// The stream to which to dump the object description.
+ ///
+ /// @param[in] so_addr
+ /// The resolved section offset address.
+ ///
+ /// @param[in] show_fullpaths
+ /// When printing file paths (with the Module), whether the
+ /// base name of the Module should be printed or the full path.
+ ///
+ /// @param[in] show_module
+ /// Whether the module name should be printed followed by a
+ /// grave accent "`" character.
+ ///
+ /// @param[in] show_inlined_frames
+ /// If a given pc is in inlined function(s), whether the inlined
+ /// functions should be printed on separate lines in addition to
+ /// the concrete function containing the pc.
+ ///
+ /// @param[in] show_function_arguments
+ /// If false, this method will try to elide the function argument
+ /// types when printing the function name. This may be ambiguous
+ /// for languages that have function overloading - but it may
+ /// make the "function name" too long to include all the argument
+ /// types.
+ ///
+ /// @param[in] show_function_name
+ /// Normally this should be true - the function/symbol name should
+ /// be printed. In disassembly formatting, where we want a format
+ /// like "<*+36>", this should be false and "*" will be printed
+ /// instead.
+ //------------------------------------------------------------------
+ bool DumpStopContext(Stream *s, ExecutionContextScope *exe_scope,
+ const Address &so_addr, bool show_fullpaths,
+ bool show_module, bool show_inlined_frames,
+ bool show_function_arguments,
+ bool show_function_name) const;
+
+ //------------------------------------------------------------------
+ /// Get the address range contained within a symbol context.
+ ///
+ /// Address range priority is as follows:
+ /// - line_entry address range if line_entry is valid and
+ /// eSymbolContextLineEntry is set in \a scope
+ /// - block address range if block is not nullptr and eSymbolContextBlock
+ /// is set in \a scope
+ /// - function address range if function is not nullptr and
+ /// eSymbolContextFunction is set in \a scope
+ /// - symbol address range if symbol is not nullptr and
+ /// eSymbolContextSymbol is set in \a scope
+ ///
+ /// @param[in] scope
+ /// A mask of symbol context bits telling this function which
+ /// address ranges it can use when trying to extract one from
+ /// the valid (non-nullptr) symbol context classes.
+ ///
+ /// @param[in] range_idx
+ /// The address range index to grab. Since many functions and
+ /// blocks are not always contiguous, they may have more than
+ /// one address range.
+ ///
+ /// @param[in] use_inline_block_range
+ /// If \a scope has the eSymbolContextBlock bit set, and there
+ /// is a valid block in the symbol context, return the block
+ /// address range for the containing inline function block, not
+ /// the deepest most block. This allows us to extract information
+ /// for the address range of the inlined function block, not
+ /// the deepest lexical block.
+ ///
+ /// @param[out] range
+ /// An address range object that will be filled in if \b true
+ /// is returned.
+ ///
+ /// @return
+ /// \b True if this symbol context contains items that describe
+ /// an address range, \b false otherwise.
+ //------------------------------------------------------------------
+ bool GetAddressRange(uint32_t scope, uint32_t range_idx,
+ bool use_inline_block_range, AddressRange &range) const;
+
+ bool GetAddressRangeFromHereToEndLine(uint32_t end_line, AddressRange &range,
+ Error &error);
+
+ void GetDescription(Stream *s, lldb::DescriptionLevel level,
+ Target *target) const;
+
+ uint32_t GetResolvedMask() const;
+
+ lldb::LanguageType GetLanguage() const;
+
+ //------------------------------------------------------------------
+ /// Find a block that defines the function represented by this
+ /// symbol context.
+ ///
+ /// If this symbol context points to a block that is an inlined
+ /// function, or is contained within an inlined function, the block
+ /// that defines the inlined function is returned.
+ ///
+ /// If this symbol context has no block in it, or the block is not
+ /// itself an inlined function block or contained within one, we
+ /// return the top level function block.
+ ///
+ /// This is a handy function to call when you want to get the block
+ /// whose variable list will include the arguments for the function
+ /// that is represented by this symbol context (whether the function
+ /// is an inline function or not).
+ ///
+ /// @return
+ /// The block object pointer that defines the function that is
+ /// represented by this symbol context object, nullptr otherwise.
+ //------------------------------------------------------------------
+ Block *GetFunctionBlock();
+
+ //------------------------------------------------------------------
+ /// If this symbol context represents a function that is a method,
+ /// return true and provide information about the method.
+ ///
+ /// @param[out] language
+ /// If \b true is returned, the language for the method.
+ ///
+ /// @param[out] is_instance_method
+ /// If \b true is returned, \b true if this is a instance method,
+ /// \b false if this is a static/class function.
+ ///
+ /// @param[out] language_object_name
+ /// If \b true is returned, the name of the artificial variable
+ /// for the language ("this" for C++, "self" for ObjC).
+ ///
+ /// @return
+ /// \b True if this symbol context represents a function that
+ /// is a method of a class, \b false otherwise.
+ //------------------------------------------------------------------
+ bool GetFunctionMethodInfo(lldb::LanguageType &language,
+ bool &is_instance_method,
+ ConstString &language_object_name);
+
+ //------------------------------------------------------------------
+ /// Sorts the types in TypeMap according to SymbolContext
+ /// to TypeList
+ ///
+ //------------------------------------------------------------------
+ void SortTypeList(TypeMap &type_map, TypeList &type_list) const;
+
+ //------------------------------------------------------------------
+ /// Find a name of the innermost function for the symbol context.
+ ///
+ /// For instance, if the symbol context contains an inlined block,
+ /// it will return the inlined function name.
+ ///
+ /// @param[in] prefer_mangled
+ /// if \btrue, then the mangled name will be returned if there
+ /// is one. Otherwise the unmangled name will be returned if it
+ /// is available.
+ ///
+ /// @return
+ /// The name of the function represented by this symbol context.
+ //------------------------------------------------------------------
+ ConstString GetFunctionName(
+ Mangled::NamePreference preference = Mangled::ePreferDemangled) const;
+
+ //------------------------------------------------------------------
+ /// Get the line entry that corresponds to the function.
+ ///
+ /// If the symbol context contains an inlined block, the line entry
+ /// for the start address of the inlined function will be returned,
+ /// otherwise the line entry for the start address of the function
+ /// will be returned. This can be used after doing a
+ /// Module::FindFunctions(...) or ModuleList::FindFunctions(...)
+ /// call in order to get the correct line table information for
+ /// the symbol context.
+ /// it will return the inlined function name.
+ ///
+ /// @param[in] prefer_mangled
+ /// if \btrue, then the mangled name will be returned if there
+ /// is one. Otherwise the unmangled name will be returned if it
+ /// is available.
+ ///
+ /// @return
+ /// The name of the function represented by this symbol context.
+ //------------------------------------------------------------------
+ LineEntry GetFunctionStartLineEntry() const;
+
+ //------------------------------------------------------------------
+ /// Find the block containing the inlined block that contains this block.
+ ///
+ /// For instance, if the symbol context contains an inlined block,
+ /// it will return the inlined function name.
+ ///
+ /// @param[in] curr_frame_pc
+ /// The address within the block of this object.
+ ///
+ /// @param[out] next_frame_sc
+ /// A new symbol context that does what the title says it does.
+ ///
+ /// @param[out] next_frame_addr
+ /// This is what you should report as the PC in \a next_frame_sc.
+ ///
+ /// @return
+ /// \b true if this SymbolContext specifies a block contained in an
+ /// inlined block. If this returns \b true, \a next_frame_sc and
+ /// \a next_frame_addr will be filled in correctly.
+ //------------------------------------------------------------------
+ bool GetParentOfInlinedScope(const Address &curr_frame_pc,
+ SymbolContext &next_frame_sc,
+ Address &inlined_frame_addr) const;
+
+ //------------------------------------------------------------------
+ // Member variables
+ //------------------------------------------------------------------
+ lldb::TargetSP target_sp; ///< The Target for a given query
+ lldb::ModuleSP module_sp; ///< The Module for a given query
+ CompileUnit *comp_unit; ///< The CompileUnit for a given query
+ Function *function; ///< The Function for a given query
+ Block *block; ///< The Block for a given query
+ LineEntry line_entry; ///< The LineEntry for a given query
+ Symbol *symbol; ///< The Symbol for a given query
+ Variable *variable; ///< The global variable matching the given query
};
-class SymbolContextSpecifier
-{
+class SymbolContextSpecifier {
public:
- typedef enum SpecificationType
- {
- eNothingSpecified = 0,
- eModuleSpecified = 1 << 0,
- eFileSpecified = 1 << 1,
- eLineStartSpecified = 1 << 2,
- eLineEndSpecified = 1 << 3,
- eFunctionSpecified = 1 << 4,
- eClassOrNamespaceSpecified = 1 << 5,
- eAddressRangeSpecified = 1 << 6
- } SpecificationType;
-
- // This one produces a specifier that matches everything...
- SymbolContextSpecifier (const lldb::TargetSP& target_sp);
-
- ~SymbolContextSpecifier();
-
- bool
- AddSpecification (const char *spec_string, SpecificationType type);
-
- bool
- AddLineSpecification (uint32_t line_no, SpecificationType type);
-
- void
- Clear();
-
- bool
- SymbolContextMatches(SymbolContext &sc);
-
- bool
- AddressMatches(lldb::addr_t addr);
-
- void
- GetDescription (Stream *s, lldb::DescriptionLevel level) const;
+ typedef enum SpecificationType {
+ eNothingSpecified = 0,
+ eModuleSpecified = 1 << 0,
+ eFileSpecified = 1 << 1,
+ eLineStartSpecified = 1 << 2,
+ eLineEndSpecified = 1 << 3,
+ eFunctionSpecified = 1 << 4,
+ eClassOrNamespaceSpecified = 1 << 5,
+ eAddressRangeSpecified = 1 << 6
+ } SpecificationType;
+
+ // This one produces a specifier that matches everything...
+ SymbolContextSpecifier(const lldb::TargetSP &target_sp);
+
+ ~SymbolContextSpecifier();
+
+ bool AddSpecification(const char *spec_string, SpecificationType type);
+
+ bool AddLineSpecification(uint32_t line_no, SpecificationType type);
+
+ void Clear();
+
+ bool SymbolContextMatches(SymbolContext &sc);
+
+ bool AddressMatches(lldb::addr_t addr);
+
+ void GetDescription(Stream *s, lldb::DescriptionLevel level) const;
private:
- lldb::TargetSP m_target_sp;
- std::string m_module_spec;
- lldb::ModuleSP m_module_sp;
- std::unique_ptr<FileSpec> m_file_spec_ap;
- size_t m_start_line;
- size_t m_end_line;
- std::string m_function_spec;
- std::string m_class_name;
- std::unique_ptr<AddressRange> m_address_range_ap;
- uint32_t m_type; // Or'ed bits from SpecificationType
+ lldb::TargetSP m_target_sp;
+ std::string m_module_spec;
+ lldb::ModuleSP m_module_sp;
+ std::unique_ptr<FileSpec> m_file_spec_ap;
+ size_t m_start_line;
+ size_t m_end_line;
+ std::string m_function_spec;
+ std::string m_class_name;
+ std::unique_ptr<AddressRange> m_address_range_ap;
+ uint32_t m_type; // Or'ed bits from SpecificationType
};
//----------------------------------------------------------------------
@@ -454,165 +425,143 @@ private:
/// @li Looking up a function by name.
/// @li Finding all addresses for a specified file and line number.
//----------------------------------------------------------------------
-class SymbolContextList
-{
+class SymbolContextList {
public:
- //------------------------------------------------------------------
- /// Default constructor.
- ///
- /// Initialize with an empty list.
- //------------------------------------------------------------------
- SymbolContextList ();
-
- //------------------------------------------------------------------
- /// Destructor.
- //------------------------------------------------------------------
- ~SymbolContextList ();
-
- //------------------------------------------------------------------
- /// Append a new symbol context to the list.
- ///
- /// @param[in] sc
- /// A symbol context to append to the list.
- //------------------------------------------------------------------
- void
- Append (const SymbolContext& sc);
-
- void
- Append (const SymbolContextList& sc_list);
-
- bool
- AppendIfUnique (const SymbolContext& sc,
- bool merge_symbol_into_function);
-
- bool
- MergeSymbolContextIntoFunctionContext (const SymbolContext& symbol_sc,
- uint32_t start_idx = 0,
- uint32_t stop_idx = UINT32_MAX);
-
- uint32_t
- AppendIfUnique (const SymbolContextList& sc_list,
- bool merge_symbol_into_function);
-
- //------------------------------------------------------------------
- /// Clear the object's state.
- ///
- /// Clears the symbol context list.
- //------------------------------------------------------------------
- void
- Clear();
-
- //------------------------------------------------------------------
- /// Dump a description of this object to a Stream.
- ///
- /// Dump a description of the contents of each symbol context in
- /// the list to the supplied stream \a s.
- ///
- /// @param[in] s
- /// The stream to which to dump the object description.
- //------------------------------------------------------------------
- void
- Dump(Stream *s, Target *target) const;
-
- //------------------------------------------------------------------
- /// Get accessor for a symbol context at index \a idx.
- ///
- /// Dump a description of the contents of each symbol context in
- /// the list to the supplied stream \a s.
- ///
- /// @param[in] idx
- /// The zero based index into the symbol context list.
- ///
- /// @param[out] sc
- /// A reference to the symbol context to fill in.
- ///
- /// @return
- /// Returns \b true if \a idx was a valid index into this
- /// symbol context list and \a sc was filled in, \b false
- /// otherwise.
- //------------------------------------------------------------------
- bool
- GetContextAtIndex(size_t idx, SymbolContext& sc) const;
-
- //------------------------------------------------------------------
- /// Direct reference accessor for a symbol context at index \a idx.
- ///
- /// The index \a idx must be a valid index, no error checking will
- /// be done to ensure that it is valid.
- ///
- /// @param[in] idx
- /// The zero based index into the symbol context list.
- ///
- /// @return
- /// A const reference to the symbol context to fill in.
- //------------------------------------------------------------------
- SymbolContext&
- operator [] (size_t idx)
- {
- return m_symbol_contexts[idx];
- }
-
- const SymbolContext&
- operator [] (size_t idx) const
- {
- return m_symbol_contexts[idx];
- }
-
- //------------------------------------------------------------------
- /// Get accessor for the last symbol context in the list.
- ///
- /// @param[out] sc
- /// A reference to the symbol context to fill in.
- ///
- /// @return
- /// Returns \b true if \a sc was filled in, \b false if the
- /// list is empty.
- //------------------------------------------------------------------
- bool
- GetLastContext(SymbolContext& sc) const;
-
- bool
- RemoveContextAtIndex (size_t idx);
-
- //------------------------------------------------------------------
- /// Get accessor for a symbol context list size.
- ///
- /// @return
- /// Returns the number of symbol context objects in the list.
- //------------------------------------------------------------------
- uint32_t
- GetSize() const;
-
- uint32_t
- NumLineEntriesWithLine (uint32_t line) const;
-
- void
- GetDescription(Stream *s,
- lldb::DescriptionLevel level,
- Target *target) const;
+ //------------------------------------------------------------------
+ /// Default constructor.
+ ///
+ /// Initialize with an empty list.
+ //------------------------------------------------------------------
+ SymbolContextList();
+
+ //------------------------------------------------------------------
+ /// Destructor.
+ //------------------------------------------------------------------
+ ~SymbolContextList();
+
+ //------------------------------------------------------------------
+ /// Append a new symbol context to the list.
+ ///
+ /// @param[in] sc
+ /// A symbol context to append to the list.
+ //------------------------------------------------------------------
+ void Append(const SymbolContext &sc);
+
+ void Append(const SymbolContextList &sc_list);
+
+ bool AppendIfUnique(const SymbolContext &sc, bool merge_symbol_into_function);
+
+ bool MergeSymbolContextIntoFunctionContext(const SymbolContext &symbol_sc,
+ uint32_t start_idx = 0,
+ uint32_t stop_idx = UINT32_MAX);
+
+ uint32_t AppendIfUnique(const SymbolContextList &sc_list,
+ bool merge_symbol_into_function);
+
+ //------------------------------------------------------------------
+ /// Clear the object's state.
+ ///
+ /// Clears the symbol context list.
+ //------------------------------------------------------------------
+ void Clear();
+
+ //------------------------------------------------------------------
+ /// Dump a description of this object to a Stream.
+ ///
+ /// Dump a description of the contents of each symbol context in
+ /// the list to the supplied stream \a s.
+ ///
+ /// @param[in] s
+ /// The stream to which to dump the object description.
+ //------------------------------------------------------------------
+ void Dump(Stream *s, Target *target) const;
+
+ //------------------------------------------------------------------
+ /// Get accessor for a symbol context at index \a idx.
+ ///
+ /// Dump a description of the contents of each symbol context in
+ /// the list to the supplied stream \a s.
+ ///
+ /// @param[in] idx
+ /// The zero based index into the symbol context list.
+ ///
+ /// @param[out] sc
+ /// A reference to the symbol context to fill in.
+ ///
+ /// @return
+ /// Returns \b true if \a idx was a valid index into this
+ /// symbol context list and \a sc was filled in, \b false
+ /// otherwise.
+ //------------------------------------------------------------------
+ bool GetContextAtIndex(size_t idx, SymbolContext &sc) const;
+
+ //------------------------------------------------------------------
+ /// Direct reference accessor for a symbol context at index \a idx.
+ ///
+ /// The index \a idx must be a valid index, no error checking will
+ /// be done to ensure that it is valid.
+ ///
+ /// @param[in] idx
+ /// The zero based index into the symbol context list.
+ ///
+ /// @return
+ /// A const reference to the symbol context to fill in.
+ //------------------------------------------------------------------
+ SymbolContext &operator[](size_t idx) { return m_symbol_contexts[idx]; }
+
+ const SymbolContext &operator[](size_t idx) const {
+ return m_symbol_contexts[idx];
+ }
+
+ //------------------------------------------------------------------
+ /// Get accessor for the last symbol context in the list.
+ ///
+ /// @param[out] sc
+ /// A reference to the symbol context to fill in.
+ ///
+ /// @return
+ /// Returns \b true if \a sc was filled in, \b false if the
+ /// list is empty.
+ //------------------------------------------------------------------
+ bool GetLastContext(SymbolContext &sc) const;
+
+ bool RemoveContextAtIndex(size_t idx);
+
+ //------------------------------------------------------------------
+ /// Get accessor for a symbol context list size.
+ ///
+ /// @return
+ /// Returns the number of symbol context objects in the list.
+ //------------------------------------------------------------------
+ uint32_t GetSize() const;
+
+ uint32_t NumLineEntriesWithLine(uint32_t line) const;
+
+ void GetDescription(Stream *s, lldb::DescriptionLevel level,
+ Target *target) const;
protected:
- typedef std::vector<SymbolContext> collection; ///< The collection type for the list.
+ typedef std::vector<SymbolContext>
+ collection; ///< The collection type for the list.
- //------------------------------------------------------------------
- // Member variables.
- //------------------------------------------------------------------
- collection m_symbol_contexts; ///< The list of symbol contexts.
+ //------------------------------------------------------------------
+ // Member variables.
+ //------------------------------------------------------------------
+ collection m_symbol_contexts; ///< The list of symbol contexts.
public:
- typedef AdaptedIterable<collection, SymbolContext, vector_adapter> SymbolContextIterable;
- SymbolContextIterable
- SymbolContexts()
- {
- return SymbolContextIterable(m_symbol_contexts);
- }
+ typedef AdaptedIterable<collection, SymbolContext, vector_adapter>
+ SymbolContextIterable;
+ SymbolContextIterable SymbolContexts() {
+ return SymbolContextIterable(m_symbol_contexts);
+ }
};
-bool operator== (const SymbolContext& lhs, const SymbolContext& rhs);
-bool operator!= (const SymbolContext& lhs, const SymbolContext& rhs);
+bool operator==(const SymbolContext &lhs, const SymbolContext &rhs);
+bool operator!=(const SymbolContext &lhs, const SymbolContext &rhs);
-bool operator== (const SymbolContextList& lhs, const SymbolContextList& rhs);
-bool operator!= (const SymbolContextList& lhs, const SymbolContextList& rhs);
+bool operator==(const SymbolContextList &lhs, const SymbolContextList &rhs);
+bool operator!=(const SymbolContextList &lhs, const SymbolContextList &rhs);
} // namespace lldb_private
Modified: lldb/trunk/include/lldb/Symbol/SymbolContextScope.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Symbol/SymbolContextScope.h?rev=280751&r1=280750&r2=280751&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Symbol/SymbolContextScope.h (original)
+++ lldb/trunk/include/lldb/Symbol/SymbolContextScope.h Tue Sep 6 15:57:50 2016
@@ -19,16 +19,17 @@
namespace lldb_private {
//----------------------------------------------------------------------
-/// @class SymbolContextScope SymbolContextScope.h "lldb/Symbol/SymbolContextScope.h"
+/// @class SymbolContextScope SymbolContextScope.h
+/// "lldb/Symbol/SymbolContextScope.h"
/// @brief Inherit from this if your object is part of a symbol context
/// and can reconstruct its symbol context.
///
/// Many objects that are part of a symbol context that have pointers
-/// back to parent objects that own them. Any members of a symbol
+/// back to parent objects that own them. Any members of a symbol
/// context that, once they are built, will not go away, can inherit
/// from this pure virtual class and can then reconstruct their symbol
-/// context without having to keep a complete SymbolContext object in
-/// the object.
+/// context without having to keep a complete SymbolContext object in
+/// the object.
///
/// Examples of these objects include:
/// @li Module
@@ -38,7 +39,7 @@ namespace lldb_private {
/// @li Symbol
///
/// Other objects can store a "SymbolContextScope *" using any pointers
-/// to one of the above objects. This allows clients to hold onto a
+/// to one of the above objects. This allows clients to hold onto a
/// pointer that uniquely will identify a symbol context. Those clients
/// can then always reconstruct the symbol context using the pointer, or
/// use it to uniquely identify a symbol context for an object.
@@ -53,12 +54,12 @@ namespace lldb_private {
/// in which the variable is defined. Function arguments can use
/// the Function object as their scope. The SymbolFile parsers
/// will set these correctly as the variables are parsed.
-/// @li Type objects that know exactly in which scope they
+/// @li Type objects that know exactly in which scope they
/// originated much like the variables above.
-/// @li StackID objects that are able to know that if the CFA
-/// (stack pointer at the beginning of a function) and the
+/// @li StackID objects that are able to know that if the CFA
+/// (stack pointer at the beginning of a function) and the
/// start PC for the function/symbol and the SymbolContextScope
-/// pointer (a unique pointer that identifies a symbol context
+/// pointer (a unique pointer that identifies a symbol context
/// location) match within the same thread, that the stack
/// frame is the same as the previous stack frame.
///
@@ -68,67 +69,45 @@ namespace lldb_private {
/// and object pairs that allow large collections of objects to be
/// passed around with minimal overhead.
//----------------------------------------------------------------------
-class SymbolContextScope
-{
+class SymbolContextScope {
public:
- virtual
- ~SymbolContextScope() = default;
+ virtual ~SymbolContextScope() = default;
- //------------------------------------------------------------------
- /// Reconstruct the object's symbol context into \a sc.
- ///
- /// The object should fill in as much of the SymbolContext as it
- /// can so function calls that require a symbol context can be made
- /// for the given object.
- ///
- /// @param[out] sc
- /// A symbol context object pointer that gets filled in.
- //------------------------------------------------------------------
- virtual void
- CalculateSymbolContext (SymbolContext *sc) = 0;
-
- virtual lldb::ModuleSP
- CalculateSymbolContextModule ()
- {
- return lldb::ModuleSP();
- }
-
- virtual CompileUnit *
- CalculateSymbolContextCompileUnit ()
- {
- return nullptr;
- }
-
- virtual Function *
- CalculateSymbolContextFunction ()
- {
- return nullptr;
- }
-
- virtual Block *
- CalculateSymbolContextBlock ()
- {
- return nullptr;
- }
-
- virtual Symbol *
- CalculateSymbolContextSymbol ()
- {
- return nullptr;
- }
-
- //------------------------------------------------------------------
- /// Dump the object's symbol context to the stream \a s.
- ///
- /// The object should dump its symbol context to the stream \a s.
- /// This function is widely used in the DumpDebug and verbose output
- /// for lldb objects.
- ///
- /// @param[in] s
- /// The stream to which to dump the object's symbol context.
- //------------------------------------------------------------------
- virtual void
- DumpSymbolContext (Stream *s) = 0;
+ //------------------------------------------------------------------
+ /// Reconstruct the object's symbol context into \a sc.
+ ///
+ /// The object should fill in as much of the SymbolContext as it
+ /// can so function calls that require a symbol context can be made
+ /// for the given object.
+ ///
+ /// @param[out] sc
+ /// A symbol context object pointer that gets filled in.
+ //------------------------------------------------------------------
+ virtual void CalculateSymbolContext(SymbolContext *sc) = 0;
+
+ virtual lldb::ModuleSP CalculateSymbolContextModule() {
+ return lldb::ModuleSP();
+ }
+
+ virtual CompileUnit *CalculateSymbolContextCompileUnit() { return nullptr; }
+
+ virtual Function *CalculateSymbolContextFunction() { return nullptr; }
+
+ virtual Block *CalculateSymbolContextBlock() { return nullptr; }
+
+ virtual Symbol *CalculateSymbolContextSymbol() { return nullptr; }
+
+ //------------------------------------------------------------------
+ /// Dump the object's symbol context to the stream \a s.
+ ///
+ /// The object should dump its symbol context to the stream \a s.
+ /// This function is widely used in the DumpDebug and verbose output
+ /// for lldb objects.
+ ///
+ /// @param[in] s
+ /// The stream to which to dump the object's symbol context.
+ //------------------------------------------------------------------
+ virtual void DumpSymbolContext(Stream *s) = 0;
};
} // namespace lldb_private
Modified: lldb/trunk/include/lldb/Symbol/SymbolFile.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Symbol/SymbolFile.h?rev=280751&r1=280750&r2=280751&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Symbol/SymbolFile.h (original)
+++ lldb/trunk/include/lldb/Symbol/SymbolFile.h Tue Sep 6 15:57:50 2016
@@ -10,184 +10,201 @@
#ifndef liblldb_SymbolFile_h_
#define liblldb_SymbolFile_h_
-#include "lldb/lldb-private.h"
#include "lldb/Core/PluginInterface.h"
-#include "lldb/Symbol/CompilerType.h"
#include "lldb/Symbol/CompilerDecl.h"
#include "lldb/Symbol/CompilerDeclContext.h"
+#include "lldb/Symbol/CompilerType.h"
#include "lldb/Symbol/Type.h"
+#include "lldb/lldb-private.h"
#include "llvm/ADT/DenseSet.h"
namespace lldb_private {
-class SymbolFile :
- public PluginInterface
-{
+class SymbolFile : public PluginInterface {
public:
- //------------------------------------------------------------------
- // Symbol file ability bits.
- //
- // Each symbol file can claim to support one or more symbol file
- // abilities. These get returned from SymbolFile::GetAbilities().
- // These help us to determine which plug-in will be best to load
- // the debug information found in files.
- //------------------------------------------------------------------
- enum Abilities
- {
- CompileUnits = (1u << 0),
- LineTables = (1u << 1),
- Functions = (1u << 2),
- Blocks = (1u << 3),
- GlobalVariables = (1u << 4),
- LocalVariables = (1u << 5),
- VariableTypes = (1u << 6),
- kAllAbilities =((1u << 7) - 1u)
- };
-
- static SymbolFile *
- FindPlugin (ObjectFile* obj_file);
-
- //------------------------------------------------------------------
- // Constructors and Destructors
- //------------------------------------------------------------------
- SymbolFile(ObjectFile* obj_file) :
- m_obj_file(obj_file),
- m_abilities(0),
- m_calculated_abilities(false)
- {
- }
-
- ~SymbolFile() override
- {
- }
-
- //------------------------------------------------------------------
- /// Get a mask of what this symbol file supports for the object file
- /// that it was constructed with.
- ///
- /// Each symbol file gets to respond with a mask of abilities that
- /// it supports for each object file. This happens when we are
- /// trying to figure out which symbol file plug-in will get used
- /// for a given object file. The plug-in that responds with the
- /// best mix of "SymbolFile::Abilities" bits set, will get chosen to
- /// be the symbol file parser. This allows each plug-in to check for
- /// sections that contain data a symbol file plug-in would need. For
- /// example the DWARF plug-in requires DWARF sections in a file that
- /// contain debug information. If the DWARF plug-in doesn't find
- /// these sections, it won't respond with many ability bits set, and
- /// we will probably fall back to the symbol table SymbolFile plug-in
- /// which uses any information in the symbol table. Also, plug-ins
- /// might check for some specific symbols in a symbol table in the
- /// case where the symbol table contains debug information (STABS
- /// and COFF). Not a lot of work should happen in these functions
- /// as the plug-in might not get selected due to another plug-in
- /// having more abilities. Any initialization work should be saved
- /// for "void SymbolFile::InitializeObject()" which will get called
- /// on the SymbolFile object with the best set of abilities.
- ///
- /// @return
- /// A uint32_t mask containing bits from the SymbolFile::Abilities
- /// enumeration. Any bits that are set represent an ability that
- /// this symbol plug-in can parse from the object file.
- ///------------------------------------------------------------------
- uint32_t GetAbilities ()
- {
- if (!m_calculated_abilities)
- {
- m_abilities = CalculateAbilities();
- m_calculated_abilities = true;
- }
-
- return m_abilities;
- }
-
- virtual uint32_t CalculateAbilities() = 0;
-
- //------------------------------------------------------------------
- /// Initialize the SymbolFile object.
- ///
- /// The SymbolFile object with the best set of abilities (detected
- /// in "uint32_t SymbolFile::GetAbilities()) will have this function
- /// called if it is chosen to parse an object file. More complete
- /// initialization can happen in this function which will get called
- /// prior to any other functions in the SymbolFile protocol.
- //------------------------------------------------------------------
- virtual void InitializeObject() {}
-
- //------------------------------------------------------------------
- // Compile Unit function calls
- //------------------------------------------------------------------
- // Approach 1 - iterator
- virtual uint32_t GetNumCompileUnits() = 0;
- virtual lldb::CompUnitSP ParseCompileUnitAtIndex(uint32_t index) = 0;
-
- virtual lldb::LanguageType ParseCompileUnitLanguage (const SymbolContext& sc) = 0;
- virtual size_t ParseCompileUnitFunctions (const SymbolContext& sc) = 0;
- virtual bool ParseCompileUnitLineTable (const SymbolContext& sc) = 0;
- virtual bool ParseCompileUnitDebugMacros (const SymbolContext& sc) = 0;
- virtual bool ParseCompileUnitSupportFiles (const SymbolContext& sc, FileSpecList& support_files) = 0;
- virtual bool
- ParseCompileUnitIsOptimized(const lldb_private::SymbolContext &sc)
- {
- return false;
- }
- virtual bool ParseImportedModules (const SymbolContext &sc, std::vector<ConstString> &imported_modules) = 0;
- virtual size_t ParseFunctionBlocks (const SymbolContext& sc) = 0;
- virtual size_t ParseTypes (const SymbolContext& sc) = 0;
- virtual size_t ParseVariablesForContext (const SymbolContext& sc) = 0;
- virtual Type* ResolveTypeUID (lldb::user_id_t type_uid) = 0;
- virtual bool CompleteType (CompilerType &compiler_type) = 0;
- virtual void ParseDeclsForContext (CompilerDeclContext decl_ctx) {}
- virtual CompilerDecl GetDeclForUID (lldb::user_id_t uid) { return CompilerDecl(); }
- virtual CompilerDeclContext GetDeclContextForUID (lldb::user_id_t uid) { return CompilerDeclContext(); }
- virtual CompilerDeclContext GetDeclContextContainingUID (lldb::user_id_t uid) { return CompilerDeclContext(); }
- virtual uint32_t ResolveSymbolContext (const Address& so_addr, uint32_t resolve_scope, SymbolContext& sc) = 0;
- virtual uint32_t ResolveSymbolContext (const FileSpec& file_spec, uint32_t line, bool check_inlines, uint32_t resolve_scope, SymbolContextList& sc_list);
- virtual uint32_t FindGlobalVariables (const ConstString &name, const CompilerDeclContext *parent_decl_ctx, bool append, uint32_t max_matches, VariableList& variables);
- virtual uint32_t FindGlobalVariables (const RegularExpression& regex, bool append, uint32_t max_matches, VariableList& variables);
- virtual uint32_t FindFunctions (const ConstString &name, const CompilerDeclContext *parent_decl_ctx, uint32_t name_type_mask, bool include_inlines, bool append, SymbolContextList& sc_list);
- virtual uint32_t FindFunctions (const RegularExpression& regex, bool include_inlines, bool append, SymbolContextList& sc_list);
- virtual uint32_t FindTypes (const SymbolContext& sc, const ConstString &name, const CompilerDeclContext *parent_decl_ctx, bool append, uint32_t max_matches, llvm::DenseSet<lldb_private::SymbolFile *> &searched_symbol_files, TypeMap& types);
- virtual size_t FindTypes (const std::vector<CompilerContext> &context, bool append, TypeMap& types);
-
- virtual void GetMangledNamesForFunction(const std::string &scope_qualified_name, std::vector<ConstString> &mangled_names);
-// virtual uint32_t FindTypes (const SymbolContext& sc, const RegularExpression& regex, bool append, uint32_t max_matches, TypeList& types) = 0;
- virtual TypeList * GetTypeList ();
- virtual size_t GetTypes (lldb_private::SymbolContextScope *sc_scope,
- uint32_t type_mask,
- lldb_private::TypeList &type_list) = 0;
-
- virtual lldb_private::TypeSystem *
- GetTypeSystemForLanguage (lldb::LanguageType language);
-
- virtual CompilerDeclContext
- FindNamespace (const SymbolContext& sc,
- const ConstString &name,
- const CompilerDeclContext *parent_decl_ctx)
- {
- return CompilerDeclContext();
- }
-
- ObjectFile* GetObjectFile() { return m_obj_file; }
- const ObjectFile* GetObjectFile() const { return m_obj_file; }
-
- //------------------------------------------------------------------
- /// Notify the SymbolFile that the file addresses in the Sections
- /// for this module have been changed.
- //------------------------------------------------------------------
- virtual void
- SectionFileAddressesChanged ()
- {
- }
+ //------------------------------------------------------------------
+ // Symbol file ability bits.
+ //
+ // Each symbol file can claim to support one or more symbol file
+ // abilities. These get returned from SymbolFile::GetAbilities().
+ // These help us to determine which plug-in will be best to load
+ // the debug information found in files.
+ //------------------------------------------------------------------
+ enum Abilities {
+ CompileUnits = (1u << 0),
+ LineTables = (1u << 1),
+ Functions = (1u << 2),
+ Blocks = (1u << 3),
+ GlobalVariables = (1u << 4),
+ LocalVariables = (1u << 5),
+ VariableTypes = (1u << 6),
+ kAllAbilities = ((1u << 7) - 1u)
+ };
+
+ static SymbolFile *FindPlugin(ObjectFile *obj_file);
+
+ //------------------------------------------------------------------
+ // Constructors and Destructors
+ //------------------------------------------------------------------
+ SymbolFile(ObjectFile *obj_file)
+ : m_obj_file(obj_file), m_abilities(0), m_calculated_abilities(false) {}
+
+ ~SymbolFile() override {}
+
+ //------------------------------------------------------------------
+ /// Get a mask of what this symbol file supports for the object file
+ /// that it was constructed with.
+ ///
+ /// Each symbol file gets to respond with a mask of abilities that
+ /// it supports for each object file. This happens when we are
+ /// trying to figure out which symbol file plug-in will get used
+ /// for a given object file. The plug-in that responds with the
+ /// best mix of "SymbolFile::Abilities" bits set, will get chosen to
+ /// be the symbol file parser. This allows each plug-in to check for
+ /// sections that contain data a symbol file plug-in would need. For
+ /// example the DWARF plug-in requires DWARF sections in a file that
+ /// contain debug information. If the DWARF plug-in doesn't find
+ /// these sections, it won't respond with many ability bits set, and
+ /// we will probably fall back to the symbol table SymbolFile plug-in
+ /// which uses any information in the symbol table. Also, plug-ins
+ /// might check for some specific symbols in a symbol table in the
+ /// case where the symbol table contains debug information (STABS
+ /// and COFF). Not a lot of work should happen in these functions
+ /// as the plug-in might not get selected due to another plug-in
+ /// having more abilities. Any initialization work should be saved
+ /// for "void SymbolFile::InitializeObject()" which will get called
+ /// on the SymbolFile object with the best set of abilities.
+ ///
+ /// @return
+ /// A uint32_t mask containing bits from the SymbolFile::Abilities
+ /// enumeration. Any bits that are set represent an ability that
+ /// this symbol plug-in can parse from the object file.
+ ///------------------------------------------------------------------
+ uint32_t GetAbilities() {
+ if (!m_calculated_abilities) {
+ m_abilities = CalculateAbilities();
+ m_calculated_abilities = true;
+ }
+
+ return m_abilities;
+ }
+
+ virtual uint32_t CalculateAbilities() = 0;
+
+ //------------------------------------------------------------------
+ /// Initialize the SymbolFile object.
+ ///
+ /// The SymbolFile object with the best set of abilities (detected
+ /// in "uint32_t SymbolFile::GetAbilities()) will have this function
+ /// called if it is chosen to parse an object file. More complete
+ /// initialization can happen in this function which will get called
+ /// prior to any other functions in the SymbolFile protocol.
+ //------------------------------------------------------------------
+ virtual void InitializeObject() {}
+
+ //------------------------------------------------------------------
+ // Compile Unit function calls
+ //------------------------------------------------------------------
+ // Approach 1 - iterator
+ virtual uint32_t GetNumCompileUnits() = 0;
+ virtual lldb::CompUnitSP ParseCompileUnitAtIndex(uint32_t index) = 0;
+
+ virtual lldb::LanguageType
+ ParseCompileUnitLanguage(const SymbolContext &sc) = 0;
+ virtual size_t ParseCompileUnitFunctions(const SymbolContext &sc) = 0;
+ virtual bool ParseCompileUnitLineTable(const SymbolContext &sc) = 0;
+ virtual bool ParseCompileUnitDebugMacros(const SymbolContext &sc) = 0;
+ virtual bool ParseCompileUnitSupportFiles(const SymbolContext &sc,
+ FileSpecList &support_files) = 0;
+ virtual bool
+ ParseCompileUnitIsOptimized(const lldb_private::SymbolContext &sc) {
+ return false;
+ }
+ virtual bool
+ ParseImportedModules(const SymbolContext &sc,
+ std::vector<ConstString> &imported_modules) = 0;
+ virtual size_t ParseFunctionBlocks(const SymbolContext &sc) = 0;
+ virtual size_t ParseTypes(const SymbolContext &sc) = 0;
+ virtual size_t ParseVariablesForContext(const SymbolContext &sc) = 0;
+ virtual Type *ResolveTypeUID(lldb::user_id_t type_uid) = 0;
+ virtual bool CompleteType(CompilerType &compiler_type) = 0;
+ virtual void ParseDeclsForContext(CompilerDeclContext decl_ctx) {}
+ virtual CompilerDecl GetDeclForUID(lldb::user_id_t uid) {
+ return CompilerDecl();
+ }
+ virtual CompilerDeclContext GetDeclContextForUID(lldb::user_id_t uid) {
+ return CompilerDeclContext();
+ }
+ virtual CompilerDeclContext GetDeclContextContainingUID(lldb::user_id_t uid) {
+ return CompilerDeclContext();
+ }
+ virtual uint32_t ResolveSymbolContext(const Address &so_addr,
+ uint32_t resolve_scope,
+ SymbolContext &sc) = 0;
+ virtual uint32_t ResolveSymbolContext(const FileSpec &file_spec,
+ uint32_t line, bool check_inlines,
+ uint32_t resolve_scope,
+ SymbolContextList &sc_list);
+ virtual uint32_t
+ FindGlobalVariables(const ConstString &name,
+ const CompilerDeclContext *parent_decl_ctx, bool append,
+ uint32_t max_matches, VariableList &variables);
+ virtual uint32_t FindGlobalVariables(const RegularExpression ®ex,
+ bool append, uint32_t max_matches,
+ VariableList &variables);
+ virtual uint32_t FindFunctions(const ConstString &name,
+ const CompilerDeclContext *parent_decl_ctx,
+ uint32_t name_type_mask, bool include_inlines,
+ bool append, SymbolContextList &sc_list);
+ virtual uint32_t FindFunctions(const RegularExpression ®ex,
+ bool include_inlines, bool append,
+ SymbolContextList &sc_list);
+ virtual uint32_t
+ FindTypes(const SymbolContext &sc, const ConstString &name,
+ const CompilerDeclContext *parent_decl_ctx, bool append,
+ uint32_t max_matches,
+ llvm::DenseSet<lldb_private::SymbolFile *> &searched_symbol_files,
+ TypeMap &types);
+ virtual size_t FindTypes(const std::vector<CompilerContext> &context,
+ bool append, TypeMap &types);
+
+ virtual void
+ GetMangledNamesForFunction(const std::string &scope_qualified_name,
+ std::vector<ConstString> &mangled_names);
+ // virtual uint32_t FindTypes (const SymbolContext& sc, const
+ // RegularExpression& regex, bool append, uint32_t max_matches, TypeList&
+ // types) = 0;
+ virtual TypeList *GetTypeList();
+ virtual size_t GetTypes(lldb_private::SymbolContextScope *sc_scope,
+ uint32_t type_mask,
+ lldb_private::TypeList &type_list) = 0;
+
+ virtual lldb_private::TypeSystem *
+ GetTypeSystemForLanguage(lldb::LanguageType language);
+
+ virtual CompilerDeclContext
+ FindNamespace(const SymbolContext &sc, const ConstString &name,
+ const CompilerDeclContext *parent_decl_ctx) {
+ return CompilerDeclContext();
+ }
+
+ ObjectFile *GetObjectFile() { return m_obj_file; }
+ const ObjectFile *GetObjectFile() const { return m_obj_file; }
+
+ //------------------------------------------------------------------
+ /// Notify the SymbolFile that the file addresses in the Sections
+ /// for this module have been changed.
+ //------------------------------------------------------------------
+ virtual void SectionFileAddressesChanged() {}
protected:
- ObjectFile* m_obj_file; // The object file that symbols can be extracted from.
- uint32_t m_abilities;
- bool m_calculated_abilities;
+ ObjectFile *m_obj_file; // The object file that symbols can be extracted from.
+ uint32_t m_abilities;
+ bool m_calculated_abilities;
private:
- DISALLOW_COPY_AND_ASSIGN (SymbolFile);
+ DISALLOW_COPY_AND_ASSIGN(SymbolFile);
};
} // namespace lldb_private
Modified: lldb/trunk/include/lldb/Symbol/SymbolVendor.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Symbol/SymbolVendor.h?rev=280751&r1=280750&r2=280751&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Symbol/SymbolVendor.h (original)
+++ lldb/trunk/include/lldb/Symbol/SymbolVendor.h Tue Sep 6 15:57:50 2016
@@ -12,11 +12,11 @@
#include <vector>
-#include "lldb/lldb-private.h"
#include "lldb/Core/ModuleChild.h"
#include "lldb/Core/PluginInterface.h"
#include "lldb/Symbol/TypeList.h"
#include "lldb/Symbol/TypeMap.h"
+#include "lldb/lldb-private.h"
#include "llvm/ADT/DenseSet.h"
namespace lldb_private {
@@ -31,197 +31,146 @@ namespace lldb_private {
// objects) to provide the information and only parse as deep as needed
// in order to provide the information that is requested.
//----------------------------------------------------------------------
-class SymbolVendor :
- public ModuleChild,
- public PluginInterface
-{
+class SymbolVendor : public ModuleChild, public PluginInterface {
public:
- static SymbolVendor*
- FindPlugin (const lldb::ModuleSP &module_sp,
- Stream *feedback_strm);
-
- //------------------------------------------------------------------
- // Constructors and Destructors
- //------------------------------------------------------------------
- SymbolVendor(const lldb::ModuleSP &module_sp);
-
- ~SymbolVendor() override;
-
- void
- AddSymbolFileRepresentation(const lldb::ObjectFileSP &objfile_sp);
-
- virtual void
- Dump(Stream *s);
-
- virtual lldb::LanguageType
- ParseCompileUnitLanguage (const SymbolContext& sc);
-
- virtual size_t
- ParseCompileUnitFunctions (const SymbolContext& sc);
-
- virtual bool
- ParseCompileUnitLineTable (const SymbolContext& sc);
-
- virtual bool
- ParseCompileUnitDebugMacros (const SymbolContext& sc);
-
- virtual bool
- ParseCompileUnitSupportFiles (const SymbolContext& sc,
- FileSpecList& support_files);
-
- virtual bool
- ParseCompileUnitIsOptimized(const SymbolContext &sc);
-
- virtual bool
- ParseImportedModules (const SymbolContext &sc,
- std::vector<ConstString> &imported_modules);
-
- virtual size_t
- ParseFunctionBlocks (const SymbolContext& sc);
-
- virtual size_t
- ParseTypes (const SymbolContext& sc);
-
- virtual size_t
- ParseVariablesForContext (const SymbolContext& sc);
-
- virtual Type*
- ResolveTypeUID(lldb::user_id_t type_uid);
-
- virtual uint32_t
- ResolveSymbolContext (const Address& so_addr,
- uint32_t resolve_scope,
- SymbolContext& sc);
-
- virtual uint32_t
- ResolveSymbolContext (const FileSpec& file_spec,
- uint32_t line,
- bool check_inlines,
- uint32_t resolve_scope,
- SymbolContextList& sc_list);
-
- virtual size_t
- FindGlobalVariables (const ConstString &name,
- const CompilerDeclContext *parent_decl_ctx,
- bool append,
- size_t max_matches,
- VariableList& variables);
-
- virtual size_t
- FindGlobalVariables (const RegularExpression& regex,
- bool append,
- size_t max_matches,
- VariableList& variables);
-
- virtual size_t
- FindFunctions (const ConstString &name,
- const CompilerDeclContext *parent_decl_ctx,
- uint32_t name_type_mask,
- bool include_inlines,
- bool append,
- SymbolContextList& sc_list);
-
- virtual size_t
- FindFunctions (const RegularExpression& regex,
- bool include_inlines,
- bool append,
- SymbolContextList& sc_list);
-
- virtual size_t
- FindTypes (const SymbolContext& sc,
- const ConstString &name,
- const CompilerDeclContext *parent_decl_ctx,
- bool append,
- size_t max_matches,
- llvm::DenseSet<lldb_private::SymbolFile *> &searched_symbol_files,
- TypeMap& types);
-
- virtual size_t
- FindTypes (const std::vector<CompilerContext> &context, bool append, TypeMap& types);
-
- virtual CompilerDeclContext
- FindNamespace (const SymbolContext& sc,
- const ConstString &name,
- const CompilerDeclContext *parent_decl_ctx);
-
- virtual size_t
- GetNumCompileUnits();
-
- virtual bool
- SetCompileUnitAtIndex (size_t cu_idx,
- const lldb::CompUnitSP &cu_sp);
-
- virtual lldb::CompUnitSP
- GetCompileUnitAtIndex(size_t idx);
-
- TypeList&
- GetTypeList()
- {
- return m_type_list;
- }
-
- const TypeList&
- GetTypeList() const
- {
- return m_type_list;
- }
-
- virtual size_t
- GetTypes (SymbolContextScope *sc_scope,
- uint32_t type_mask,
- TypeList &type_list);
-
- SymbolFile *
- GetSymbolFile()
- {
- return m_sym_file_ap.get();
- }
-
- FileSpec
- GetMainFileSpec() const;
-
- // Get module unified section list symbol table.
- virtual Symtab *
- GetSymtab ();
-
- // Clear module unified section list symbol table.
- virtual void
- ClearSymtab ();
-
- //------------------------------------------------------------------
- /// Notify the SymbolVendor that the file addresses in the Sections
- /// for this module have been changed.
- //------------------------------------------------------------------
- virtual void
- SectionFileAddressesChanged ();
-
- //------------------------------------------------------------------
- // PluginInterface protocol
- //------------------------------------------------------------------
- ConstString
- GetPluginName() override;
+ static SymbolVendor *FindPlugin(const lldb::ModuleSP &module_sp,
+ Stream *feedback_strm);
+
+ //------------------------------------------------------------------
+ // Constructors and Destructors
+ //------------------------------------------------------------------
+ SymbolVendor(const lldb::ModuleSP &module_sp);
+
+ ~SymbolVendor() override;
+
+ void AddSymbolFileRepresentation(const lldb::ObjectFileSP &objfile_sp);
+
+ virtual void Dump(Stream *s);
+
+ virtual lldb::LanguageType ParseCompileUnitLanguage(const SymbolContext &sc);
+
+ virtual size_t ParseCompileUnitFunctions(const SymbolContext &sc);
+
+ virtual bool ParseCompileUnitLineTable(const SymbolContext &sc);
+
+ virtual bool ParseCompileUnitDebugMacros(const SymbolContext &sc);
+
+ virtual bool ParseCompileUnitSupportFiles(const SymbolContext &sc,
+ FileSpecList &support_files);
+
+ virtual bool ParseCompileUnitIsOptimized(const SymbolContext &sc);
+
+ virtual bool ParseImportedModules(const SymbolContext &sc,
+ std::vector<ConstString> &imported_modules);
+
+ virtual size_t ParseFunctionBlocks(const SymbolContext &sc);
+
+ virtual size_t ParseTypes(const SymbolContext &sc);
+
+ virtual size_t ParseVariablesForContext(const SymbolContext &sc);
+
+ virtual Type *ResolveTypeUID(lldb::user_id_t type_uid);
+
+ virtual uint32_t ResolveSymbolContext(const Address &so_addr,
+ uint32_t resolve_scope,
+ SymbolContext &sc);
+
+ virtual uint32_t ResolveSymbolContext(const FileSpec &file_spec,
+ uint32_t line, bool check_inlines,
+ uint32_t resolve_scope,
+ SymbolContextList &sc_list);
+
+ virtual size_t FindGlobalVariables(const ConstString &name,
+ const CompilerDeclContext *parent_decl_ctx,
+ bool append, size_t max_matches,
+ VariableList &variables);
+
+ virtual size_t FindGlobalVariables(const RegularExpression ®ex,
+ bool append, size_t max_matches,
+ VariableList &variables);
+
+ virtual size_t FindFunctions(const ConstString &name,
+ const CompilerDeclContext *parent_decl_ctx,
+ uint32_t name_type_mask, bool include_inlines,
+ bool append, SymbolContextList &sc_list);
+
+ virtual size_t FindFunctions(const RegularExpression ®ex,
+ bool include_inlines, bool append,
+ SymbolContextList &sc_list);
+
+ virtual size_t
+ FindTypes(const SymbolContext &sc, const ConstString &name,
+ const CompilerDeclContext *parent_decl_ctx, bool append,
+ size_t max_matches,
+ llvm::DenseSet<lldb_private::SymbolFile *> &searched_symbol_files,
+ TypeMap &types);
+
+ virtual size_t FindTypes(const std::vector<CompilerContext> &context,
+ bool append, TypeMap &types);
+
+ virtual CompilerDeclContext
+ FindNamespace(const SymbolContext &sc, const ConstString &name,
+ const CompilerDeclContext *parent_decl_ctx);
+
+ virtual size_t GetNumCompileUnits();
+
+ virtual bool SetCompileUnitAtIndex(size_t cu_idx,
+ const lldb::CompUnitSP &cu_sp);
+
+ virtual lldb::CompUnitSP GetCompileUnitAtIndex(size_t idx);
+
+ TypeList &GetTypeList() { return m_type_list; }
+
+ const TypeList &GetTypeList() const { return m_type_list; }
+
+ virtual size_t GetTypes(SymbolContextScope *sc_scope, uint32_t type_mask,
+ TypeList &type_list);
+
+ SymbolFile *GetSymbolFile() { return m_sym_file_ap.get(); }
+
+ FileSpec GetMainFileSpec() const;
+
+ // Get module unified section list symbol table.
+ virtual Symtab *GetSymtab();
+
+ // Clear module unified section list symbol table.
+ virtual void ClearSymtab();
+
+ //------------------------------------------------------------------
+ /// Notify the SymbolVendor that the file addresses in the Sections
+ /// for this module have been changed.
+ //------------------------------------------------------------------
+ virtual void SectionFileAddressesChanged();
+
+ //------------------------------------------------------------------
+ // PluginInterface protocol
+ //------------------------------------------------------------------
+ ConstString GetPluginName() override;
- uint32_t
- GetPluginVersion() override;
+ uint32_t GetPluginVersion() override;
protected:
- //------------------------------------------------------------------
- // Classes that inherit from SymbolVendor can see and modify these
- //------------------------------------------------------------------
- typedef std::vector<lldb::CompUnitSP> CompileUnits;
- typedef CompileUnits::iterator CompileUnitIter;
- typedef CompileUnits::const_iterator CompileUnitConstIter;
-
- TypeList m_type_list; // Uniqued types for all parsers owned by this module
- CompileUnits m_compile_units; // The current compile units
- lldb::ObjectFileSP m_objfile_sp; // Keep a reference to the object file in case it isn't the same as the module object file (debug symbols in a separate file)
- std::unique_ptr<SymbolFile> m_sym_file_ap; // A single symbol file. Subclasses can add more of these if needed.
+ //------------------------------------------------------------------
+ // Classes that inherit from SymbolVendor can see and modify these
+ //------------------------------------------------------------------
+ typedef std::vector<lldb::CompUnitSP> CompileUnits;
+ typedef CompileUnits::iterator CompileUnitIter;
+ typedef CompileUnits::const_iterator CompileUnitConstIter;
+
+ TypeList m_type_list; // Uniqued types for all parsers owned by this module
+ CompileUnits m_compile_units; // The current compile units
+ lldb::ObjectFileSP m_objfile_sp; // Keep a reference to the object file in
+ // case it isn't the same as the module
+ // object file (debug symbols in a separate
+ // file)
+ std::unique_ptr<SymbolFile> m_sym_file_ap; // A single symbol file. Subclasses
+ // can add more of these if needed.
private:
- //------------------------------------------------------------------
- // For SymbolVendor only
- //------------------------------------------------------------------
- DISALLOW_COPY_AND_ASSIGN (SymbolVendor);
+ //------------------------------------------------------------------
+ // For SymbolVendor only
+ //------------------------------------------------------------------
+ DISALLOW_COPY_AND_ASSIGN(SymbolVendor);
};
} // namespace lldb_private
Modified: lldb/trunk/include/lldb/Symbol/Symtab.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Symbol/Symtab.h?rev=280751&r1=280750&r2=280751&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Symbol/Symtab.h (original)
+++ lldb/trunk/include/lldb/Symbol/Symtab.h Tue Sep 6 15:57:50 2016
@@ -7,169 +7,198 @@
//
//===----------------------------------------------------------------------===//
-
#ifndef liblldb_Symtab_h_
#define liblldb_Symtab_h_
#include <mutex>
#include <vector>
-#include "lldb/lldb-private.h"
#include "lldb/Core/RangeMap.h"
#include "lldb/Core/UniqueCStringMap.h"
#include "lldb/Symbol/Symbol.h"
+#include "lldb/lldb-private.h"
namespace lldb_private {
-class Symtab
-{
+class Symtab {
public:
- typedef std::vector<uint32_t> IndexCollection;
- typedef UniqueCStringMap<uint32_t> NameToIndexMap;
+ typedef std::vector<uint32_t> IndexCollection;
+ typedef UniqueCStringMap<uint32_t> NameToIndexMap;
+
+ typedef enum Debug {
+ eDebugNo, // Not a debug symbol
+ eDebugYes, // A debug symbol
+ eDebugAny
+ } Debug;
+
+ typedef enum Visibility {
+ eVisibilityAny,
+ eVisibilityExtern,
+ eVisibilityPrivate
+ } Visibility;
+
+ Symtab(ObjectFile *objfile);
+ ~Symtab();
+
+ void Reserve(size_t count);
+ Symbol *Resize(size_t count);
+ uint32_t AddSymbol(const Symbol &symbol);
+ size_t GetNumSymbols() const;
+ void SectionFileAddressesChanged();
+ void Dump(Stream *s, Target *target, SortOrder sort_type);
+ void Dump(Stream *s, Target *target, std::vector<uint32_t> &indexes) const;
+ uint32_t GetIndexForSymbol(const Symbol *symbol) const;
+ std::recursive_mutex &GetMutex() { return m_mutex; }
+ Symbol *FindSymbolByID(lldb::user_id_t uid) const;
+ Symbol *SymbolAtIndex(size_t idx);
+ const Symbol *SymbolAtIndex(size_t idx) const;
+ Symbol *FindSymbolWithType(lldb::SymbolType symbol_type,
+ Debug symbol_debug_type,
+ Visibility symbol_visibility, uint32_t &start_idx);
+ //----------------------------------------------------------------------
+ /// Get the parent symbol for the given symbol.
+ ///
+ /// Many symbols in symbol tables are scoped by other symbols that
+ /// contain one or more symbol. This function will look for such a
+ /// containing symbol and return it if there is one.
+ //----------------------------------------------------------------------
+ const Symbol *GetParent(Symbol *symbol) const;
+ uint32_t AppendSymbolIndexesWithType(lldb::SymbolType symbol_type,
+ std::vector<uint32_t> &indexes,
+ uint32_t start_idx = 0,
+ uint32_t end_index = UINT32_MAX) const;
+ uint32_t AppendSymbolIndexesWithTypeAndFlagsValue(
+ lldb::SymbolType symbol_type, uint32_t flags_value,
+ std::vector<uint32_t> &indexes, uint32_t start_idx = 0,
+ uint32_t end_index = UINT32_MAX) const;
+ uint32_t AppendSymbolIndexesWithType(lldb::SymbolType symbol_type,
+ Debug symbol_debug_type,
+ Visibility symbol_visibility,
+ std::vector<uint32_t> &matches,
+ uint32_t start_idx = 0,
+ uint32_t end_index = UINT32_MAX) const;
+ uint32_t AppendSymbolIndexesWithName(const ConstString &symbol_name,
+ std::vector<uint32_t> &matches);
+ uint32_t AppendSymbolIndexesWithName(const ConstString &symbol_name,
+ Debug symbol_debug_type,
+ Visibility symbol_visibility,
+ std::vector<uint32_t> &matches);
+ uint32_t AppendSymbolIndexesWithNameAndType(const ConstString &symbol_name,
+ lldb::SymbolType symbol_type,
+ std::vector<uint32_t> &matches);
+ uint32_t AppendSymbolIndexesWithNameAndType(const ConstString &symbol_name,
+ lldb::SymbolType symbol_type,
+ Debug symbol_debug_type,
+ Visibility symbol_visibility,
+ std::vector<uint32_t> &matches);
+ uint32_t
+ AppendSymbolIndexesMatchingRegExAndType(const RegularExpression ®ex,
+ lldb::SymbolType symbol_type,
+ std::vector<uint32_t> &indexes);
+ uint32_t AppendSymbolIndexesMatchingRegExAndType(
+ const RegularExpression ®ex, lldb::SymbolType symbol_type,
+ Debug symbol_debug_type, Visibility symbol_visibility,
+ std::vector<uint32_t> &indexes);
+ size_t FindAllSymbolsWithNameAndType(const ConstString &name,
+ lldb::SymbolType symbol_type,
+ std::vector<uint32_t> &symbol_indexes);
+ size_t FindAllSymbolsWithNameAndType(const ConstString &name,
+ lldb::SymbolType symbol_type,
+ Debug symbol_debug_type,
+ Visibility symbol_visibility,
+ std::vector<uint32_t> &symbol_indexes);
+ size_t FindAllSymbolsMatchingRexExAndType(
+ const RegularExpression ®ex, lldb::SymbolType symbol_type,
+ Debug symbol_debug_type, Visibility symbol_visibility,
+ std::vector<uint32_t> &symbol_indexes);
+ Symbol *FindFirstSymbolWithNameAndType(const ConstString &name,
+ lldb::SymbolType symbol_type,
+ Debug symbol_debug_type,
+ Visibility symbol_visibility);
+ Symbol *FindSymbolAtFileAddress(lldb::addr_t file_addr);
+ Symbol *FindSymbolContainingFileAddress(lldb::addr_t file_addr);
+ void ForEachSymbolContainingFileAddress(
+ lldb::addr_t file_addr, std::function<bool(Symbol *)> const &callback);
+ size_t FindFunctionSymbols(const ConstString &name, uint32_t name_type_mask,
+ SymbolContextList &sc_list);
+ void CalculateSymbolSizes();
+
+ void SortSymbolIndexesByValue(std::vector<uint32_t> &indexes,
+ bool remove_duplicates) const;
+
+ static void DumpSymbolHeader(Stream *s);
+
+ void Finalize() {
+ // Shrink to fit the symbols so we don't waste memory
+ if (m_symbols.capacity() > m_symbols.size()) {
+ collection new_symbols(m_symbols.begin(), m_symbols.end());
+ m_symbols.swap(new_symbols);
+ }
+ }
+
+ void AppendSymbolNamesToMap(const IndexCollection &indexes,
+ bool add_demangled, bool add_mangled,
+ NameToIndexMap &name_to_index_map) const;
+
+ ObjectFile *GetObjectFile() { return m_objfile; }
- typedef enum Debug {
- eDebugNo, // Not a debug symbol
- eDebugYes, // A debug symbol
- eDebugAny
- } Debug;
-
- typedef enum Visibility {
- eVisibilityAny,
- eVisibilityExtern,
- eVisibilityPrivate
- } Visibility;
-
- Symtab(ObjectFile *objfile);
- ~Symtab();
-
- void Reserve (size_t count);
- Symbol * Resize (size_t count);
- uint32_t AddSymbol(const Symbol& symbol);
- size_t GetNumSymbols() const;
- void SectionFileAddressesChanged ();
- void Dump(Stream *s, Target *target, SortOrder sort_type);
- void Dump(Stream *s, Target *target, std::vector<uint32_t>& indexes) const;
- uint32_t GetIndexForSymbol (const Symbol *symbol) const;
- std::recursive_mutex &
- GetMutex()
- {
- return m_mutex;
- }
- Symbol * FindSymbolByID (lldb::user_id_t uid) const;
- Symbol * SymbolAtIndex (size_t idx);
- const Symbol * SymbolAtIndex (size_t idx) const;
- Symbol * FindSymbolWithType (lldb::SymbolType symbol_type, Debug symbol_debug_type, Visibility symbol_visibility, uint32_t &start_idx);
- //----------------------------------------------------------------------
- /// Get the parent symbol for the given symbol.
- ///
- /// Many symbols in symbol tables are scoped by other symbols that
- /// contain one or more symbol. This function will look for such a
- /// containing symbol and return it if there is one.
- //----------------------------------------------------------------------
- const Symbol * GetParent (Symbol *symbol) const;
- uint32_t AppendSymbolIndexesWithType (lldb::SymbolType symbol_type, std::vector<uint32_t>& indexes, uint32_t start_idx = 0, uint32_t end_index = UINT32_MAX) const;
- uint32_t AppendSymbolIndexesWithTypeAndFlagsValue (lldb::SymbolType symbol_type, uint32_t flags_value, std::vector<uint32_t>& indexes, uint32_t start_idx = 0, uint32_t end_index = UINT32_MAX) const;
- uint32_t AppendSymbolIndexesWithType (lldb::SymbolType symbol_type, Debug symbol_debug_type, Visibility symbol_visibility, std::vector<uint32_t>& matches, uint32_t start_idx = 0, uint32_t end_index = UINT32_MAX) const;
- uint32_t AppendSymbolIndexesWithName (const ConstString& symbol_name, std::vector<uint32_t>& matches);
- uint32_t AppendSymbolIndexesWithName (const ConstString& symbol_name, Debug symbol_debug_type, Visibility symbol_visibility, std::vector<uint32_t>& matches);
- uint32_t AppendSymbolIndexesWithNameAndType (const ConstString& symbol_name, lldb::SymbolType symbol_type, std::vector<uint32_t>& matches);
- uint32_t AppendSymbolIndexesWithNameAndType (const ConstString& symbol_name, lldb::SymbolType symbol_type, Debug symbol_debug_type, Visibility symbol_visibility, std::vector<uint32_t>& matches);
- uint32_t AppendSymbolIndexesMatchingRegExAndType (const RegularExpression ®ex, lldb::SymbolType symbol_type, std::vector<uint32_t>& indexes);
- uint32_t AppendSymbolIndexesMatchingRegExAndType (const RegularExpression ®ex, lldb::SymbolType symbol_type, Debug symbol_debug_type, Visibility symbol_visibility, std::vector<uint32_t>& indexes);
- size_t FindAllSymbolsWithNameAndType (const ConstString &name, lldb::SymbolType symbol_type, std::vector<uint32_t>& symbol_indexes);
- size_t FindAllSymbolsWithNameAndType (const ConstString &name, lldb::SymbolType symbol_type, Debug symbol_debug_type, Visibility symbol_visibility, std::vector<uint32_t>& symbol_indexes);
- size_t FindAllSymbolsMatchingRexExAndType (const RegularExpression ®ex, lldb::SymbolType symbol_type, Debug symbol_debug_type, Visibility symbol_visibility, std::vector<uint32_t>& symbol_indexes);
- Symbol * FindFirstSymbolWithNameAndType (const ConstString &name, lldb::SymbolType symbol_type, Debug symbol_debug_type, Visibility symbol_visibility);
- Symbol * FindSymbolAtFileAddress (lldb::addr_t file_addr);
- Symbol * FindSymbolContainingFileAddress (lldb::addr_t file_addr);
- void ForEachSymbolContainingFileAddress(lldb::addr_t file_addr, std::function<bool(Symbol *)> const &callback);
- size_t FindFunctionSymbols (const ConstString &name, uint32_t name_type_mask, SymbolContextList& sc_list);
- void CalculateSymbolSizes ();
-
- void SortSymbolIndexesByValue (std::vector<uint32_t>& indexes, bool remove_duplicates) const;
-
- static void DumpSymbolHeader (Stream *s);
-
-
- void Finalize ()
- {
- // Shrink to fit the symbols so we don't waste memory
- if (m_symbols.capacity() > m_symbols.size())
- {
- collection new_symbols (m_symbols.begin(), m_symbols.end());
- m_symbols.swap (new_symbols);
- }
- }
-
- void AppendSymbolNamesToMap (const IndexCollection &indexes,
- bool add_demangled,
- bool add_mangled,
- NameToIndexMap &name_to_index_map) const;
-
- ObjectFile * GetObjectFile()
- {
- return m_objfile;
- }
protected:
- typedef std::vector<Symbol> collection;
- typedef collection::iterator iterator;
- typedef collection::const_iterator const_iterator;
- typedef RangeDataVector<lldb::addr_t, lldb::addr_t, uint32_t> FileRangeToIndexMap;
- void InitNameIndexes ();
- void InitAddressIndexes ();
-
- ObjectFile * m_objfile;
- collection m_symbols;
- FileRangeToIndexMap m_file_addr_to_index;
- UniqueCStringMap<uint32_t> m_name_to_index;
- UniqueCStringMap<uint32_t> m_basename_to_index;
- UniqueCStringMap<uint32_t> m_method_to_index;
- UniqueCStringMap<uint32_t> m_selector_to_index;
- mutable std::recursive_mutex m_mutex; // Provide thread safety for this symbol table
- bool m_file_addr_to_index_computed:1,
- m_name_indexes_computed:1;
+ typedef std::vector<Symbol> collection;
+ typedef collection::iterator iterator;
+ typedef collection::const_iterator const_iterator;
+ typedef RangeDataVector<lldb::addr_t, lldb::addr_t, uint32_t>
+ FileRangeToIndexMap;
+ void InitNameIndexes();
+ void InitAddressIndexes();
+
+ ObjectFile *m_objfile;
+ collection m_symbols;
+ FileRangeToIndexMap m_file_addr_to_index;
+ UniqueCStringMap<uint32_t> m_name_to_index;
+ UniqueCStringMap<uint32_t> m_basename_to_index;
+ UniqueCStringMap<uint32_t> m_method_to_index;
+ UniqueCStringMap<uint32_t> m_selector_to_index;
+ mutable std::recursive_mutex
+ m_mutex; // Provide thread safety for this symbol table
+ bool m_file_addr_to_index_computed : 1, m_name_indexes_computed : 1;
+
private:
+ bool CheckSymbolAtIndex(size_t idx, Debug symbol_debug_type,
+ Visibility symbol_visibility) const {
+ switch (symbol_debug_type) {
+ case eDebugNo:
+ if (m_symbols[idx].IsDebug() == true)
+ return false;
+ break;
- bool
- CheckSymbolAtIndex (size_t idx, Debug symbol_debug_type, Visibility symbol_visibility) const
- {
- switch (symbol_debug_type)
- {
- case eDebugNo:
- if (m_symbols[idx].IsDebug() == true)
- return false;
- break;
-
- case eDebugYes:
- if (m_symbols[idx].IsDebug() == false)
- return false;
- break;
-
- case eDebugAny:
- break;
- }
-
- switch (symbol_visibility)
- {
- case eVisibilityAny:
- return true;
-
- case eVisibilityExtern:
- return m_symbols[idx].IsExternal();
-
- case eVisibilityPrivate:
- return !m_symbols[idx].IsExternal();
- }
+ case eDebugYes:
+ if (m_symbols[idx].IsDebug() == false)
return false;
+ break;
+
+ case eDebugAny:
+ break;
+ }
+
+ switch (symbol_visibility) {
+ case eVisibilityAny:
+ return true;
+
+ case eVisibilityExtern:
+ return m_symbols[idx].IsExternal();
+
+ case eVisibilityPrivate:
+ return !m_symbols[idx].IsExternal();
}
+ return false;
+ }
- void
- SymbolIndicesToSymbolContextList (std::vector<uint32_t> &symbol_indexes,
- SymbolContextList &sc_list);
+ void SymbolIndicesToSymbolContextList(std::vector<uint32_t> &symbol_indexes,
+ SymbolContextList &sc_list);
- DISALLOW_COPY_AND_ASSIGN (Symtab);
+ DISALLOW_COPY_AND_ASSIGN(Symtab);
};
} // namespace lldb_private
-#endif // liblldb_Symtab_h_
+#endif // liblldb_Symtab_h_
Modified: lldb/trunk/include/lldb/Symbol/TaggedASTType.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Symbol/TaggedASTType.h?rev=280751&r1=280750&r2=280751&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Symbol/TaggedASTType.h (original)
+++ lldb/trunk/include/lldb/Symbol/TaggedASTType.h Tue Sep 6 15:57:50 2016
@@ -12,50 +12,33 @@
#include "lldb/Symbol/CompilerType.h"
-namespace lldb_private
-{
+namespace lldb_private {
// For cases in which there are multiple classes of types that are not
// interchangeable, to allow static type checking.
-template <unsigned int C> class TaggedASTType : public CompilerType
-{
+template <unsigned int C> class TaggedASTType : public CompilerType {
public:
- TaggedASTType (const CompilerType &compiler_type) :
- CompilerType(compiler_type)
- {
- }
-
- TaggedASTType (lldb::opaque_compiler_type_t type, TypeSystem * type_system) :
- CompilerType(type_system, type)
- {
- }
-
- TaggedASTType (const TaggedASTType<C> &tw) :
- CompilerType(tw)
- {
- }
-
- TaggedASTType () :
- CompilerType()
- {
- }
-
- virtual
- ~TaggedASTType()
- {
- }
-
- TaggedASTType<C> &operator= (const TaggedASTType<C> &tw)
- {
- CompilerType::operator= (tw);
- return *this;
- }
+ TaggedASTType(const CompilerType &compiler_type)
+ : CompilerType(compiler_type) {}
+
+ TaggedASTType(lldb::opaque_compiler_type_t type, TypeSystem *type_system)
+ : CompilerType(type_system, type) {}
+
+ TaggedASTType(const TaggedASTType<C> &tw) : CompilerType(tw) {}
+
+ TaggedASTType() : CompilerType() {}
+
+ virtual ~TaggedASTType() {}
+
+ TaggedASTType<C> &operator=(const TaggedASTType<C> &tw) {
+ CompilerType::operator=(tw);
+ return *this;
+ }
};
// Commonly-used tagged types, so code using them is interoperable
-typedef TaggedASTType<0> TypeFromParser;
-typedef TaggedASTType<1> TypeFromUser;
-
+typedef TaggedASTType<0> TypeFromParser;
+typedef TaggedASTType<1> TypeFromUser;
}
#endif
Modified: lldb/trunk/include/lldb/Symbol/Type.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Symbol/Type.h?rev=280751&r1=280750&r2=280751&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Symbol/Type.h (original)
+++ lldb/trunk/include/lldb/Symbol/Type.h Tue Sep 6 15:57:50 2016
@@ -10,13 +10,13 @@
#ifndef liblldb_Type_h_
#define liblldb_Type_h_
-#include "lldb/lldb-private.h"
#include "lldb/Core/ClangForward.h"
#include "lldb/Core/ConstString.h"
#include "lldb/Core/UserID.h"
#include "lldb/Symbol/CompilerDecl.h"
#include "lldb/Symbol/CompilerType.h"
#include "lldb/Symbol/Declaration.h"
+#include "lldb/lldb-private.h"
#include "llvm/ADT/APSInt.h"
@@ -28,989 +28,647 @@ namespace lldb_private {
// CompilerContext allows an array of these items to be passed to
// perform detailed lookups in SymbolVendor and SymbolFile functions.
//----------------------------------------------------------------------
-struct CompilerContext
-{
- CompilerContext (CompilerContextKind t, const ConstString &n) :
- type(t),
- name(n)
- {
- }
-
- bool
- operator == (const CompilerContext &rhs) const
- {
- return type == rhs.type && name == rhs.name;
- }
-
- void
- Dump () const;
-
- CompilerContextKind type;
- ConstString name;
-};
-
-class SymbolFileType :
- public std::enable_shared_from_this<SymbolFileType>,
- public UserID
- {
- public:
- SymbolFileType (SymbolFile &symbol_file, lldb::user_id_t uid) :
- UserID (uid),
- m_symbol_file (symbol_file)
- {
- }
-
- SymbolFileType (SymbolFile &symbol_file, const lldb::TypeSP &type_sp);
-
-
- ~SymbolFileType ()
- {
- }
-
- Type *
- operator->()
- {
- return GetType ();
- }
-
- Type *
- GetType ();
-
- protected:
- SymbolFile &m_symbol_file;
- lldb::TypeSP m_type_sp;
- };
-
-class Type :
- public std::enable_shared_from_this<Type>,
- public UserID
-{
+struct CompilerContext {
+ CompilerContext(CompilerContextKind t, const ConstString &n)
+ : type(t), name(n) {}
+
+ bool operator==(const CompilerContext &rhs) const {
+ return type == rhs.type && name == rhs.name;
+ }
+
+ void Dump() const;
+
+ CompilerContextKind type;
+ ConstString name;
+};
+
+class SymbolFileType : public std::enable_shared_from_this<SymbolFileType>,
+ public UserID {
public:
- typedef enum EncodingDataTypeTag
- {
- eEncodingInvalid,
- eEncodingIsUID, ///< This type is the type whose UID is m_encoding_uid
- eEncodingIsConstUID, ///< This type is the type whose UID is m_encoding_uid with the const qualifier added
- eEncodingIsRestrictUID, ///< This type is the type whose UID is m_encoding_uid with the restrict qualifier added
- eEncodingIsVolatileUID, ///< This type is the type whose UID is m_encoding_uid with the volatile qualifier added
- eEncodingIsTypedefUID, ///< This type is pointer to a type whose UID is m_encoding_uid
- eEncodingIsPointerUID, ///< This type is pointer to a type whose UID is m_encoding_uid
- eEncodingIsLValueReferenceUID, ///< This type is L value reference to a type whose UID is m_encoding_uid
- eEncodingIsRValueReferenceUID, ///< This type is R value reference to a type whose UID is m_encoding_uid
- eEncodingIsSyntheticUID
- } EncodingDataType;
-
- // We must force the underlying type of the enum to be unsigned here. Not all compilers
- // behave the same with regards to the default underlying type of an enum, but because
- // this enum is used in an enum bitfield and integer comparisons are done with the value
- // we need to guarantee that it's always unsigned so that, for example, eResolveStateFull
- // doesn't compare less than eResolveStateUnresolved when used in a 2-bit bitfield.
- typedef enum ResolveStateTag : unsigned
- {
- eResolveStateUnresolved = 0,
- eResolveStateForward = 1,
- eResolveStateLayout = 2,
- eResolveStateFull = 3
- } ResolveState;
-
- Type (lldb::user_id_t uid,
- SymbolFile* symbol_file,
- const ConstString &name,
- uint64_t byte_size,
- SymbolContextScope *context,
- lldb::user_id_t encoding_uid,
- EncodingDataType encoding_uid_type,
- const Declaration& decl,
- const CompilerType &compiler_qual_type,
- ResolveState compiler_type_resolve_state);
-
- // This makes an invalid type. Used for functions that return a Type when they
- // get an error.
- Type();
-
- Type (const Type &rhs);
-
- const Type&
- operator= (const Type& rhs);
-
- void
- Dump(Stream *s, bool show_context);
-
- void
- DumpTypeName(Stream *s);
-
- // Since Type instances only keep a "SymbolFile *" internally, other classes
- // like TypeImpl need make sure the module is still around before playing with
- // Type instances. They can store a weak pointer to the Module;
- lldb::ModuleSP
- GetModule();
-
- void
- GetDescription (Stream *s, lldb::DescriptionLevel level, bool show_name);
-
- SymbolFile *
- GetSymbolFile()
- {
- return m_symbol_file;
- }
- const SymbolFile *
- GetSymbolFile() const
- {
- return m_symbol_file;
- }
-
- TypeList*
- GetTypeList();
-
- const ConstString&
- GetName();
-
- uint64_t
- GetByteSize();
-
- uint32_t
- GetNumChildren (bool omit_empty_base_classes);
-
- bool
- IsAggregateType ();
-
- bool
- IsValidType ()
- {
- return m_encoding_uid_type != eEncodingInvalid;
- }
-
- bool
- IsTypedef ()
- {
- return m_encoding_uid_type == eEncodingIsTypedefUID;
- }
-
- lldb::TypeSP
- GetTypedefType();
-
- const ConstString &
- GetName () const
- {
- return m_name;
- }
-
- ConstString
- GetQualifiedName ();
-
- void
- DumpValue(ExecutionContext *exe_ctx,
- Stream *s,
- const DataExtractor &data,
- uint32_t data_offset,
- bool show_type,
- bool show_summary,
- bool verbose,
- lldb::Format format = lldb::eFormatDefault);
-
- bool
- DumpValueInMemory(ExecutionContext *exe_ctx,
- Stream *s,
- lldb::addr_t address,
- AddressType address_type,
- bool show_types,
- bool show_summary,
- bool verbose);
-
- bool
- ReadFromMemory (ExecutionContext *exe_ctx,
- lldb::addr_t address,
- AddressType address_type,
- DataExtractor &data);
-
- bool
- WriteToMemory (ExecutionContext *exe_ctx,
- lldb::addr_t address,
- AddressType address_type,
- DataExtractor &data);
-
- bool
- GetIsDeclaration() const;
-
- void
- SetIsDeclaration(bool b);
-
- bool
- GetIsExternal() const;
-
- void
- SetIsExternal(bool b);
-
- lldb::Format
- GetFormat ();
-
- lldb::Encoding
- GetEncoding (uint64_t &count);
-
- SymbolContextScope *
- GetSymbolContextScope()
- {
- return m_context;
- }
- const SymbolContextScope *
- GetSymbolContextScope() const
- {
- return m_context;
- }
- void
- SetSymbolContextScope(SymbolContextScope *context)
- {
- m_context = context;
- }
-
- const lldb_private::Declaration &
- GetDeclaration () const;
-
- // Get the clang type, and resolve definitions for any
- // class/struct/union/enum types completely.
- CompilerType
- GetFullCompilerType ();
-
- // Get the clang type, and resolve definitions enough so that the type could
- // have layout performed. This allows ptrs and refs to class/struct/union/enum
- // types remain forward declarations.
- CompilerType
- GetLayoutCompilerType ();
-
- // Get the clang type and leave class/struct/union/enum types as forward
- // declarations if they haven't already been fully defined.
- CompilerType
- GetForwardCompilerType ();
-
- static int
- Compare(const Type &a, const Type &b);
-
- // From a fully qualified typename, split the type into the type basename
- // and the remaining type scope (namespaces/classes).
- static bool
- GetTypeScopeAndBasename (const char* &name_cstr,
- std::string &scope,
- std::string &basename,
- lldb::TypeClass &type_class);
- void
- SetEncodingType (Type *encoding_type)
- {
- m_encoding_type = encoding_type;
- }
-
- uint32_t
- GetEncodingMask ();
-
- bool
- IsCompleteObjCClass()
- {
- return m_flags.is_complete_objc_class;
- }
-
- void
- SetIsCompleteObjCClass(bool is_complete_objc_class)
- {
- m_flags.is_complete_objc_class = is_complete_objc_class;
- }
+ SymbolFileType(SymbolFile &symbol_file, lldb::user_id_t uid)
+ : UserID(uid), m_symbol_file(symbol_file) {}
+
+ SymbolFileType(SymbolFile &symbol_file, const lldb::TypeSP &type_sp);
+
+ ~SymbolFileType() {}
+
+ Type *operator->() { return GetType(); }
+
+ Type *GetType();
protected:
- ConstString m_name;
- SymbolFile *m_symbol_file;
- SymbolContextScope *m_context; // The symbol context in which this type is defined
- Type *m_encoding_type;
- lldb::user_id_t m_encoding_uid;
- EncodingDataType m_encoding_uid_type;
- uint64_t m_byte_size;
- Declaration m_decl;
- CompilerType m_compiler_type;
-
- struct Flags {
+ SymbolFile &m_symbol_file;
+ lldb::TypeSP m_type_sp;
+};
+
+class Type : public std::enable_shared_from_this<Type>, public UserID {
+public:
+ typedef enum EncodingDataTypeTag {
+ eEncodingInvalid,
+ eEncodingIsUID, ///< This type is the type whose UID is m_encoding_uid
+ eEncodingIsConstUID, ///< This type is the type whose UID is m_encoding_uid
+ ///with the const qualifier added
+ eEncodingIsRestrictUID, ///< This type is the type whose UID is
+ ///m_encoding_uid with the restrict qualifier added
+ eEncodingIsVolatileUID, ///< This type is the type whose UID is
+ ///m_encoding_uid with the volatile qualifier added
+ eEncodingIsTypedefUID, ///< This type is pointer to a type whose UID is
+ ///m_encoding_uid
+ eEncodingIsPointerUID, ///< This type is pointer to a type whose UID is
+ ///m_encoding_uid
+ eEncodingIsLValueReferenceUID, ///< This type is L value reference to a type
+ ///whose UID is m_encoding_uid
+ eEncodingIsRValueReferenceUID, ///< This type is R value reference to a type
+ ///whose UID is m_encoding_uid
+ eEncodingIsSyntheticUID
+ } EncodingDataType;
+
+ // We must force the underlying type of the enum to be unsigned here. Not all
+ // compilers
+ // behave the same with regards to the default underlying type of an enum, but
+ // because
+ // this enum is used in an enum bitfield and integer comparisons are done with
+ // the value
+ // we need to guarantee that it's always unsigned so that, for example,
+ // eResolveStateFull
+ // doesn't compare less than eResolveStateUnresolved when used in a 2-bit
+ // bitfield.
+ typedef enum ResolveStateTag : unsigned {
+ eResolveStateUnresolved = 0,
+ eResolveStateForward = 1,
+ eResolveStateLayout = 2,
+ eResolveStateFull = 3
+ } ResolveState;
+
+ Type(lldb::user_id_t uid, SymbolFile *symbol_file, const ConstString &name,
+ uint64_t byte_size, SymbolContextScope *context,
+ lldb::user_id_t encoding_uid, EncodingDataType encoding_uid_type,
+ const Declaration &decl, const CompilerType &compiler_qual_type,
+ ResolveState compiler_type_resolve_state);
+
+ // This makes an invalid type. Used for functions that return a Type when
+ // they
+ // get an error.
+ Type();
+
+ Type(const Type &rhs);
+
+ const Type &operator=(const Type &rhs);
+
+ void Dump(Stream *s, bool show_context);
+
+ void DumpTypeName(Stream *s);
+
+ // Since Type instances only keep a "SymbolFile *" internally, other classes
+ // like TypeImpl need make sure the module is still around before playing with
+ // Type instances. They can store a weak pointer to the Module;
+ lldb::ModuleSP GetModule();
+
+ void GetDescription(Stream *s, lldb::DescriptionLevel level, bool show_name);
+
+ SymbolFile *GetSymbolFile() { return m_symbol_file; }
+ const SymbolFile *GetSymbolFile() const { return m_symbol_file; }
+
+ TypeList *GetTypeList();
+
+ const ConstString &GetName();
+
+ uint64_t GetByteSize();
+
+ uint32_t GetNumChildren(bool omit_empty_base_classes);
+
+ bool IsAggregateType();
+
+ bool IsValidType() { return m_encoding_uid_type != eEncodingInvalid; }
+
+ bool IsTypedef() { return m_encoding_uid_type == eEncodingIsTypedefUID; }
+
+ lldb::TypeSP GetTypedefType();
+
+ const ConstString &GetName() const { return m_name; }
+
+ ConstString GetQualifiedName();
+
+ void DumpValue(ExecutionContext *exe_ctx, Stream *s,
+ const DataExtractor &data, uint32_t data_offset,
+ bool show_type, bool show_summary, bool verbose,
+ lldb::Format format = lldb::eFormatDefault);
+
+ bool DumpValueInMemory(ExecutionContext *exe_ctx, Stream *s,
+ lldb::addr_t address, AddressType address_type,
+ bool show_types, bool show_summary, bool verbose);
+
+ bool ReadFromMemory(ExecutionContext *exe_ctx, lldb::addr_t address,
+ AddressType address_type, DataExtractor &data);
+
+ bool WriteToMemory(ExecutionContext *exe_ctx, lldb::addr_t address,
+ AddressType address_type, DataExtractor &data);
+
+ bool GetIsDeclaration() const;
+
+ void SetIsDeclaration(bool b);
+
+ bool GetIsExternal() const;
+
+ void SetIsExternal(bool b);
+
+ lldb::Format GetFormat();
+
+ lldb::Encoding GetEncoding(uint64_t &count);
+
+ SymbolContextScope *GetSymbolContextScope() { return m_context; }
+ const SymbolContextScope *GetSymbolContextScope() const { return m_context; }
+ void SetSymbolContextScope(SymbolContextScope *context) {
+ m_context = context;
+ }
+
+ const lldb_private::Declaration &GetDeclaration() const;
+
+ // Get the clang type, and resolve definitions for any
+ // class/struct/union/enum types completely.
+ CompilerType GetFullCompilerType();
+
+ // Get the clang type, and resolve definitions enough so that the type could
+ // have layout performed. This allows ptrs and refs to class/struct/union/enum
+ // types remain forward declarations.
+ CompilerType GetLayoutCompilerType();
+
+ // Get the clang type and leave class/struct/union/enum types as forward
+ // declarations if they haven't already been fully defined.
+ CompilerType GetForwardCompilerType();
+
+ static int Compare(const Type &a, const Type &b);
+
+ // From a fully qualified typename, split the type into the type basename
+ // and the remaining type scope (namespaces/classes).
+ static bool GetTypeScopeAndBasename(const char *&name_cstr,
+ std::string &scope, std::string &basename,
+ lldb::TypeClass &type_class);
+ void SetEncodingType(Type *encoding_type) { m_encoding_type = encoding_type; }
+
+ uint32_t GetEncodingMask();
+
+ bool IsCompleteObjCClass() { return m_flags.is_complete_objc_class; }
+
+ void SetIsCompleteObjCClass(bool is_complete_objc_class) {
+ m_flags.is_complete_objc_class = is_complete_objc_class;
+ }
+
+protected:
+ ConstString m_name;
+ SymbolFile *m_symbol_file;
+ SymbolContextScope
+ *m_context; // The symbol context in which this type is defined
+ Type *m_encoding_type;
+ lldb::user_id_t m_encoding_uid;
+ EncodingDataType m_encoding_uid_type;
+ uint64_t m_byte_size;
+ Declaration m_decl;
+ CompilerType m_compiler_type;
+
+ struct Flags {
#ifdef __GNUC__
- // using unsigned type here to work around a very noisy gcc warning
- unsigned compiler_type_resolve_state : 2;
+ // using unsigned type here to work around a very noisy gcc warning
+ unsigned compiler_type_resolve_state : 2;
#else
- ResolveState compiler_type_resolve_state : 2;
+ ResolveState compiler_type_resolve_state : 2;
#endif
- bool is_complete_objc_class : 1;
- } m_flags;
+ bool is_complete_objc_class : 1;
+ } m_flags;
- Type *
- GetEncodingType ();
-
- bool
- ResolveClangType (ResolveState compiler_type_resolve_state);
+ Type *GetEncodingType();
+
+ bool ResolveClangType(ResolveState compiler_type_resolve_state);
};
// these classes are used to back the SBType* objects
-class TypePair
-{
+class TypePair {
public:
- TypePair () :
- compiler_type(),
- type_sp()
- {
- }
-
- TypePair (CompilerType type) :
- compiler_type(type),
- type_sp()
- {
- }
-
- TypePair (lldb::TypeSP type) :
- compiler_type(),
- type_sp(type)
- {
- compiler_type = type_sp->GetForwardCompilerType ();
- }
-
- bool
- IsValid () const
- {
- return compiler_type.IsValid() || (type_sp.get() != nullptr);
- }
-
- explicit operator bool () const
- {
- return IsValid();
- }
-
- bool
- operator == (const TypePair& rhs) const
- {
- return compiler_type == rhs.compiler_type &&
- type_sp.get() == rhs.type_sp.get();
- }
-
- bool
- operator != (const TypePair& rhs) const
- {
- return compiler_type != rhs.compiler_type ||
- type_sp.get() != rhs.type_sp.get();
- }
-
- void
- Clear ()
- {
- compiler_type.Clear();
- type_sp.reset();
- }
-
- ConstString
- GetName () const
- {
- if (type_sp)
- return type_sp->GetName();
- if (compiler_type)
- return compiler_type.GetTypeName();
- return ConstString ();
- }
-
- ConstString
- GetDisplayTypeName () const
- {
- if (type_sp)
- return type_sp->GetForwardCompilerType ().GetDisplayTypeName();
- if (compiler_type)
- return compiler_type.GetDisplayTypeName();
- return ConstString();
- }
-
- void
- SetType (CompilerType type)
- {
- type_sp.reset();
- compiler_type = type;
- }
-
- void
- SetType (lldb::TypeSP type)
- {
- type_sp = type;
- if (type_sp)
- compiler_type = type_sp->GetForwardCompilerType ();
- else
- compiler_type.Clear();
- }
-
- lldb::TypeSP
- GetTypeSP () const
- {
- return type_sp;
- }
-
- CompilerType
- GetCompilerType () const
- {
- return compiler_type;
- }
-
- CompilerType
- GetPointerType () const
- {
- if (type_sp)
- return type_sp->GetForwardCompilerType().GetPointerType();
- return compiler_type.GetPointerType();
- }
-
- CompilerType
- GetPointeeType () const
- {
- if (type_sp)
- return type_sp->GetForwardCompilerType ().GetPointeeType();
- return compiler_type.GetPointeeType();
- }
-
- CompilerType
- GetReferenceType () const
- {
- if (type_sp)
- return type_sp->GetForwardCompilerType ().GetLValueReferenceType();
- else
- return compiler_type.GetLValueReferenceType();
- }
-
- CompilerType
- GetTypedefedType () const
- {
- if (type_sp)
- return type_sp->GetForwardCompilerType ().GetTypedefedType();
- else
- return compiler_type.GetTypedefedType();
- }
-
- CompilerType
- GetDereferencedType () const
- {
- if (type_sp)
- return type_sp->GetForwardCompilerType ().GetNonReferenceType();
- else
- return compiler_type.GetNonReferenceType();
- }
-
- CompilerType
- GetUnqualifiedType () const
- {
- if (type_sp)
- return type_sp->GetForwardCompilerType ().GetFullyUnqualifiedType();
- else
- return compiler_type.GetFullyUnqualifiedType();
- }
-
- CompilerType
- GetCanonicalType () const
- {
- if (type_sp)
- return type_sp->GetForwardCompilerType ().GetCanonicalType();
- return compiler_type.GetCanonicalType();
- }
-
- TypeSystem *
- GetTypeSystem () const
- {
- return compiler_type.GetTypeSystem();
- }
-
- lldb::ModuleSP
- GetModule () const
- {
- if (type_sp)
- return type_sp->GetModule();
- return lldb::ModuleSP();
- }
+ TypePair() : compiler_type(), type_sp() {}
+
+ TypePair(CompilerType type) : compiler_type(type), type_sp() {}
+
+ TypePair(lldb::TypeSP type) : compiler_type(), type_sp(type) {
+ compiler_type = type_sp->GetForwardCompilerType();
+ }
+
+ bool IsValid() const {
+ return compiler_type.IsValid() || (type_sp.get() != nullptr);
+ }
+
+ explicit operator bool() const { return IsValid(); }
+
+ bool operator==(const TypePair &rhs) const {
+ return compiler_type == rhs.compiler_type &&
+ type_sp.get() == rhs.type_sp.get();
+ }
+
+ bool operator!=(const TypePair &rhs) const {
+ return compiler_type != rhs.compiler_type ||
+ type_sp.get() != rhs.type_sp.get();
+ }
+
+ void Clear() {
+ compiler_type.Clear();
+ type_sp.reset();
+ }
+
+ ConstString GetName() const {
+ if (type_sp)
+ return type_sp->GetName();
+ if (compiler_type)
+ return compiler_type.GetTypeName();
+ return ConstString();
+ }
+
+ ConstString GetDisplayTypeName() const {
+ if (type_sp)
+ return type_sp->GetForwardCompilerType().GetDisplayTypeName();
+ if (compiler_type)
+ return compiler_type.GetDisplayTypeName();
+ return ConstString();
+ }
+
+ void SetType(CompilerType type) {
+ type_sp.reset();
+ compiler_type = type;
+ }
+
+ void SetType(lldb::TypeSP type) {
+ type_sp = type;
+ if (type_sp)
+ compiler_type = type_sp->GetForwardCompilerType();
+ else
+ compiler_type.Clear();
+ }
+
+ lldb::TypeSP GetTypeSP() const { return type_sp; }
+
+ CompilerType GetCompilerType() const { return compiler_type; }
+
+ CompilerType GetPointerType() const {
+ if (type_sp)
+ return type_sp->GetForwardCompilerType().GetPointerType();
+ return compiler_type.GetPointerType();
+ }
+
+ CompilerType GetPointeeType() const {
+ if (type_sp)
+ return type_sp->GetForwardCompilerType().GetPointeeType();
+ return compiler_type.GetPointeeType();
+ }
+
+ CompilerType GetReferenceType() const {
+ if (type_sp)
+ return type_sp->GetForwardCompilerType().GetLValueReferenceType();
+ else
+ return compiler_type.GetLValueReferenceType();
+ }
+
+ CompilerType GetTypedefedType() const {
+ if (type_sp)
+ return type_sp->GetForwardCompilerType().GetTypedefedType();
+ else
+ return compiler_type.GetTypedefedType();
+ }
+
+ CompilerType GetDereferencedType() const {
+ if (type_sp)
+ return type_sp->GetForwardCompilerType().GetNonReferenceType();
+ else
+ return compiler_type.GetNonReferenceType();
+ }
+
+ CompilerType GetUnqualifiedType() const {
+ if (type_sp)
+ return type_sp->GetForwardCompilerType().GetFullyUnqualifiedType();
+ else
+ return compiler_type.GetFullyUnqualifiedType();
+ }
+
+ CompilerType GetCanonicalType() const {
+ if (type_sp)
+ return type_sp->GetForwardCompilerType().GetCanonicalType();
+ return compiler_type.GetCanonicalType();
+ }
+
+ TypeSystem *GetTypeSystem() const { return compiler_type.GetTypeSystem(); }
+
+ lldb::ModuleSP GetModule() const {
+ if (type_sp)
+ return type_sp->GetModule();
+ return lldb::ModuleSP();
+ }
+
protected:
- CompilerType compiler_type;
- lldb::TypeSP type_sp;
+ CompilerType compiler_type;
+ lldb::TypeSP type_sp;
};
-
+
// the two classes here are used by the public API as a backend to
// the SBType and SBTypeList classes
-
-class TypeImpl
-{
+
+class TypeImpl {
public:
-
- TypeImpl();
-
- ~TypeImpl () {}
-
- TypeImpl(const TypeImpl& rhs);
-
- TypeImpl (const lldb::TypeSP &type_sp);
-
- TypeImpl (const CompilerType &compiler_type);
-
- TypeImpl (const lldb::TypeSP &type_sp, const CompilerType &dynamic);
-
- TypeImpl (const CompilerType &compiler_type, const CompilerType &dynamic);
-
- TypeImpl (const TypePair &pair, const CompilerType &dynamic);
-
- void
- SetType (const lldb::TypeSP &type_sp);
-
- void
- SetType (const CompilerType &compiler_type);
-
- void
- SetType (const lldb::TypeSP &type_sp, const CompilerType &dynamic);
-
- void
- SetType (const CompilerType &compiler_type, const CompilerType &dynamic);
-
- void
- SetType (const TypePair &pair, const CompilerType &dynamic);
-
- TypeImpl&
- operator = (const TypeImpl& rhs);
-
- bool
- operator == (const TypeImpl& rhs) const;
-
- bool
- operator != (const TypeImpl& rhs) const;
-
- bool
- IsValid() const;
-
- explicit operator bool () const;
-
- void Clear();
-
- ConstString
- GetName () const;
-
- ConstString
- GetDisplayTypeName () const;
-
- TypeImpl
- GetPointerType () const;
-
- TypeImpl
- GetPointeeType () const;
-
- TypeImpl
- GetReferenceType () const;
-
- TypeImpl
- GetTypedefedType () const;
-
- TypeImpl
- GetDereferencedType () const;
-
- TypeImpl
- GetUnqualifiedType() const;
-
- TypeImpl
- GetCanonicalType() const;
-
- CompilerType
- GetCompilerType (bool prefer_dynamic);
-
- TypeSystem *
- GetTypeSystem (bool prefer_dynamic);
-
- bool
- GetDescription (lldb_private::Stream &strm,
- lldb::DescriptionLevel description_level);
-
+ TypeImpl();
+
+ ~TypeImpl() {}
+
+ TypeImpl(const TypeImpl &rhs);
+
+ TypeImpl(const lldb::TypeSP &type_sp);
+
+ TypeImpl(const CompilerType &compiler_type);
+
+ TypeImpl(const lldb::TypeSP &type_sp, const CompilerType &dynamic);
+
+ TypeImpl(const CompilerType &compiler_type, const CompilerType &dynamic);
+
+ TypeImpl(const TypePair &pair, const CompilerType &dynamic);
+
+ void SetType(const lldb::TypeSP &type_sp);
+
+ void SetType(const CompilerType &compiler_type);
+
+ void SetType(const lldb::TypeSP &type_sp, const CompilerType &dynamic);
+
+ void SetType(const CompilerType &compiler_type, const CompilerType &dynamic);
+
+ void SetType(const TypePair &pair, const CompilerType &dynamic);
+
+ TypeImpl &operator=(const TypeImpl &rhs);
+
+ bool operator==(const TypeImpl &rhs) const;
+
+ bool operator!=(const TypeImpl &rhs) const;
+
+ bool IsValid() const;
+
+ explicit operator bool() const;
+
+ void Clear();
+
+ ConstString GetName() const;
+
+ ConstString GetDisplayTypeName() const;
+
+ TypeImpl GetPointerType() const;
+
+ TypeImpl GetPointeeType() const;
+
+ TypeImpl GetReferenceType() const;
+
+ TypeImpl GetTypedefedType() const;
+
+ TypeImpl GetDereferencedType() const;
+
+ TypeImpl GetUnqualifiedType() const;
+
+ TypeImpl GetCanonicalType() const;
+
+ CompilerType GetCompilerType(bool prefer_dynamic);
+
+ TypeSystem *GetTypeSystem(bool prefer_dynamic);
+
+ bool GetDescription(lldb_private::Stream &strm,
+ lldb::DescriptionLevel description_level);
+
private:
-
- bool
- CheckModule (lldb::ModuleSP &module_sp) const;
+ bool CheckModule(lldb::ModuleSP &module_sp) const;
- lldb::ModuleWP m_module_wp;
- TypePair m_static_type;
- CompilerType m_dynamic_type;
+ lldb::ModuleWP m_module_wp;
+ TypePair m_static_type;
+ CompilerType m_dynamic_type;
};
-class TypeListImpl
-{
+class TypeListImpl {
public:
- TypeListImpl() :
- m_content()
- {
- }
-
- void
- Append (const lldb::TypeImplSP& type)
- {
- m_content.push_back(type);
- }
-
- class AppendVisitor
- {
- public:
- AppendVisitor(TypeListImpl &type_list) :
- m_type_list(type_list)
- {
- }
-
- void
- operator() (const lldb::TypeImplSP& type)
- {
- m_type_list.Append(type);
- }
-
- private:
- TypeListImpl &m_type_list;
- };
-
- void
- Append (const lldb_private::TypeList &type_list);
-
- lldb::TypeImplSP
- GetTypeAtIndex(size_t idx)
- {
- lldb::TypeImplSP type_sp;
- if (idx < GetSize())
- type_sp = m_content[idx];
- return type_sp;
- }
-
- size_t
- GetSize()
- {
- return m_content.size();
- }
-
+ TypeListImpl() : m_content() {}
+
+ void Append(const lldb::TypeImplSP &type) { m_content.push_back(type); }
+
+ class AppendVisitor {
+ public:
+ AppendVisitor(TypeListImpl &type_list) : m_type_list(type_list) {}
+
+ void operator()(const lldb::TypeImplSP &type) { m_type_list.Append(type); }
+
+ private:
+ TypeListImpl &m_type_list;
+ };
+
+ void Append(const lldb_private::TypeList &type_list);
+
+ lldb::TypeImplSP GetTypeAtIndex(size_t idx) {
+ lldb::TypeImplSP type_sp;
+ if (idx < GetSize())
+ type_sp = m_content[idx];
+ return type_sp;
+ }
+
+ size_t GetSize() { return m_content.size(); }
+
private:
- std::vector<lldb::TypeImplSP> m_content;
+ std::vector<lldb::TypeImplSP> m_content;
};
-
-class TypeMemberImpl
-{
+
+class TypeMemberImpl {
public:
- TypeMemberImpl () :
- m_type_impl_sp (),
- m_bit_offset (0),
- m_name (),
- m_bitfield_bit_size (0),
- m_is_bitfield (false)
-
- {
- }
-
- TypeMemberImpl (const lldb::TypeImplSP &type_impl_sp,
- uint64_t bit_offset,
- const ConstString &name,
- uint32_t bitfield_bit_size = 0,
- bool is_bitfield = false) :
- m_type_impl_sp (type_impl_sp),
- m_bit_offset (bit_offset),
- m_name (name),
- m_bitfield_bit_size (bitfield_bit_size),
- m_is_bitfield (is_bitfield)
- {
- }
-
- TypeMemberImpl (const lldb::TypeImplSP &type_impl_sp,
- uint64_t bit_offset):
- m_type_impl_sp (type_impl_sp),
- m_bit_offset (bit_offset),
- m_name (),
- m_bitfield_bit_size (0),
- m_is_bitfield (false)
- {
- if (m_type_impl_sp)
- m_name = m_type_impl_sp->GetName();
- }
-
- const lldb::TypeImplSP &
- GetTypeImpl ()
- {
- return m_type_impl_sp;
- }
-
- const ConstString &
- GetName () const
- {
- return m_name;
- }
-
- uint64_t
- GetBitOffset () const
- {
- return m_bit_offset;
- }
-
- uint32_t
- GetBitfieldBitSize () const
- {
- return m_bitfield_bit_size;
- }
-
- void
- SetBitfieldBitSize (uint32_t bitfield_bit_size)
- {
- m_bitfield_bit_size = bitfield_bit_size;
- }
-
- bool
- GetIsBitfield () const
- {
- return m_is_bitfield;
- }
-
- void
- SetIsBitfield (bool is_bitfield)
- {
- m_is_bitfield = is_bitfield;
- }
+ TypeMemberImpl()
+ : m_type_impl_sp(), m_bit_offset(0), m_name(), m_bitfield_bit_size(0),
+ m_is_bitfield(false)
+
+ {}
+
+ TypeMemberImpl(const lldb::TypeImplSP &type_impl_sp, uint64_t bit_offset,
+ const ConstString &name, uint32_t bitfield_bit_size = 0,
+ bool is_bitfield = false)
+ : m_type_impl_sp(type_impl_sp), m_bit_offset(bit_offset), m_name(name),
+ m_bitfield_bit_size(bitfield_bit_size), m_is_bitfield(is_bitfield) {}
+
+ TypeMemberImpl(const lldb::TypeImplSP &type_impl_sp, uint64_t bit_offset)
+ : m_type_impl_sp(type_impl_sp), m_bit_offset(bit_offset), m_name(),
+ m_bitfield_bit_size(0), m_is_bitfield(false) {
+ if (m_type_impl_sp)
+ m_name = m_type_impl_sp->GetName();
+ }
+
+ const lldb::TypeImplSP &GetTypeImpl() { return m_type_impl_sp; }
+
+ const ConstString &GetName() const { return m_name; }
+
+ uint64_t GetBitOffset() const { return m_bit_offset; }
+
+ uint32_t GetBitfieldBitSize() const { return m_bitfield_bit_size; }
+
+ void SetBitfieldBitSize(uint32_t bitfield_bit_size) {
+ m_bitfield_bit_size = bitfield_bit_size;
+ }
+
+ bool GetIsBitfield() const { return m_is_bitfield; }
+
+ void SetIsBitfield(bool is_bitfield) { m_is_bitfield = is_bitfield; }
protected:
- lldb::TypeImplSP m_type_impl_sp;
- uint64_t m_bit_offset;
- ConstString m_name;
- uint32_t m_bitfield_bit_size; // Bit size for bitfield members only
- bool m_is_bitfield;
+ lldb::TypeImplSP m_type_impl_sp;
+ uint64_t m_bit_offset;
+ ConstString m_name;
+ uint32_t m_bitfield_bit_size; // Bit size for bitfield members only
+ bool m_is_bitfield;
};
-
///
-/// Sometimes you can find the name of the type corresponding to an object, but we don't have debug
-/// information for it. If that is the case, you can return one of these objects, and then if it
-/// has a full type, you can use that, but if not at least you can print the name for informational
+/// Sometimes you can find the name of the type corresponding to an object, but
+/// we don't have debug
+/// information for it. If that is the case, you can return one of these
+/// objects, and then if it
+/// has a full type, you can use that, but if not at least you can print the
+/// name for informational
/// purposes.
///
-class TypeAndOrName
-{
+class TypeAndOrName {
public:
- TypeAndOrName ();
- TypeAndOrName (lldb::TypeSP &type_sp);
- TypeAndOrName (const CompilerType &compiler_type);
- TypeAndOrName (const char *type_str);
- TypeAndOrName (const TypeAndOrName &rhs);
- TypeAndOrName (ConstString &type_const_string);
-
- TypeAndOrName &
- operator= (const TypeAndOrName &rhs);
-
- bool
- operator==(const TypeAndOrName &other) const;
-
- bool
- operator!=(const TypeAndOrName &other) const;
-
- ConstString GetName () const;
-
- lldb::TypeSP
- GetTypeSP () const
- {
- return m_type_pair.GetTypeSP();
- }
-
- CompilerType
- GetCompilerType () const
- {
- return m_type_pair.GetCompilerType();
- }
-
- void
- SetName (const ConstString &type_name);
-
- void
- SetName (const char *type_name_cstr);
-
- void
- SetTypeSP (lldb::TypeSP type_sp);
-
- void
- SetCompilerType (CompilerType compiler_type);
-
- bool
- IsEmpty () const;
-
- bool
- HasName () const;
-
- bool
- HasTypeSP () const;
-
- bool
- HasCompilerType () const;
-
- bool
- HasType () const
- {
- return HasTypeSP() || HasCompilerType();
- }
-
- void
- Clear ();
-
- explicit operator bool ()
- {
- return !IsEmpty();
- }
-
+ TypeAndOrName();
+ TypeAndOrName(lldb::TypeSP &type_sp);
+ TypeAndOrName(const CompilerType &compiler_type);
+ TypeAndOrName(const char *type_str);
+ TypeAndOrName(const TypeAndOrName &rhs);
+ TypeAndOrName(ConstString &type_const_string);
+
+ TypeAndOrName &operator=(const TypeAndOrName &rhs);
+
+ bool operator==(const TypeAndOrName &other) const;
+
+ bool operator!=(const TypeAndOrName &other) const;
+
+ ConstString GetName() const;
+
+ lldb::TypeSP GetTypeSP() const { return m_type_pair.GetTypeSP(); }
+
+ CompilerType GetCompilerType() const { return m_type_pair.GetCompilerType(); }
+
+ void SetName(const ConstString &type_name);
+
+ void SetName(const char *type_name_cstr);
+
+ void SetTypeSP(lldb::TypeSP type_sp);
+
+ void SetCompilerType(CompilerType compiler_type);
+
+ bool IsEmpty() const;
+
+ bool HasName() const;
+
+ bool HasTypeSP() const;
+
+ bool HasCompilerType() const;
+
+ bool HasType() const { return HasTypeSP() || HasCompilerType(); }
+
+ void Clear();
+
+ explicit operator bool() { return !IsEmpty(); }
+
private:
- TypePair m_type_pair;
- ConstString m_type_name;
+ TypePair m_type_pair;
+ ConstString m_type_name;
};
-
-class TypeMemberFunctionImpl
-{
+
+class TypeMemberFunctionImpl {
public:
- TypeMemberFunctionImpl() :
- m_type (),
- m_decl (),
- m_name(),
- m_kind (lldb::eMemberFunctionKindUnknown)
- {
- }
-
- TypeMemberFunctionImpl (const CompilerType& type,
- const CompilerDecl& decl,
- const std::string& name,
- const lldb::MemberFunctionKind& kind) :
- m_type (type),
- m_decl (decl),
- m_name(name),
- m_kind (kind)
- {
- }
-
- bool
- IsValid ();
-
- ConstString
- GetName () const;
-
- ConstString
- GetMangledName () const;
-
- CompilerType
- GetType () const;
-
- CompilerType
- GetReturnType () const;
-
- size_t
- GetNumArguments () const;
-
- CompilerType
- GetArgumentAtIndex (size_t idx) const;
-
- lldb::MemberFunctionKind
- GetKind () const;
-
- bool
- GetDescription (Stream& stream);
-
+ TypeMemberFunctionImpl()
+ : m_type(), m_decl(), m_name(), m_kind(lldb::eMemberFunctionKindUnknown) {
+ }
+
+ TypeMemberFunctionImpl(const CompilerType &type, const CompilerDecl &decl,
+ const std::string &name,
+ const lldb::MemberFunctionKind &kind)
+ : m_type(type), m_decl(decl), m_name(name), m_kind(kind) {}
+
+ bool IsValid();
+
+ ConstString GetName() const;
+
+ ConstString GetMangledName() const;
+
+ CompilerType GetType() const;
+
+ CompilerType GetReturnType() const;
+
+ size_t GetNumArguments() const;
+
+ CompilerType GetArgumentAtIndex(size_t idx) const;
+
+ lldb::MemberFunctionKind GetKind() const;
+
+ bool GetDescription(Stream &stream);
+
protected:
- std::string
- GetPrintableTypeName ();
+ std::string GetPrintableTypeName();
private:
- CompilerType m_type;
- CompilerDecl m_decl;
- ConstString m_name;
- lldb::MemberFunctionKind m_kind;
+ CompilerType m_type;
+ CompilerDecl m_decl;
+ ConstString m_name;
+ lldb::MemberFunctionKind m_kind;
};
-class TypeEnumMemberImpl
-{
+class TypeEnumMemberImpl {
public:
- TypeEnumMemberImpl () :
- m_integer_type_sp(),
- m_name("<invalid>"),
- m_value(),
- m_valid(false)
- {
- }
-
- TypeEnumMemberImpl (const lldb::TypeImplSP &integer_type_sp,
- const ConstString &name,
- const llvm::APSInt &value);
-
- TypeEnumMemberImpl (const TypeEnumMemberImpl& rhs) :
- m_integer_type_sp(rhs.m_integer_type_sp),
- m_name(rhs.m_name),
- m_value(rhs.m_value),
- m_valid(rhs.m_valid)
- {
- }
-
- TypeEnumMemberImpl&
- operator = (const TypeEnumMemberImpl& rhs);
-
- bool
- IsValid ()
- {
- return m_valid;
- }
-
- const ConstString &
- GetName () const
- {
- return m_name;
- }
-
- const lldb::TypeImplSP &
- GetIntegerType () const
- {
- return m_integer_type_sp;
- }
-
- uint64_t
- GetValueAsUnsigned () const
- {
- return m_value.getZExtValue();
- }
-
- int64_t
- GetValueAsSigned () const
- {
- return m_value.getSExtValue();
- }
+ TypeEnumMemberImpl()
+ : m_integer_type_sp(), m_name("<invalid>"), m_value(), m_valid(false) {}
+
+ TypeEnumMemberImpl(const lldb::TypeImplSP &integer_type_sp,
+ const ConstString &name, const llvm::APSInt &value);
+
+ TypeEnumMemberImpl(const TypeEnumMemberImpl &rhs)
+ : m_integer_type_sp(rhs.m_integer_type_sp), m_name(rhs.m_name),
+ m_value(rhs.m_value), m_valid(rhs.m_valid) {}
+
+ TypeEnumMemberImpl &operator=(const TypeEnumMemberImpl &rhs);
+
+ bool IsValid() { return m_valid; }
+
+ const ConstString &GetName() const { return m_name; }
+
+ const lldb::TypeImplSP &GetIntegerType() const { return m_integer_type_sp; }
+
+ uint64_t GetValueAsUnsigned() const { return m_value.getZExtValue(); }
+
+ int64_t GetValueAsSigned() const { return m_value.getSExtValue(); }
protected:
- lldb::TypeImplSP m_integer_type_sp;
- ConstString m_name;
- llvm::APSInt m_value;
- bool m_valid;
+ lldb::TypeImplSP m_integer_type_sp;
+ ConstString m_name;
+ llvm::APSInt m_value;
+ bool m_valid;
};
-class TypeEnumMemberListImpl
-{
+class TypeEnumMemberListImpl {
public:
- TypeEnumMemberListImpl() :
- m_content()
- {
- }
-
- void
- Append (const lldb::TypeEnumMemberImplSP& type)
- {
- m_content.push_back(type);
- }
-
- void
- Append (const lldb_private::TypeEnumMemberListImpl& type_list);
-
- lldb::TypeEnumMemberImplSP
- GetTypeEnumMemberAtIndex(size_t idx)
- {
- lldb::TypeEnumMemberImplSP enum_member;
- if (idx < GetSize())
- enum_member = m_content[idx];
- return enum_member;
- }
-
- size_t
- GetSize()
- {
- return m_content.size();
- }
+ TypeEnumMemberListImpl() : m_content() {}
+
+ void Append(const lldb::TypeEnumMemberImplSP &type) {
+ m_content.push_back(type);
+ }
+
+ void Append(const lldb_private::TypeEnumMemberListImpl &type_list);
+
+ lldb::TypeEnumMemberImplSP GetTypeEnumMemberAtIndex(size_t idx) {
+ lldb::TypeEnumMemberImplSP enum_member;
+ if (idx < GetSize())
+ enum_member = m_content[idx];
+ return enum_member;
+ }
+
+ size_t GetSize() { return m_content.size(); }
private:
- std::vector<lldb::TypeEnumMemberImplSP> m_content;
+ std::vector<lldb::TypeEnumMemberImplSP> m_content;
};
} // namespace lldb_private
-#endif // liblldb_Type_h_
-
+#endif // liblldb_Type_h_
Modified: lldb/trunk/include/lldb/Symbol/TypeList.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Symbol/TypeList.h?rev=280751&r1=280750&r2=280751&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Symbol/TypeList.h (original)
+++ lldb/trunk/include/lldb/Symbol/TypeList.h Tue Sep 6 15:57:50 2016
@@ -10,84 +10,66 @@
#ifndef liblldb_TypeList_h_
#define liblldb_TypeList_h_
-#include "lldb/lldb-private.h"
#include "lldb/Symbol/Type.h"
#include "lldb/Utility/Iterable.h"
-#include <vector>
+#include "lldb/lldb-private.h"
#include <functional>
+#include <vector>
namespace lldb_private {
-class TypeList
-{
+class TypeList {
public:
- //------------------------------------------------------------------
- // Constructors and Destructors
- //------------------------------------------------------------------
- TypeList();
-
- virtual
- ~TypeList();
-
- void
- Clear();
-
- void
- Dump(Stream *s, bool show_context);
-
-// lldb::TypeSP
-// FindType(lldb::user_id_t uid);
-
- TypeList
- FindTypes(const ConstString &name);
-
- void
- Insert (const lldb::TypeSP& type);
-
- uint32_t
- GetSize() const;
-
- lldb::TypeSP
- GetTypeAtIndex(uint32_t idx);
-
- typedef std::vector<lldb::TypeSP> collection;
- typedef AdaptedIterable<collection, lldb::TypeSP, vector_adapter> TypeIterable;
-
- TypeIterable
- Types ()
- {
- return TypeIterable(m_types);
- }
-
- void
- ForEach (std::function <bool(const lldb::TypeSP &type_sp)> const &callback) const;
-
- void
- ForEach (std::function <bool(lldb::TypeSP &type_sp)> const &callback);
-
-
- void
- RemoveMismatchedTypes (const char *qualified_typename,
- bool exact_match);
-
- void
- RemoveMismatchedTypes (const std::string &type_scope,
- const std::string &type_basename,
- lldb::TypeClass type_class,
- bool exact_match);
+ //------------------------------------------------------------------
+ // Constructors and Destructors
+ //------------------------------------------------------------------
+ TypeList();
+
+ virtual ~TypeList();
+
+ void Clear();
+
+ void Dump(Stream *s, bool show_context);
+
+ // lldb::TypeSP
+ // FindType(lldb::user_id_t uid);
+
+ TypeList FindTypes(const ConstString &name);
+
+ void Insert(const lldb::TypeSP &type);
+
+ uint32_t GetSize() const;
+
+ lldb::TypeSP GetTypeAtIndex(uint32_t idx);
+
+ typedef std::vector<lldb::TypeSP> collection;
+ typedef AdaptedIterable<collection, lldb::TypeSP, vector_adapter>
+ TypeIterable;
+
+ TypeIterable Types() { return TypeIterable(m_types); }
+
+ void ForEach(
+ std::function<bool(const lldb::TypeSP &type_sp)> const &callback) const;
+
+ void ForEach(std::function<bool(lldb::TypeSP &type_sp)> const &callback);
+
+ void RemoveMismatchedTypes(const char *qualified_typename, bool exact_match);
+
+ void RemoveMismatchedTypes(const std::string &type_scope,
+ const std::string &type_basename,
+ lldb::TypeClass type_class, bool exact_match);
- void
- RemoveMismatchedTypes (lldb::TypeClass type_class);
+ void RemoveMismatchedTypes(lldb::TypeClass type_class);
private:
- typedef collection::iterator iterator;
- typedef collection::const_iterator const_iterator;
+ typedef collection::iterator iterator;
+ typedef collection::const_iterator const_iterator;
- collection m_types;
+ collection m_types;
- DISALLOW_COPY_AND_ASSIGN (TypeList);
+ DISALLOW_COPY_AND_ASSIGN(TypeList);
};
} // namespace lldb_private
-#endif // liblldb_TypeList_h_
+#endif // liblldb_TypeList_h_
Modified: lldb/trunk/include/lldb/Symbol/TypeMap.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Symbol/TypeMap.h?rev=280751&r1=280750&r2=280751&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Symbol/TypeMap.h (original)
+++ lldb/trunk/include/lldb/Symbol/TypeMap.h Tue Sep 6 15:57:50 2016
@@ -10,89 +10,68 @@
#ifndef liblldb_TypeMap_h_
#define liblldb_TypeMap_h_
-#include "lldb/lldb-private.h"
#include "lldb/Symbol/Type.h"
#include "lldb/Utility/Iterable.h"
-#include <map>
+#include "lldb/lldb-private.h"
#include <functional>
+#include <map>
namespace lldb_private {
-class TypeMap
-{
+class TypeMap {
public:
- //------------------------------------------------------------------
- // Constructors and Destructors
- //------------------------------------------------------------------
- TypeMap();
-
- virtual
- ~TypeMap();
-
- void
- Clear();
-
- void
- Dump(Stream *s, bool show_context);
-
- TypeMap
- FindTypes(const ConstString &name);
-
- void
- Insert (const lldb::TypeSP& type);
-
- bool
- Empty() const;
-
- bool
- InsertUnique (const lldb::TypeSP& type);
-
- uint32_t
- GetSize() const;
-
- lldb::TypeSP
- GetTypeAtIndex(uint32_t idx);
-
- typedef std::multimap<lldb::user_id_t, lldb::TypeSP> collection;
- typedef AdaptedIterable<collection, lldb::TypeSP, map_adapter> TypeIterable;
-
- TypeIterable
- Types ()
- {
- return TypeIterable(m_types);
- }
-
- void
- ForEach (std::function <bool(const lldb::TypeSP &type_sp)> const &callback) const;
-
- void
- ForEach (std::function <bool(lldb::TypeSP &type_sp)> const &callback);
-
- bool
- Remove (const lldb::TypeSP &type_sp);
-
- void
- RemoveMismatchedTypes (const char *qualified_typename,
- bool exact_match);
-
- void
- RemoveMismatchedTypes (const std::string &type_scope,
- const std::string &type_basename,
- lldb::TypeClass type_class,
- bool exact_match);
+ //------------------------------------------------------------------
+ // Constructors and Destructors
+ //------------------------------------------------------------------
+ TypeMap();
+
+ virtual ~TypeMap();
+
+ void Clear();
+
+ void Dump(Stream *s, bool show_context);
+
+ TypeMap FindTypes(const ConstString &name);
+
+ void Insert(const lldb::TypeSP &type);
+
+ bool Empty() const;
+
+ bool InsertUnique(const lldb::TypeSP &type);
+
+ uint32_t GetSize() const;
+
+ lldb::TypeSP GetTypeAtIndex(uint32_t idx);
+
+ typedef std::multimap<lldb::user_id_t, lldb::TypeSP> collection;
+ typedef AdaptedIterable<collection, lldb::TypeSP, map_adapter> TypeIterable;
+
+ TypeIterable Types() { return TypeIterable(m_types); }
+
+ void ForEach(
+ std::function<bool(const lldb::TypeSP &type_sp)> const &callback) const;
+
+ void ForEach(std::function<bool(lldb::TypeSP &type_sp)> const &callback);
+
+ bool Remove(const lldb::TypeSP &type_sp);
+
+ void RemoveMismatchedTypes(const char *qualified_typename, bool exact_match);
+
+ void RemoveMismatchedTypes(const std::string &type_scope,
+ const std::string &type_basename,
+ lldb::TypeClass type_class, bool exact_match);
- void
- RemoveMismatchedTypes (lldb::TypeClass type_class);
+ void RemoveMismatchedTypes(lldb::TypeClass type_class);
private:
- typedef collection::iterator iterator;
- typedef collection::const_iterator const_iterator;
+ typedef collection::iterator iterator;
+ typedef collection::const_iterator const_iterator;
- collection m_types;
+ collection m_types;
- DISALLOW_COPY_AND_ASSIGN (TypeMap);
+ DISALLOW_COPY_AND_ASSIGN(TypeMap);
};
} // namespace lldb_private
-#endif // liblldb_TypeMap_h_
+#endif // liblldb_TypeMap_h_
More information about the lldb-commits
mailing list