[Lldb-commits] [lldb] r258584 - Add a helper function to ProcessStructReader to allow one to inquire about the offset of a field

Enrico Granata via lldb-commits lldb-commits at lists.llvm.org
Fri Jan 22 15:50:46 PST 2016


Author: enrico
Date: Fri Jan 22 17:50:46 2016
New Revision: 258584

URL: http://llvm.org/viewvc/llvm-project?rev=258584&view=rev
Log:
Add a helper function to ProcessStructReader to allow one to inquire about the offset of a field


Modified:
    lldb/trunk/include/lldb/Utility/ProcessStructReader.h

Modified: lldb/trunk/include/lldb/Utility/ProcessStructReader.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Utility/ProcessStructReader.h?rev=258584&r1=258583&r2=258584&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Utility/ProcessStructReader.h (original)
+++ lldb/trunk/include/lldb/Utility/ProcessStructReader.h Fri Jan 22 17:50:46 2016
@@ -94,6 +94,15 @@ namespace lldb_private {
                 return fail_value;
             return (RetType)(m_data.GetMaxU64(&offset, size));
         }
+
+        size_t
+        GetOffsetOf(ConstString name, size_t fail_value = SIZE_MAX)
+        {
+            auto iter = m_fields.find(name), end = m_fields.end();
+            if (iter == end)
+                return fail_value;
+            return iter->second.offset;
+        }
     };
 }
 




More information about the lldb-commits mailing list