the debugger was replacing comments and names inside a buffer returned from the old portable disassembly function, which was returning a privately retained 64 byte buffer. previously names were limited to 30 characters, so it's possible expanding names in disassembly never blew that buffer.
testing of the 0d26e6f
commit either stressed it harder than ever before, or hard enough to break it for the first time
solved by copying the disassembly buffer into a new buffer for expanding address labels to names, etc
This commit is contained in:
parent
5dc4f288a3
commit
bf372552bc
|
@ -603,7 +603,6 @@ void Disassemble(HWND hWnd, int id, int scrollid, unsigned int addr)
|
||||||
strcat(debug_str, chr);
|
strcat(debug_str, chr);
|
||||||
} else
|
} else
|
||||||
{
|
{
|
||||||
char* a;
|
|
||||||
if ((addr + size) > 0xFFFF)
|
if ((addr + size) > 0xFFFF)
|
||||||
{
|
{
|
||||||
while (addr < 0xFFFF)
|
while (addr < 0xFFFF)
|
||||||
|
@ -624,28 +623,30 @@ void Disassemble(HWND hWnd, int id, int scrollid, unsigned int addr)
|
||||||
size++;
|
size++;
|
||||||
}
|
}
|
||||||
|
|
||||||
a = Disassemble(addr, opcode);
|
static char bufferForDisassemblyWithPlentyOfStuff[64+NL_MAX_NAME_LEN*10]; //"plenty"
|
||||||
|
char* _a = Disassemble(addr, opcode);
|
||||||
|
strcpy(bufferForDisassemblyWithPlentyOfStuff, _a);
|
||||||
|
|
||||||
if (symbDebugEnabled)
|
if (symbDebugEnabled)
|
||||||
{
|
{
|
||||||
replaceNames(ramBankNames, a, &disassembly_operands[i]);
|
replaceNames(ramBankNames, bufferForDisassemblyWithPlentyOfStuff, &disassembly_operands[i]);
|
||||||
for(int p=0;p<ARRAY_SIZE(pageNames);p++)
|
for(int p=0;p<ARRAY_SIZE(pageNames);p++)
|
||||||
if(pageNames[p] != NULL)
|
if(pageNames[p] != NULL)
|
||||||
replaceNames(pageNames[p], a, &disassembly_operands[i]);
|
replaceNames(pageNames[p], bufferForDisassemblyWithPlentyOfStuff, &disassembly_operands[i]);
|
||||||
}
|
}
|
||||||
|
|
||||||
// special case: an RTS opcode
|
// special case: an RTS opcode
|
||||||
if (GetMem(instruction_addr) == 0x60)
|
if (GetMem(instruction_addr) == 0x60)
|
||||||
{
|
{
|
||||||
// add "----------" to emphasize the end of subroutine
|
// add "----------" to emphasize the end of subroutine
|
||||||
strcat(a, " ");
|
strcat(bufferForDisassemblyWithPlentyOfStuff, " ");
|
||||||
for (int j = strlen(a); j < (LOG_DISASSEMBLY_MAX_LEN - 1); ++j)
|
for (int j = strlen(bufferForDisassemblyWithPlentyOfStuff); j < (LOG_DISASSEMBLY_MAX_LEN - 1); ++j)
|
||||||
a[j] = '-';
|
bufferForDisassemblyWithPlentyOfStuff[j] = '-';
|
||||||
a[LOG_DISASSEMBLY_MAX_LEN - 1] = 0;
|
bufferForDisassemblyWithPlentyOfStuff[LOG_DISASSEMBLY_MAX_LEN - 1] = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
// append the disassembly to current line
|
// append the disassembly to current line
|
||||||
strcat(strcat(debug_str, " "), a);
|
strcat(strcat(debug_str, " "), bufferForDisassemblyWithPlentyOfStuff);
|
||||||
}
|
}
|
||||||
strcat(debug_str, "\n");
|
strcat(debug_str, "\n");
|
||||||
instructions_count++;
|
instructions_count++;
|
||||||
|
|
Loading…
Reference in New Issue