📄 debuginfo.h
字号:
/*-----------------------------------------------------------------------------
6502 Macroassembler and Simulator
Copyright (C) 1995-2003 Michal Kowalski
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
-----------------------------------------------------------------------------*/
#include "MapFile.h"
#include "Asm.h"
#include "Ident.h"
#ifndef _debug_info_h_
#define _debug_info_h_
struct CLine : CAsm
{
int ln; // nr wiersza w pliku 焤骴硂wym
FileUID file; // identyfikator pliku
CLine(int ln, FileUID file) : ln(ln), file(file)
{ }
CLine() : ln(0), file(0)
{ }
int operator==(const CLine &arg) const
{ return ln==arg.ln && file==arg.file; }
operator DWORD() // konwersja dla funkcji mieszaj筩ej (CMap<>::HashKey())
{ return DWORD( (ln<<4) ^ (file<<8) ); }
};
struct CDebugLine : CAsm // info dla symulatora o jednym wierszu 焤骴硂wym programu
{
UINT8 flags; // flagi opisuj筩e wiersz (DbgFlag)
UINT16 addr; // adres programu 6502
CLine line;
CDebugLine() : flags(CAsm::DBG_EMPTY), addr(0)
{ }
CDebugLine(int ln, FileUID uid, UINT16 addr, int flg) : flags((UINT8)flg), addr(addr),
line(ln,uid)
{ }
CDebugLine(const CDebugLine &src)
{ memcpy(this,&src,sizeof(*this)); }
const CDebugLine &operator=(const CDebugLine &src)
{
memcpy(this,&src,sizeof(*this));
return *this;
}
};
class CDebugLines : CArray<CDebugLine,CDebugLine&>, public CAsm
{
CMap<UINT16, UINT16, int, int> addr_to_idx; // tablice asocjacyjne do szybkiego
CMap<CLine, CLine&, int, int> line_to_idx; // odszukiwania adresu lub wiersza
public:
CDebugLines() : addr_to_idx(50), line_to_idx(50)
{ SetSize(50,50); }
// znalezienie wiersza odpowiadaj筩ego adresowi
void GetLine(CDebugLine &ret, UINT16 addr)
{
static const CDebugLine empty; // pusty obiekt - do oznaczenia "nie znaleziony wiersz"
int idx;
if (addr_to_idx.Lookup(addr,idx))
ret = GetAt(idx);
else
ret = empty;
}
// znalezienie adresu odp. wierszowi
void GetAddress(CDebugLine &ret, int ln, FileUID file)
{
static const CDebugLine empty; // pusty obiekt - do oznaczenia "nie znaleziony adres"
int idx;
if (line_to_idx.Lookup(CLine(ln,file),idx))
ret = GetAt(idx);
else
ret = empty;
}
void AddLine(CDebugLine &dl)
{
ASSERT(dl.flags != DBG_EMPTY); // niewype硁iony opis wiersza
int idx = Add(dl); // dopisanie info o wierszu, zapami阾anie indeksu
addr_to_idx.SetAt(dl.addr,idx); // zapisanie indeksu
line_to_idx.SetAt(dl.line,idx); // j.w.
}
void Empty()
{
RemoveAll();
addr_to_idx.RemoveAll();
line_to_idx.RemoveAll();
}
};
class CDebugBreakpoints : CAsm, CByteArray // informacja o miejscach przerwa
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -