/// <summary>
        /// Parses frame description from the specified data memory reader.
        /// </summary>
        /// <param name="data">The data memory reader.</param>
        /// <param name="entry">Common information entry for parsed frame description.</param>
        /// <param name="endPosition">Position in the data reader where parsed frame description ends.</param>
        /// <param name="input">The input data for parsing configuration.</param>
        /// <returns>Parsed frame description.</returns>
        private static DwarfFrameDescriptionEntry ParseDescription(DwarfMemoryReader data, DwarfExceptionHandlingCommonInformationEntry entry, int endPosition, DwarfExceptionHandlingFrameParsingInput input)
        {
            DwarfFrameDescriptionEntry description = new DwarfFrameDescriptionEntry();

            description.InitialLocation        = ReadEncodedAddress(data, entry.FrameDescriptionAddressEncoding, input);
            description.AddressRange           = ReadEncodedAddress(data, entry.FrameDescriptionAddressEncoding & DwarfExceptionHandlingEncoding.Mask, input);
            description.CommonInformationEntry = entry;
            int instructionsStart = -1;

            if (entry.Augmentation.Length >= 1 && entry.Augmentation[0] == 'z')
            {
                uint length = data.LEB128();

                instructionsStart = data.Position + (int)length;
                if (entry.LanguageSpecificDataAreaEncoding != DwarfExceptionHandlingEncoding.Omit)
                {
                    ulong lsdaDataFileAddress = ReadEncodedAddress(data, entry.LanguageSpecificDataAreaEncoding, input);
                }
            }
            if (instructionsStart >= 0)
            {
                data.Position = instructionsStart;
            }
            description.Instructions = data.ReadBlock((uint)(endPosition - data.Position));
            return(description);
        }
        /// <summary>
        /// Parses the specified data for all common information entries and frame description entries.
        /// </summary>
        /// <param name="data">The data memory reader.</param>
        /// <param name="defaultAddressSize">Default size of the address.</param>
        /// <returns>All the parsed common information entries</returns>
        public static DwarfCommonInformationEntry[] ParseAll(DwarfMemoryReader data, byte defaultAddressSize)
        {
            Dictionary <int, DwarfCommonInformationEntry> entries = new Dictionary <int, DwarfCommonInformationEntry>();

            while (!data.IsEnd)
            {
                bool  is64bit;
                int   startPosition = data.Position;
                ulong length        = data.ReadLength(out is64bit);
                int   endPosition   = data.Position + (int)length;
                int   offset        = data.ReadOffset(is64bit);
                DwarfCommonInformationEntry entry;

                if (offset == -1)
                {
                    entry = new DwarfCommonInformationEntry(data, defaultAddressSize, endPosition);
                    entries.Add(startPosition, entry);
                }
                else
                {
                    if (!entries.TryGetValue(offset, out entry))
                    {
                        entry = ParseEntry(data, defaultAddressSize, offset);
                        entries.Add(offset, entry);
                    }

                    DwarfFrameDescriptionEntry description = new DwarfFrameDescriptionEntry(data, entry, endPosition);

                    entry.FrameDescriptionEntries.Add(description);
                }
            }

            return(entries.Values.ToArray());
        }
        /// <summary>
        /// Parses the specified data for all common information entries and frame description entries.
        /// </summary>
        /// <param name="data">The data memory reader.</param>
        /// <param name="input">The input data for parsing configuration.</param>
        /// <returns>All the parsed common information entries</returns>
        public static DwarfExceptionHandlingCommonInformationEntry[] ParseAll(DwarfMemoryReader data, DwarfExceptionHandlingFrameParsingInput input)
        {
            Dictionary <int, DwarfExceptionHandlingCommonInformationEntry> entries = new Dictionary <int, DwarfExceptionHandlingCommonInformationEntry>();

            while (!data.IsEnd)
            {
                bool  is64bit;
                int   startPosition = data.Position;
                ulong length        = data.ReadLength(out is64bit);
                int   endPosition   = data.Position + (int)length;

                if (length == 0 || endPosition >= data.Data.Length)
                {
                    break;
                }

                int offsetBase = data.Position;
                int offset     = data.ReadOffset(is64bit);
                DwarfExceptionHandlingCommonInformationEntry entry;

                if (offset == 0)
                {
                    entry = new DwarfExceptionHandlingCommonInformationEntry(data, endPosition, input);
                    entries.Add(startPosition, entry);
                }
                else
                {
                    int entryOffset = offsetBase - offset;

                    if (!entries.TryGetValue(entryOffset, out entry))
                    {
                        entry = ParseEntry(data, entryOffset, input);
                        entries.Add(entryOffset, entry);
                    }

                    DwarfFrameDescriptionEntry description = ParseDescription(data, entry, endPosition, input);

                    entry.FrameDescriptionEntries.Add(description);
                }
            }

            return(entries.Values.ToArray());
        }