当前位置: 首页>>代码示例>>C#>>正文


C# Entry.Read方法代码示例

本文整理汇总了C#中Entry.Read方法的典型用法代码示例。如果您正苦于以下问题:C# Entry.Read方法的具体用法?C# Entry.Read怎么用?C# Entry.Read使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Entry的用法示例。


在下文中一共展示了Entry.Read方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: read_cie

            void read_cie(DwarfBinaryReader reader)
            {
                long length = reader.ReadInitialLength ();
                long end_pos = reader.Position + length;
                int id = reader.ReadInt32 ();

                bool is_cie;
                if (frame.is_ehframe)
                    is_cie = id == 0;
                else
                    is_cie = id == -1;
                if (!is_cie)
                    throw new InvalidOperationException ();

                int version = reader.ReadByte ();
                if (version != 1)
                    throw new DwarfException (
                        reader.Bfd, "Unknown version {0} in CIE",
                        version);

                string augmentation = reader.ReadString ();

                if (augmentation.StartsWith ("eh")) {
                    reader.ReadAddress ();
                    augmentation = augmentation.Substring (2);
                }

                code_alignment = reader.ReadLeb128 ();
                data_alignment = reader.ReadSLeb128 ();
                return_register = reader.ReadByte ();

                for (int pos = 0; pos < augmentation.Length; pos++) {
                    if (augmentation [pos] == 'z') {
                        reader.ReadLeb128 ();
                        // has_z_augmentation = true;
                        continue;
                    }

                    if (augmentation [pos] == 'L')
                        continue;
                    else if (augmentation [pos] == 'R') {
                        encoding = reader.ReadByte ();
                        continue;
                    }
                    else if (augmentation [pos] == 'P') {
                        continue;
                    }

                    throw new DwarfException (
                        reader.Bfd, "Unknown augmentation `{0}' in CIE",
                        augmentation[pos]);
                }

                columns = new Column [return_register + 2];
                for (int i = 0; i < columns.Length; i++)
                    columns [i] = new Column (State.Undefined);

                Entry entry = new Entry (this);
                entry.Read (reader, end_pos);

                reader.Position = end_pos;
            }
开发者ID:baulig,项目名称:debugger,代码行数:62,代码来源:DwarfFrameReader.cs

示例2: UnwindStack

        public StackFrame UnwindStack(StackFrame frame, TargetMemoryAccess target,
					       Architecture arch)
        {
            if (frame.TargetAddress.IsNull)
                return null;

            TargetAddress address = frame.TargetAddress;

            DwarfBinaryReader reader = new DwarfBinaryReader (bfd, blob, false);

            while (reader.Position < reader.Size) {
                long length = reader.ReadInitialLength ();
                if (length == 0)
                    break;
                long end_pos = reader.Position + length;

                long cie_pointer = reader.ReadOffset ();
                bool is_cie;
                if (is_ehframe)
                    is_cie = cie_pointer == 0;
                else
                    is_cie = cie_pointer == -1;

                if (is_cie) {
                    reader.Position = end_pos;
                    continue;
                }

                if (is_ehframe)
                    cie_pointer = reader.Position - cie_pointer -
                        target.TargetMemoryInfo.TargetAddressSize;

                CIE cie = find_cie (cie_pointer);

                long initial, range;
                if (is_ehframe) {
                    initial = ReadEncodedValue (reader, cie.Encoding);
                    range = ReadEncodedValue (reader, cie.Encoding & 0x0f);
                } else {
                    initial = reader.ReadAddress ();
                    range = reader.ReadAddress ();
                }

                TargetAddress start = new TargetAddress (target.AddressDomain, initial);

                if ((address < start) || (address > start + range)) {
                    reader.Position = end_pos;
                    continue;
                }

                Entry fde = new Entry (cie, start, address);
                fde.Read (reader, end_pos);
                return fde.Unwind (frame, target, arch);
            }

            return null;
        }
开发者ID:baulig,项目名称:debugger,代码行数:57,代码来源:DwarfFrameReader.cs


注:本文中的Entry.Read方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。