Wrapped up the work I am going to do for now for the "add-dsym" or "target symfile add" command.
We can now do:
Specify a path to a debug symbols file:
(lldb) add-dsym <path-to-dsym>
Go and download the dSYM file for the "libunc.dylib" module in your target:
(lldb) add-dsym --shlib libunc.dylib
Go and download the dSYM given a UUID:
(lldb) add-dsym --uuid <UUID>
Go and download the dSYM file for the current frame:
(lldb) add-dsym --frame
llvm-svn: 164806
diff --git a/lldb/source/Core/UUID.cpp b/lldb/source/Core/UUID.cpp
index 520e31e..8ff97af 100644
--- a/lldb/source/Core/UUID.cpp
+++ b/lldb/source/Core/UUID.cpp
@@ -128,47 +128,58 @@
}
size_t
-UUID::SetfromCString (const char *cstr)
+UUID::DecodeUUIDBytesFromCString (const char *p, ValueType &uuid_bytes, const char **end)
+{
+ size_t uuid_byte_idx = 0;
+ if (p)
+ {
+ while (*p)
+ {
+ if (isxdigit(p[0]) && isxdigit(p[1]))
+ {
+ int hi_nibble = xdigit_to_int(p[0]);
+ int lo_nibble = xdigit_to_int(p[1]);
+ // Translate the two hex nibble characters into a byte
+ uuid_bytes[uuid_byte_idx] = (hi_nibble << 4) + lo_nibble;
+
+ // Skip both hex digits
+ p += 2;
+
+ // Increment the byte that we are decoding within the UUID value
+ // and break out if we are done
+ if (++uuid_byte_idx == 16)
+ break;
+ }
+ else if (*p == '-')
+ {
+ // Skip dashes
+ p++;
+ }
+ else
+ {
+ // UUID values can only consist of hex characters and '-' chars
+ break;
+ }
+ }
+ }
+ if (end)
+ *end = p;
+ return uuid_byte_idx;
+}
+size_t
+UUID::SetFromCString (const char *cstr)
{
if (cstr == NULL)
return 0;
- uint32_t uuid_byte_idx = 0;
const char *p = cstr;
// Skip leading whitespace characters
while (isspace(*p))
++p;
+
+ const uint32_t uuid_byte_idx = UUID::DecodeUUIDBytesFromCString (p, m_uuid, &p);
- // Try and decode a UUID
- while (*p != '\0')
- {
- if (isxdigit(*p) && isxdigit(p[1]))
- {
- int hi_nibble = xdigit_to_int(p[0]);
- int lo_nibble = xdigit_to_int(p[1]);
- // Translate the two hex nibble characters into a byte
- m_uuid[uuid_byte_idx] = (hi_nibble << 4) + lo_nibble;
-
- // Skip both hex digits
- p += 2;
-
- // Increment the byte that we are decoding within the UUID value
- // and break out if we are done
- if (++uuid_byte_idx == 16)
- break;
- }
- else if (*p == '-')
- {
- // Skip dashes
- p++;
- }
- else
- {
- // UUID values can only consist of hex characters and '-' chars
- return 0;
- }
- }
// If we successfully decoded a UUID, return the amount of characters that
// were consumed
if (uuid_byte_idx == 16)