Exemplo n.º 1
0
        private void WhatIsButton_Click(object sender, EventArgs e)
        {
            uint addr    = U.atoh(Address.Text);
            uint pointer = U.toPointer(addr);

            addr = U.toOffset(addr);

            string     hint   = "";
            AsmMapFile asmMap = Program.AsmMapFileAsmCache.GetAsmMapFile();

            AsmMapFile.AsmMapSt p;
            if (asmMap.TryGetValue(pointer, out p))
            {
                hint = p.ToStringInfo();
            }
            else
            {
                uint near_pointer = asmMap.SearchNear(pointer);
                if (asmMap.TryGetValue(near_pointer, out p))
                {
                    if (pointer < near_pointer + p.Length)
                    {
                        uint offset = (pointer - near_pointer);
                        hint = U.To0xHexString(U.toOffset(near_pointer)) + "+" + offset + "(" + U.To0xHexString(offset) + ") " + p.ToStringInfo();
                    }
                }
            }
            if (hint.Length <= 0)
            {
                R.ShowOK("not found");
                return;
            }
            R.ShowOK("アドレス{0}は {1} 領域です。", U.To0xHexString(addr), hint);
        }
Exemplo n.º 2
0
        void ShowHint(uint addr)
        {
            uint       pointer = U.toPointer(addr);
            AsmMapFile asmMap  = Program.AsmMapFileAsmCache.GetAsmMapFile();

            AsmMapFile.AsmMapSt p;

            //カーソル値のデータのヒントを与える.
            string hint = "";

            if (asmMap.TryGetValue(pointer, out p))
            {
                hint = p.ToStringInfo();
            }
            else
            {
                uint near_pointer = asmMap.SearchNear(pointer);
                if (asmMap.TryGetValue(near_pointer, out p))
                {
                    if (pointer < near_pointer + p.Length)
                    {
                        uint offset = (pointer - near_pointer);
                        hint = U.To0xHexString(U.toOffset(near_pointer)) + "+" + offset + "(" + U.To0xHexString(offset) + ") " + p.ToStringInfo();
                    }
                }
            }
            Hint.Text = hint;
        }
Exemplo n.º 3
0
        //MAPファイルに定義されている定番のASMルーチン
        public bool IsFixedASM(uint num)
        {
            if (num <= 0)
            {
                return(false);
            }

            num = U.toOffset(num);
            uint plainAddr = DisassemblerTrumb.ProgramAddrToPlain(num);

            AsmMapFile map = GetAsmMapFile();

            AsmMapFile.AsmMapSt a;
            if (!map.TryGetValue(U.toPointer(plainAddr), out a))
            {
                return(false);
            }
            if (a.Length > 0)
            {//長さが判明しているということはおそらくASM関数ではない.
                return(false);
            }
            if (a.Name.IndexOf("_address") > 0)
            {//おそらくただのデータ
                return(false);
            }
            if (plainAddr >= Program.ROM.RomInfo.compress_image_borderline_address)
            {//画像ボーダーよりも向こう側
                return(false);
            }

            //おそらくASM関数だと思われる
            return(true);
        }
Exemplo n.º 4
0
        void ShowHint(uint addr)
        {
            uint       pointer = U.toPointer(addr);
            AsmMapFile asmMap  = Program.AsmMapFileAsmCache.GetAsmMapFile();

            AsmMapFile.AsmMapSt p;

            //カーソル値のデータのヒントを与える.
            string hint = "";

            if (asmMap.TryGetValue(pointer, out p))
            {
                hint = p.ToStringInfo();
                if (p.Length > 0)
                {
                    hint += " Length:" + p.Length;
                }
            }
            else
            {
                uint near_pointer = asmMap.SearchNear(pointer);
                if (asmMap.TryGetValue(near_pointer, out p))
                {
                    if (pointer < near_pointer + p.Length)
                    {
                        uint offset = (pointer - near_pointer);
                        hint = U.To0xHexString(U.toOffset(near_pointer)) + "+" + offset + "(" + U.To0xHexString(offset) + ")/" + p.Length + p.ToStringInfo();
                    }
                }
            }
            string comment;

            if (Program.CommentCache.TryGetValue(U.toOffset(pointer), out comment))
            {//ユーザー定義のコメントがある
                if (hint.Length > 0)
                {
                    hint += " ";
                }
                hint += comment;
            }
            Hint.Text = hint;
        }
Exemplo n.º 5
0
        public string GetASMName(uint num, ASMTYPE asmtype, out string errorMessage)
        {
            if (num <= 0)
            {
                errorMessage = "";
                return(""); //NULL
            }

            uint plainAddr = DisassemblerTrumb.ProgramAddrToPlain(num);

            if (asmtype == ASMTYPE.SWITCH)
            {
                if (plainAddr != num)
                {//逆に危険 +1してはいけない
                    errorMessage = R._("危険なポインタです。\r\nここはswitch文のため、+1してはいけません。");
                    return(R._("危険なポインタ"));
                }
            }
            else if (asmtype == ASMTYPE.THUMB)
            {
                if (plainAddr == num)
                {//危険 +1 して、Thumbにするべき
                    errorMessage = R._("危険なポインタです。\r\nThumb命令で呼び出すため、ポインタに1を足した値を書く必要があります。");
                    return(R._("危険なポインタ"));
                }
            }
            if (!U.isSafetyPointer(num))
            {
                if (!U.is_RAMPointer(num))
                {
                    errorMessage = R._("無効なポインタです。\r\nこの設定は危険です。");
                    return(R._("無効なポインタ"));
                }
            }

            errorMessage = "";
            string comment;

            if (Program.CommentCache.TryGetValue(U.toOffset(plainAddr), out comment))
            {//ユーザー定義のコメントがある
                return(comment);
            }

            AsmMapFile map = GetAsmMapFile();

            AsmMapFile.AsmMapSt a;
            if (!map.TryGetValue(U.toPointer(plainAddr), out a))
            {
                return("");
            }
            return(a.Name);
        }
Exemplo n.º 6
0
        public string GetEventName(uint num, out string errorMessage)
        {
            if (num <= 0)
            {
                errorMessage = "";
                return(""); //NULL
            }
            if (num == 1)
            {
                errorMessage = "";
                return(R._("ダミーイベント"));
            }
            if (!U.isSafetyPointer(num))
            {
                errorMessage = R._("無効なポインタです。\r\nこの設定は危険です。");
                return(R._("無効なポインタ"));
            }

            errorMessage = "";
            uint plainAddr = U.Padding4(num);

            if (plainAddr != num)
            {
                return("");
            }

            string comment;

            if (Program.CommentCache.TryGetValue(U.toOffset(plainAddr), out comment))
            {//ユーザー定義のコメントがある
                return(comment);
            }

            AsmMapFile map = GetAsmMapFile();

            AsmMapFile.AsmMapSt a;
            if (!map.TryGetValue(U.toPointer(plainAddr), out a))
            {
                return("");
            }

            if (a.TypeName != "EVENT")
            {
                return("");
            }

            return(a.Name);
        }