Added a way to extract the module specifications from a file. A module specification is information that is required to describe a module (executable, shared library, object file, ect). This information includes host path, platform path (remote path), symbol file path, UUID, object name (for objects in .a files for example you could have an object name of "foo.o"), and target triple. Module specification can be used to create a module, or used to add a module to a target. A list of module specifications can be used to enumerate objects in container objects (like universal mach files and BSD archive files).
There are two new classes:
lldb::SBModuleSpec
lldb::SBModuleSpecList
The SBModuleSpec wraps up a lldb_private::ModuleSpec, and SBModuleSpecList wraps up a lldb_private::ModuleSpecList.
llvm-svn: 185877
diff --git a/lldb/source/Core/UUID.cpp b/lldb/source/Core/UUID.cpp
index 8b2158b..c1b3eb1 100644
--- a/lldb/source/Core/UUID.cpp
+++ b/lldb/source/Core/UUID.cpp
@@ -105,25 +105,34 @@
}
}
-void
+bool
UUID::SetBytes (const void *uuid_bytes, uint32_t num_uuid_bytes)
{
- if (uuid_bytes && num_uuid_bytes >= 20)
+ if (uuid_bytes)
{
- m_num_uuid_bytes = 20;
- ::memcpy (m_uuid, uuid_bytes, m_num_uuid_bytes);
+ switch (num_uuid_bytes)
+ {
+ case 20:
+ m_num_uuid_bytes = 20;
+ break;
+ case 16:
+ m_num_uuid_bytes = 16;
+ m_uuid[16] = m_uuid[17] = m_uuid[18] = m_uuid[19] = 0;
+ break;
+ default:
+ // Unsupported UUID byte size
+ m_num_uuid_bytes = 0;
+ break;
+ }
+
+ if (m_num_uuid_bytes > 0)
+ {
+ ::memcpy (m_uuid, uuid_bytes, m_num_uuid_bytes);
+ return true;
+ }
}
- else if (uuid_bytes && num_uuid_bytes >= 16)
- {
- m_num_uuid_bytes = 16;
- ::memcpy (m_uuid, uuid_bytes, m_num_uuid_bytes);
- m_uuid[16] = m_uuid[17] = m_uuid[18] = m_uuid[19] = 0;
- }
- else
- {
- m_num_uuid_bytes = 16;
- ::memset (m_uuid, 0, sizeof(m_uuid));
- }
+ ::memset (m_uuid, 0, sizeof(m_uuid));
+ return false;
}
size_t