[Lldb-commits] [PATCH] Introduce DWARFDataExtractor for 64-Bit DWARF parsing

Greg Clayton gclayton at apple.com
Wed Oct 23 14:32:29 PDT 2013


On Oct 23, 2013, at 2:21 PM, Ed Maste <emaste at freebsd.org> wrote:

> 
> 
> ================
> Comment at: include/lldb/Core/MappedHash.h:17
> @@ -16,2 +16,3 @@
> 
> +template <typename ExtractorT>
> class MappedHash
> ----------------
> I'd like to avoid templatizing this if possible, but I don't see a straightforward way.

Does MappedHash use any of the special DWARF accessors? If not do we really need DWARFDebugExtractor for this class? 


> 
> ================
> Comment at: source/Plugins/SymbolFile/DWARF/DWARFDebugArangeSet.h:44
> @@ -43,3 +43,3 @@
>         void        Compact();
> -        bool        Extract(const lldb_private::DataExtractor &data, lldb::offset_t *offset_ptr);
> +        bool        Extract(lldb_private::DWARFDataExtractor &data, lldb::offset_t *offset_ptr);
>         void        Dump(lldb_private::Stream *s) const;
> ----------------
> Dropping the consts is a consequence of setting the 64-bit flag in DWARFDataExtractor::GetDWARFInitialLength.
> 
> Would it be reasonable to use a const_cast in there instead?

Or you can make the ivar for the 64 bit flag mutable. const_cast is probably better.

> 
> ================
> Comment at: source/Plugins/SymbolFile/DWARF/DWARFDebugArangeSet.cpp:186
> @@ -185,14 +185,3 @@
>         // the size appropriate for an address on the target architecture.
> -        size_t dwarf_offset_size = 4;
> -        m_header.length     = data.GetU32(offset_ptr);
> -        if (m_header.length == 0xffffffff)
> -        {
> -            dwarf_offset_size = 8;
> -            m_header.length = data.GetU64(offset_ptr);
> -        }
> -        else if (m_header.length >= 0xffffff00)
> -        {
> -            // Reserved.
> -            return false;
> -        }
> +        m_header.length     = data.GetDWARFInitialLength(offset_ptr);
>         m_header.version    = data.GetU16(offset_ptr);
> ----------------
> Here's the actual cleanup this permits

Much better!

> 
> 
> http://llvm-reviews.chandlerc.com/D2007
> _______________________________________________
> lldb-commits mailing list
> lldb-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/lldb-commits




More information about the lldb-commits mailing list