Updated 'type' command to show information from all sources (directive list,

emulation core, and distella).  This allows to better see exactly how an
address is marked in the disassembly.

Updated Changelog with changes I forgot that I made (you know it's time
for a new release when you forget what's been added since the last one).


git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@2170 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba
This commit is contained in:
stephena 2010-11-07 18:10:58 +00:00
parent b756f8c14a
commit 192ab931f2
6 changed files with 104 additions and 43 deletions

View File

@ -26,6 +26,8 @@
tracks accesses to GRPx and PFx registers, automatically marking the
addresses as GFX or PGFX sections. Most bankswitch schemes have been
modified for this functionality, except for 3E, 4A50, AR, FE and MC.
This will be improved in future releases, as there are many ways to
store data in the graphics registers.
* Improved output of graphics output in the disassembler, by marking
such addresses with a bitmap of the data they represent. This
@ -40,6 +42,17 @@
now exist to load and save configuration directives directly from
the debugger.
* Added the following commands to the debugger prompt:
- clearconfig, listconfig, loadconfig, saveconfig
(used for Distella configuration files)
- skip, code, data, gfx, pgfx, row
(directives used to override automatic disassembly types)
- jump (jumps to a specific address in the disassembly)
- type (gives detailed info for disassembly type of an address)
* The debugger prompt commands 'trap', 'trapread' and 'trapwrite' now
accept a range of addresses as well as a single address.
* Added 'data source' address output for the CPU A/X/Y registers. This
is useful for quickly seeing what an operand address resolves into
with an LDx command.
@ -70,6 +83,9 @@
the desktop background was 'bleeding through', resulting in a very
annoying flickering.
* Fixed crashes when opening windows larger than the desktop resolution;
this is now allowed only in windowed mode.
* Application window centering now also works when switching between
video modes, not just when starting the application.

View File

@ -281,7 +281,8 @@ bool CartDebug::fillDisassemblyList(BankInfo& info, bool resolvedata, uInt16 sea
myDisassembly.list.clear();
myDisassembly.fieldwidth = 10 + myLabelLength;
DiStella distella(*this, myDisassembly.list, info, resolvedata);
DiStella distella(*this, myDisassembly.list, info,
myDisLabels, myDisDirectives, resolvedata);
// Parts of the disassembly will be accessed later in different ways
// We place those parts in separate maps, to speed up access
@ -317,7 +318,8 @@ string CartDebug::disassemble(uInt16 start, uInt16 lines) const
Disassembly disasm;
BankInfo info;
info.addressList.push_back(start);
DiStella distella(*this, disasm.list, info, false);
DiStella distella(*this, disasm.list, info, (uInt8*)myDisLabels,
(uInt8*)myDisDirectives, false);
// Fill the string with disassembled data
start &= 0xFFF;
@ -952,7 +954,8 @@ void CartDebug::getBankDirectives(ostream& buf, BankInfo& info) const
{
// Disassemble the bank, then scan it for an up-to-date description
DisassemblyList list;
DiStella distella(*this, list, info, true);
DiStella distella(*this, list, info, (uInt8*)myDisLabels,
(uInt8*)myDisDirectives, true);
if(list.size() == 0)
return;
@ -990,6 +993,32 @@ void CartDebug::getBankDirectives(ostream& buf, BankInfo& info) const
buf << " " << HEX4 << start << " " << HEX4 << (info.offset+info.end) << endl;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void CartDebug::addressTypeAsString(ostream& buf, uInt16 addr) const
{
if(!(addr & 0x1000))
{
buf << DebuggerParser::red("type only defined for cart address space");
return;
}
uInt8 directive = myDisDirectives[addr & 0xFFF] & 0xFC,
debugger = myDebugger.getAddressDisasmType(addr) & 0xFC,
label = myDisLabels[addr & 0xFFF];
string s1 = Debugger::to_bin_8(directive),
s2 = Debugger::to_bin_8(debugger),
s3 = Debugger::to_bin_8(label);
buf << endl << "directive: " << s1 << " ";
disasmTypeAsString(buf, directive);
buf << endl << "emulation: " << s2 << " ";
disasmTypeAsString(buf, debugger);
buf << endl << "tentative: " << s3 << " ";
disasmTypeAsString(buf, label);
buf << endl;
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void CartDebug::disasmTypeAsString(ostream& buf, DisasmType type) const
{
@ -1007,6 +1036,32 @@ void CartDebug::disasmTypeAsString(ostream& buf, DisasmType type) const
}
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
void CartDebug::disasmTypeAsString(ostream& buf, uInt8 flags) const
{
if(flags)
{
if(flags & CartDebug::SKIP)
buf << "SKIP ";
if(flags & CartDebug::CODE)
buf << "CODE ";
if(flags & CartDebug::GFX)
buf << "GFX ";
if(flags & CartDebug::PGFX)
buf << "PGFX ";
if(flags & CartDebug::DATA)
buf << "DATA ";
if(flags & CartDebug::ROW)
buf << "ROW ";
if(flags & CartDebug::REFERENCED)
buf << "*REFERENCED ";
if(flags & CartDebug::VALID_ENTRY)
buf << "*VALID_ENTRY ";
}
else
buf << "no flags set";
}
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
const char* CartDebug::ourTIAMnemonicR[16] = {
"CXM0P", "CXM1P", "CXP0FB", "CXP1FB", "CXM0FB", "CXM1FB", "CXBLPF", "CXPPMM",

View File

@ -252,6 +252,9 @@ class CartDebug : public DebuggerSystem
*/
void getCompletions(const char* in, StringList& list) const;
// Convert given address to corresponding disassembly type and append to buf
void addressTypeAsString(ostream& buf, uInt16 addr) const;
private:
typedef map<uInt16, string> AddrToLabel;
typedef map<string, uInt16> LabelToAddr;
@ -282,6 +285,9 @@ class CartDebug : public DebuggerSystem
DirectiveList directiveList; // overrides for automatic code determination
} BankInfo;
// Address type information determined by Distella
uInt8 myDisLabels[0x1000], myDisDirectives[0x1000];
// Actually call DiStella to fill the DisassemblyList structure
// Return whether the search address was actually in the list
bool fillDisassemblyList(BankInfo& bankinfo, bool resolvedata, uInt16 search);
@ -293,6 +299,10 @@ class CartDebug : public DebuggerSystem
// Convert disassembly enum type to corresponding string and append to buf
void disasmTypeAsString(ostream& buf, DisasmType type) const;
// Convert all disassembly types in 'flags' to corresponding string and
// append to buf
void disasmTypeAsString(ostream& buf, uInt8 flags) const;
private:
const OSystem& myOSystem;

View File

@ -1551,29 +1551,8 @@ void DebuggerParser::executeType()
for(uInt32 i = beg; i <= end; ++i)
{
commandResult << HEX4 << i << " => ";
uInt8 flags = debugger->getAddressDisasmType(i);
if(flags)
{
string bin = Debugger::to_bin_8(flags);
commandResult << bin << ": ";
if(flags & CartDebug::SKIP)
commandResult << "SKIP ";
if(flags & CartDebug::CODE)
commandResult << "CODE ";
if(flags & CartDebug::GFX)
commandResult << "GFX ";
if(flags & CartDebug::DATA)
commandResult << "DATA ";
if(flags & CartDebug::ROW)
commandResult << "ROW ";
if(flags & CartDebug::REFERENCED)
commandResult << "*REFERENCED ";
if(flags & CartDebug::VALID_ENTRY)
commandResult << "*VALID_ENTRY ";
}
else
commandResult << "no flags set";
commandResult << HEX4 << i << ": ";
debugger->cartDebug().addressTypeAsString(commandResult, i);
commandResult << endl;
}
}

View File

@ -23,9 +23,12 @@
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
DiStella::DiStella(const CartDebug& dbg, CartDebug::DisassemblyList& list,
CartDebug::BankInfo& info, bool resolvedata)
CartDebug::BankInfo& info, uInt8* labels, uInt8* directives,
bool resolvedata)
: myDbg(dbg),
myList(list)
myList(list),
myLabels(labels),
myDirectives(directives)
{
CartDebug::AddressList& addresses = info.addressList;
if(addresses.size() == 0)
@ -158,7 +161,7 @@ DiStella::DiStella(const CartDebug& dbg, CartDebug::DisassemblyList& list,
while(it == addresses.end() && codeAccessPoint <= myAppData.end)
{
if((Debugger::debugger().getAddressDisasmType(codeAccessPoint+myOffset) & CartDebug::CODE)
&& !(labels[codeAccessPoint & myAppData.end] & CartDebug::CODE))
&& !(myLabels[codeAccessPoint & myAppData.end] & CartDebug::CODE))
{
//cerr << "(emul) marking " << HEX4 << (codeAccessPoint+myOffset) << " as CODE\n";
myAddressQueue.push(codeAccessPoint+myOffset);
@ -798,8 +801,8 @@ int DiStella::mark(uInt32 address, uInt8 mask, bool directive)
if (address >= myOffset && address <= myAppData.end + myOffset)
{
labels[address-myOffset] = labels[address-myOffset] | mask;
if(directive) directives[address-myOffset] = mask;
myLabels[address-myOffset] = myLabels[address-myOffset] | mask;
if(directive) myDirectives[address-myOffset] = mask;
return 1;
}
else if (address >= 0 && address <= 0x3f)
@ -813,8 +816,8 @@ int DiStella::mark(uInt32 address, uInt8 mask, bool directive)
else if (address > 0x1000)
{
/* 2K & 4K case */
labels[address & myAppData.end] = labels[address & myAppData.end] | mask;
if(directive) directives[address & myAppData.end] = mask;
myLabels[address & myAppData.end] = myLabels[address & myAppData.end] | mask;
if(directive) myDirectives[address & myAppData.end] = mask;
return 4;
}
else
@ -828,9 +831,9 @@ bool DiStella::check_bit(uInt16 address, uInt8 mask) const
// an address
// Since they're set only in the labels array (as the lower two bits),
// they must be included in the other bitfields
uInt8 label = labels[address & myAppData.end],
uInt8 label = myLabels[address & myAppData.end],
lastbits = label & 0x03,
directive = directives[address & myAppData.end] & 0xFC,
directive = myDirectives[address & myAppData.end] & 0xFC,
debugger = Debugger::debugger().getAddressDisasmType(address | myOffset) & 0xFC;
// Any address marked by a manual directive always takes priority

View File

@ -48,11 +48,14 @@ class DiStella
@param dbg The CartDebug instance containing all label information
@param list The results of the disassembly are placed here
@param addresses The address(es) at which to start disassembly
@param info Various info about the current bank
@param labels Array storing label info determined by Distella
@param directives Array storing directive info determined by Distella
@param resolvedata If enabled, try to determine code vs. data sections
*/
DiStella(const CartDebug& dbg, CartDebug::DisassemblyList& list,
CartDebug::BankInfo& info, bool resolvedata);
CartDebug::BankInfo& info, uInt8* labels, uInt8* directives,
bool resolvedata);
~DiStella();
@ -67,11 +70,6 @@ class DiStella
static Settings settings;
private:
// TODO - place this comment whereever the array is located
// Marked bits
// This is a reference sheet of bits that can be set for a given address, which
// are stored in the labels[] array.
// Indicate that a new line of disassembly has been completed
// In the original Distella code, this indicated a new line to be printed
// Here, we add a new entry to the DisassemblyList
@ -104,7 +102,7 @@ class DiStella
case as well as when manual directives are enabled (in which case
the directives take priority
The address mark type is defined in CartDebug.hxx */
uInt8 labels[0x1000], directives[0x1000];
uInt8 *myLabels, *myDirectives;
/**
Enumeration of the 6502 addressing modes