示例#1
0
        public void ParseSymbol(Action <Hunk> h)
        {
            var hunk = new SymbolHunk();

            h(hunk);
            var symbols  = new Dictionary <string, int>();
            int name_len = 1;

            hunk.symbols = symbols;
            while (name_len > 0)
            {
                var x = this.ReadString();
                if (x == null)
                {
                    throw new BadImageFormatException(string.Format("{0} has invalid symbol name", hunk.HunkType));
                }
                else if (x.Length == 0)
                {
                    // last name occurred
                    break;
                }
                var value = this.read_long();
                if (value < 0)
                {
                    throw new NotImplementedException(string.Format("{0} has invalid symbol value", hunk.HunkType));
                }
                symbols[x] = value;
            }
        }
示例#2
0
文件: HunkShow.cs 项目: relaxar/reko
 public virtual void show_symbol_hunk(SymbolHunk hunk)
 {
     foreach (var symbol in hunk.symbols)
     {
         this.print_symbol((uint)symbol.Value, symbol.Key, "");
     }
 }
示例#3
0
 public void ParseSymbol(Action<Hunk> h)
 {
     var hunk = new SymbolHunk();
     h(hunk);
     var symbols = new Dictionary<string, int>();
     int name_len = 1;
     hunk.symbols = symbols;
     while (name_len > 0)
     {
         var x = this.ReadString();
         if (x == null)
             throw new BadImageFormatException(string.Format("{0} has invalid symbol name", hunk.HunkType));
         else if (x.Length == 0)
         {
             // last name occurred
             break;
         }
         var value = this.read_long();
         if (value < 0)
             throw new NotImplementedException(string.Format("{0} has invalid symbol value", hunk.HunkType));
         symbols[x] = value;
     }
 }