Ejemplo n.º 1
0
 public Entry(CIE cie)
 {
     this.cie             = cie;
     this.current_address = TargetAddress.Null;
     this.address         = TargetAddress.Null;
     this.columns         = cie.Columns;
 }
Ejemplo n.º 2
0
 public Entry(CIE cie, TargetAddress initial_location,
              TargetAddress address)
 {
     this.cie             = cie;
     this.current_address = initial_location;
     this.address         = address;
     this.columns         = new Column [cie.Columns.Length];
     cie.Columns.CopyTo(columns, 0);
 }
Ejemplo n.º 3
0
            public CIE(DwarfFrameReader frame, long offset, CIE next)
            {
                this.frame  = frame;
                this.offset = offset;
                this.next   = next;

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

                read_cie(reader);
            }
Ejemplo n.º 4
0
        protected CIE find_cie(long offset)
        {
            for (CIE cie = cie_list; cie != null; cie = cie.Next)
            {
                if (cie.Offset == offset)
                {
                    return(cie);
                }
            }

            CIE new_cie = new CIE(this, offset, cie_list);

            cie_list = new_cie;
            return(cie_list);
        }
Ejemplo n.º 5
0
            public Entry(CIE cie, TargetAddress initial_location,
				      TargetAddress address)
            {
                this.cie = cie;
                this.current_address = initial_location;
                this.address = address;
                this.columns = new Column [cie.Columns.Length];
                cie.Columns.CopyTo (columns, 0);
            }
Ejemplo n.º 6
0
 public Entry(CIE cie)
 {
     this.cie = cie;
     this.current_address = TargetAddress.Null;
     this.address = TargetAddress.Null;
     this.columns = cie.Columns;
 }
Ejemplo n.º 7
0
            public CIE(DwarfFrameReader frame, long offset, CIE next)
            {
                this.frame = frame;
                this.offset = offset;
                this.next = next;

                DwarfBinaryReader reader = new DwarfBinaryReader (
                    frame.bfd, frame.blob, false);
                read_cie (reader);
            }
Ejemplo n.º 8
0
        protected CIE find_cie(long offset)
        {
            for (CIE cie = cie_list; cie != null; cie = cie.Next) {
                if (cie.Offset == offset)
                    return cie;
            }

            CIE new_cie = new CIE (this, offset, cie_list);
            cie_list = new_cie;
            return cie_list;
        }
Ejemplo n.º 9
0
        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);
        }