Fix for win port editing core debug symbol table entries.

This commit is contained in:
harry 2023-02-06 20:49:09 -05:00
parent 47530d614c
commit 410810ac18
1 changed files with 29 additions and 8 deletions

View File

@ -672,15 +672,15 @@ char* generateNLFilenameForAddress(uint16 address)
} }
return NLfilename; return NLfilename;
} }
static int getRomPageIndexForAddress(uint16 address) static int getBankIndexForAddress(uint16 address)
{ {
int page = -1; int bank = -1;
if (address >= 0x8000) if (address >= 0x8000)
{ {
page = RomPageIndexForAddress(address); bank = getBank(address);
} }
return page; return bank;
} }
Name* getNamesPointerForAddress(uint16 address) Name* getNamesPointerForAddress(uint16 address)
{ {
@ -1118,7 +1118,6 @@ void AddNewSymbolicName(uint16 newAddress, char* newOffset, char* newName, char*
if (*newName || *newComment) if (*newName || *newComment)
{ {
int i = 0; int i = 0;
int bank = -1;
char* tmpNewOffset = (char*)malloc(strlen(newOffset) + 1); char* tmpNewOffset = (char*)malloc(strlen(newOffset) + 1);
strcpy(tmpNewOffset, newOffset); strcpy(tmpNewOffset, newOffset);
uint16 tmpNewAddress = newAddress; uint16 tmpNewAddress = newAddress;
@ -1163,7 +1162,7 @@ void AddNewSymbolicName(uint16 newAddress, char* newOffset, char* newName, char*
node->next = 0; node->next = 0;
setNamesPointerForAddress(tmpNewAddress, node); setNamesPointerForAddress(tmpNewAddress, node);
debugSymbolTable.addSymbolAtBankOffset(getRomPageIndexForAddress(tmpNewAddress), tmpNewAddress, node->name, node->comment); debugSymbolTable.addSymbolAtBankOffset(getBankIndexForAddress(tmpNewAddress), tmpNewAddress, node->name, node->comment);
} }
else else
{ {
@ -1205,6 +1204,28 @@ void AddNewSymbolicName(uint16 newAddress, char* newOffset, char* newName, char*
strcpy(node->comment, newComment); strcpy(node->comment, newComment);
} }
debugSymbol_t* sym = debugSymbolTable.getSymbolAtBankOffset(getBankIndexForAddress(tmpNewAddress), tmpNewAddress);
if (sym)
{
if (node->name)
{
sym->updateName(node->name);
}
else
{
sym->updateName("");
}
if (node->comment)
{
sym->commentAssign(node->comment);
}
else
{
sym->commentAssign("");
}
sym->trimTrailingSpaces();
}
break; break;
} }
@ -1247,7 +1268,7 @@ void AddNewSymbolicName(uint16 newAddress, char* newOffset, char* newName, char*
newNode->next = 0; newNode->next = 0;
node->next = newNode; node->next = newNode;
debugSymbolTable.addSymbolAtBankOffset(getRomPageIndexForAddress(tmpNewAddress), tmpNewAddress, newNode->name, newNode->comment); debugSymbolTable.addSymbolAtBankOffset(getBankIndexForAddress(tmpNewAddress), tmpNewAddress, newNode->name, newNode->comment);
break; break;
} }
} }
@ -1285,7 +1306,7 @@ void DeleteSymbolicName(uint16 address, int size)
prev = node; prev = node;
node = node->next; node = node->next;
} }
debugSymbolTable.deleteSymbolAtBankOffset(getRomPageIndexForAddress(tmpAddress), tmpAddress); debugSymbolTable.deleteSymbolAtBankOffset(getBankIndexForAddress(tmpAddress), tmpAddress);
++tmpAddress; ++tmpAddress;
} while (++i < size); } while (++i < size);
} }