summaryrefslogtreecommitdiffstats
path: root/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
diff options
context:
space:
mode:
authorJonas Devlieghere <jonas@devlieghere.com>2019-07-25 21:36:37 +0000
committerJonas Devlieghere <jonas@devlieghere.com>2019-07-25 21:36:37 +0000
commit971f9ca612f22d251631f6b7dcc5efd8324bc0f2 (patch)
tree282cdef9ce40fa67215fe675dc77e76b234f467c /lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
parentd16a034c7cd33208a86301f05eb4c1a358914475 (diff)
downloadbcm5719-llvm-971f9ca612f22d251631f6b7dcc5efd8324bc0f2.tar.gz
bcm5719-llvm-971f9ca612f22d251631f6b7dcc5efd8324bc0f2.zip
Let tablegen generate property definitions
Property definitions are currently defined in a PropertyDefinition array and have a corresponding enum to index in this array. Unfortunately this is quite error prone. Indeed, just today we found an incorrect merge where a discrepancy between the order of the enum values and their definition caused the test suite to fail spectacularly. Tablegen can streamline the process of generating the property definition table while at the same time guaranteeing that the enums stay in sync. That's exactly what this patch does. It adds a new tablegen file for the properties, building on top of the infrastructure that Raphael added recently for the command options. It also introduces two new tablegen backends: one for the property definitions and one for their corresponding enums. It might be worth mentioning that I generated most of the tablegen definitions from the existing property definitions, by adding a dump method to the struct. This seems both more efficient and less error prone that copying everything over by hand. Only Enum properties needed manual fixup for the EnumValues and DefaultEnumValue fields. Differential revision: https://reviews.llvm.org/D65185 llvm-svn: 367058
Diffstat (limited to 'lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp')
-rw-r--r--lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp38
1 files changed, 6 insertions, 32 deletions
diff --git a/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp b/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
index 5cb5f147367..ade1d84b16b 100644
--- a/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
+++ b/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
@@ -111,39 +111,13 @@ void DumpProcessGDBRemotePacketHistory(void *p, const char *path) {
namespace {
static constexpr PropertyDefinition g_properties[] = {
- {"packet-timeout",
- OptionValue::eTypeUInt64,
- true,
- 5
-#if defined(__has_feature)
-#if __has_feature(address_sanitizer)
- * 2
-#endif
-#endif
- ,
- nullptr,
- {},
- "Specify the default packet timeout in seconds."},
- {"target-definition-file",
- OptionValue::eTypeFileSpec,
- true,
- 0,
- nullptr,
- {},
- "The file that provides the description for remote target registers."},
- {"use-libraries-svr4",
- OptionValue::eTypeBoolean,
- true,
- false,
- nullptr,
- {},
- "If true, the libraries-svr4 feature will be used to get a hold of the "
- "process's loaded modules."}};
+#define LLDB_PROPERTIES_processgdbremote
+#include "Properties.inc"
+};
enum {
- ePropertyPacketTimeout,
- ePropertyTargetDefinitionFile,
- ePropertyUseSVR4
+#define LLDB_PROPERTIES_processgdbremote
+#include "PropertiesEnum.inc"
};
class PluginProperties : public Properties {
@@ -2469,7 +2443,7 @@ void ProcessGDBRemote::RefreshStateAfterStop() {
// Clear the thread stop stack
m_stop_packet_stack.clear();
}
-
+
// If we have queried for a default thread id
if (m_initial_tid != LLDB_INVALID_THREAD_ID) {
m_thread_list.SetSelectedThreadByID(m_initial_tid);
OpenPOWER on IntegriCloud