Further improvements to Qt symbolic debugging.
This commit is contained in:
parent
90911ff17e
commit
d60a00caeb
|
@ -975,6 +975,7 @@ void ConsoleDebugger::openDebugSymbolEditWindow( int addr )
|
|||
sym->name = nameEntry->text().toStdString();
|
||||
sym->comment = commentEntry->text().toStdString();
|
||||
}
|
||||
sym->trimTrailingSpaces();
|
||||
asmView->updateAssemblyView();
|
||||
fceuWrapperUnLock();
|
||||
}
|
||||
|
@ -1971,14 +1972,19 @@ void QAsmView::updateAssemblyView(void)
|
|||
const char *c;
|
||||
char stmp[256];
|
||||
//printf("Debug symbol Found at $%04X \n", dbgSym->ofs );
|
||||
d = new dbg_asm_entry_t();
|
||||
|
||||
*d = *a;
|
||||
d->type = dbg_asm_entry_t::SYMBOL_NAME;
|
||||
d->text.assign( dbgSym->name );
|
||||
d->line = asmEntry.size();
|
||||
|
||||
asmEntry.push_back(d);
|
||||
if ( dbgSym->name.size() > 0 )
|
||||
{
|
||||
d = new dbg_asm_entry_t();
|
||||
|
||||
*d = *a;
|
||||
d->type = dbg_asm_entry_t::SYMBOL_NAME;
|
||||
d->text.assign( dbgSym->name );
|
||||
d->text.append( ":");
|
||||
d->line = asmEntry.size();
|
||||
|
||||
asmEntry.push_back(d);
|
||||
}
|
||||
|
||||
i=0; j=0;
|
||||
c = dbgSym->comment.c_str();
|
||||
|
@ -3072,6 +3078,12 @@ void QAsmView::mousePressEvent(QMouseEvent * event)
|
|||
|
||||
line = lineOffset + c.y();
|
||||
|
||||
selAddrLine = -1;
|
||||
selAddrChar = 0;
|
||||
selAddrWidth = 0;
|
||||
selAddrValue = -1;
|
||||
selAddrText[0] = 0;
|
||||
|
||||
if ( line < asmEntry.size() )
|
||||
{
|
||||
int i,j, addr = -1, addrTextLoc = -1, selChar;
|
||||
|
@ -3080,55 +3092,88 @@ void QAsmView::mousePressEvent(QMouseEvent * event)
|
|||
|
||||
selChar = c.x();
|
||||
|
||||
if ( selChar < (int)asmEntry[line]->text.size() )
|
||||
if ( asmEntry[line]->type == dbg_asm_entry_t::ASM_TEXT )
|
||||
{
|
||||
i = selChar;
|
||||
|
||||
if ( isxdigit( asmEntry[line]->text[i] ) )
|
||||
if ( selChar < (int)asmEntry[line]->text.size() )
|
||||
{
|
||||
addrClicked = 1;
|
||||
addrTextLoc = i;
|
||||
i = selChar;
|
||||
|
||||
while ( isxdigit( asmEntry[line]->text[i] ) )
|
||||
if ( isxdigit( asmEntry[line]->text[i] ) )
|
||||
{
|
||||
addrClicked = 1;
|
||||
addrTextLoc = i;
|
||||
i--;
|
||||
}
|
||||
if ( asmEntry[line]->text[i] == '$' || asmEntry[line]->text[i] == ':' )
|
||||
{
|
||||
i--;
|
||||
}
|
||||
else
|
||||
{
|
||||
addrClicked = 0;
|
||||
}
|
||||
if ( asmEntry[line]->text[i] == '#' )
|
||||
{
|
||||
addrClicked = 0;
|
||||
}
|
||||
if ( addrClicked )
|
||||
{
|
||||
j=0; i = addrTextLoc;
|
||||
|
||||
|
||||
while ( isxdigit( asmEntry[line]->text[i] ) )
|
||||
{
|
||||
stmp[j] = asmEntry[line]->text[i]; i++; j++;
|
||||
addrTextLoc = i;
|
||||
i--;
|
||||
}
|
||||
stmp[j] = 0;
|
||||
if ( asmEntry[line]->text[i] == '$' || asmEntry[line]->text[i] == ':' )
|
||||
{
|
||||
i--;
|
||||
}
|
||||
else
|
||||
{
|
||||
addrClicked = 0;
|
||||
}
|
||||
if ( asmEntry[line]->text[i] == '#' )
|
||||
{
|
||||
addrClicked = 0;
|
||||
}
|
||||
if ( addrClicked )
|
||||
{
|
||||
j=0; i = addrTextLoc;
|
||||
|
||||
while ( isxdigit( asmEntry[line]->text[i] ) )
|
||||
{
|
||||
stmp[j] = asmEntry[line]->text[i]; i++; j++;
|
||||
}
|
||||
stmp[j] = 0;
|
||||
|
||||
//printf("Addr: '%s'\n", stmp );
|
||||
//printf("Addr: '%s'\n", stmp );
|
||||
|
||||
addr = strtol( stmp, NULL, 16 );
|
||||
addr = strtol( stmp, NULL, 16 );
|
||||
|
||||
selAddrLine = line;
|
||||
selAddrChar = addrTextLoc;
|
||||
selAddrWidth = j;
|
||||
selAddrValue = addr;
|
||||
strcpy( selAddrText, stmp );
|
||||
selAddrLine = line;
|
||||
selAddrChar = addrTextLoc;
|
||||
selAddrWidth = j;
|
||||
selAddrValue = addr;
|
||||
strcpy( selAddrText, stmp );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else if ( asmEntry[line]->type == dbg_asm_entry_t::SYMBOL_NAME )
|
||||
{
|
||||
selAddrLine = line;
|
||||
selAddrChar = 0;
|
||||
selAddrValue = addr = asmEntry[line]->addr;
|
||||
|
||||
if ( asmEntry[line]->text.size() > 0 )
|
||||
{
|
||||
selAddrWidth = asmEntry[line]->text.size()-1;
|
||||
}
|
||||
else
|
||||
{
|
||||
selAddrWidth = 0;
|
||||
}
|
||||
if ( selAddrWidth > (int)sizeof(selAddrText) )
|
||||
{
|
||||
selAddrWidth = sizeof(selAddrText);
|
||||
}
|
||||
strncpy( selAddrText, asmEntry[line]->text.c_str(), selAddrWidth );
|
||||
selAddrText[ sizeof(selAddrText)-1 ] = 0;
|
||||
}
|
||||
|
||||
if ( addr < 0 )
|
||||
{
|
||||
addr = asmEntry[line]->addr;
|
||||
selAddrLine = line;
|
||||
selAddrChar = 4;
|
||||
selAddrWidth = 4;
|
||||
selAddrValue = addr;
|
||||
sprintf( selAddrText, "%04X", addr );
|
||||
}
|
||||
//printf("Line: '%s'\n", asmEntry[line]->text.c_str() );
|
||||
|
||||
if ( addr >= 0 )
|
||||
|
@ -3265,8 +3310,9 @@ void QAsmView::paintEvent(QPaintEvent *event)
|
|||
|
||||
if ( (selAddrLine == l) )
|
||||
{ // Highlight ASM line for selected address.
|
||||
if ( (selAddr == selAddrValue) && (asmEntry[l]->type == dbg_asm_entry_t::ASM_TEXT) &&
|
||||
( asmEntry[l]->text.compare( selAddrChar, selAddrWidth, selAddrText ) == 0 ) )
|
||||
if ( (selAddr == selAddrValue) &&
|
||||
(asmEntry[l]->text.size() >= (selAddrChar + selAddrWidth) ) &&
|
||||
( asmEntry[l]->text.compare( selAddrChar, selAddrWidth, selAddrText ) == 0 ) )
|
||||
{
|
||||
int ax;
|
||||
|
||||
|
|
|
@ -149,7 +149,7 @@ class QAsmView : public QWidget
|
|||
int selAddrChar;
|
||||
int selAddrWidth;
|
||||
int selAddrValue;
|
||||
char selAddrText[16];
|
||||
char selAddrText[128];
|
||||
|
||||
dbg_asm_entry_t *asmPC;
|
||||
std::vector <dbg_asm_entry_t*> asmEntry;
|
||||
|
|
|
@ -1110,6 +1110,7 @@ void HexEditorDialog_t::openDebugSymbolEditWindow( int addr )
|
|||
sym->name = nameEntry->text().toStdString();
|
||||
sym->comment = commentEntry->text().toStdString();
|
||||
}
|
||||
sym->trimTrailingSpaces();
|
||||
//fceuWrapperLock();
|
||||
updateAllDebuggerWindows();
|
||||
//fceuWrapperUnLock();
|
||||
|
|
|
@ -267,11 +267,11 @@ void MoviePlayDialog_t::updateMovieText(void)
|
|||
|
||||
if (info.emu_version_used < 20000 )
|
||||
{
|
||||
sprintf( stmp, "FCEU %u.%02u.%02d%s", info.emu_version_used/10000, (info.emu_version_used/100)%100, (info.emu_version_used)%100, info.emu_version_used < 9813 ? " (blip)" : "");
|
||||
sprintf( stmp, "FCEU %u.%02u.%02u%s", info.emu_version_used/10000, (info.emu_version_used/100)%100, (info.emu_version_used)%100, info.emu_version_used < 9813 ? " (blip)" : "");
|
||||
}
|
||||
else
|
||||
{
|
||||
sprintf( stmp, "FCEUX %u.%02u.%02d", info.emu_version_used/10000, (info.emu_version_used/100)%100, (info.emu_version_used)%100);
|
||||
sprintf( stmp, "FCEUX %u.%02u.%02u", info.emu_version_used/10000, (info.emu_version_used/100)%100, (info.emu_version_used)%100);
|
||||
}
|
||||
emuUsedLbl->setText( tr(stmp) );
|
||||
|
||||
|
|
|
@ -642,7 +642,8 @@ static int replaceSymbols( int flags, int addr, char *str )
|
|||
}
|
||||
else
|
||||
{
|
||||
sprintf( str, "%04X", addr );
|
||||
//sprintf( str, "%04X", addr );
|
||||
str[0] = 0;
|
||||
}
|
||||
|
||||
return 0;
|
||||
|
@ -733,7 +734,7 @@ int DisassembleWithDebug(int addr, uint8_t *opcode, int flags, char *str )
|
|||
if ( flags )
|
||||
{
|
||||
replaceSymbols( flags, tmp, stmp );
|
||||
sprintf(str,"%s ($%02X,X) @ $%s = #$%02X", chr,opcode[1],stmp,GetMem(tmp));
|
||||
sprintf(str,"%s ($%02X,X) @ $%04X %s = #$%02X", chr,opcode[1],tmp,stmp,GetMem(tmp));
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -769,7 +770,7 @@ int DisassembleWithDebug(int addr, uint8_t *opcode, int flags, char *str )
|
|||
if ( flags )
|
||||
{
|
||||
replaceSymbols( flags, opcode[1], stmp );
|
||||
sprintf(str,"%s $%s = #$%02X", chr,stmp,GetMem(opcode[1]));
|
||||
sprintf(str,"%s $%02X %s = #$%02X", chr,opcode[1],stmp,GetMem(opcode[1]));
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -823,7 +824,7 @@ int DisassembleWithDebug(int addr, uint8_t *opcode, int flags, char *str )
|
|||
if ( flags )
|
||||
{
|
||||
replaceSymbols( flags, tmp, stmp );
|
||||
sprintf(str,"%s $%s = #$%02X", chr,stmp,GetMem(tmp));
|
||||
sprintf(str,"%s $%04X %s = #$%02X", chr,tmp,stmp,GetMem(tmp));
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -846,7 +847,7 @@ int DisassembleWithDebug(int addr, uint8_t *opcode, int flags, char *str )
|
|||
if ( flags )
|
||||
{
|
||||
replaceSymbols( flags, tmp, stmp );
|
||||
sprintf(str,"%s $%s", chr,stmp);
|
||||
sprintf(str,"%s $%04X %s", chr,tmp,stmp);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -869,7 +870,7 @@ int DisassembleWithDebug(int addr, uint8_t *opcode, int flags, char *str )
|
|||
if ( flags )
|
||||
{
|
||||
replaceSymbols( flags, tmp, stmp );
|
||||
sprintf(str,"%s ($%02X),Y @ $%s = #$%02X", chr,opcode[1],stmp,GetMem(tmp));
|
||||
sprintf(str,"%s ($%02X),Y @ $%04X %s = #$%02X", chr,opcode[1],tmp,stmp,GetMem(tmp));
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -901,7 +902,7 @@ int DisassembleWithDebug(int addr, uint8_t *opcode, int flags, char *str )
|
|||
if ( flags )
|
||||
{
|
||||
replaceSymbols( flags, tmp, stmp );
|
||||
sprintf(str,"%s $%02X,X @ $%s = #$%02X", chr,opcode[1],stmp,GetMem(tmp));
|
||||
sprintf(str,"%s $%02X,X @ $%04X %s = #$%02X", chr,opcode[1],tmp,stmp,GetMem(tmp));
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -926,7 +927,7 @@ int DisassembleWithDebug(int addr, uint8_t *opcode, int flags, char *str )
|
|||
if ( flags )
|
||||
{
|
||||
replaceSymbols( flags, tmp2, stmp );
|
||||
sprintf(str,"%s $%04X,Y @ $%s = #$%02X", chr,tmp,stmp,GetMem(tmp2));
|
||||
sprintf(str,"%s $%04X,Y @ $%04X %s = #$%02X", chr,tmp,tmp2,stmp,GetMem(tmp2));
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -956,7 +957,7 @@ int DisassembleWithDebug(int addr, uint8_t *opcode, int flags, char *str )
|
|||
if ( flags )
|
||||
{
|
||||
replaceSymbols( flags, tmp2, stmp );
|
||||
sprintf(str,"%s $%04X,X @ $%s = #$%02X", chr,tmp,stmp,GetMem(tmp2));
|
||||
sprintf(str,"%s $%04X,X @ $%04X %s = #$%02X", chr,tmp,tmp2,stmp,GetMem(tmp2));
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -974,7 +975,7 @@ int DisassembleWithDebug(int addr, uint8_t *opcode, int flags, char *str )
|
|||
if ( flags )
|
||||
{
|
||||
replaceSymbols( flags, tmp, stmp );
|
||||
sprintf(str,"%s $%s", chr,stmp);
|
||||
sprintf(str,"%s $%04X %s", chr,tmp,stmp);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -992,7 +993,7 @@ int DisassembleWithDebug(int addr, uint8_t *opcode, int flags, char *str )
|
|||
if ( flags )
|
||||
{
|
||||
replaceSymbols( flags, tmp, stmp );
|
||||
sprintf(str,"%s $%02X,Y @ $%s = #$%02X", chr,opcode[1],stmp,GetMem(tmp));
|
||||
sprintf(str,"%s $%02X,Y @ $%04X %s = #$%02X", chr,opcode[1],tmp,stmp,GetMem(tmp));
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
@ -28,6 +28,32 @@ struct debugSymbol_t
|
|||
this->comment.assign( comment );
|
||||
}
|
||||
}
|
||||
|
||||
void trimTrailingSpaces(void)
|
||||
{
|
||||
while ( name.size() > 0 )
|
||||
{
|
||||
if ( isspace( name.back() ) )
|
||||
{
|
||||
name.pop_back();
|
||||
}
|
||||
else
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
while ( comment.size() > 0 )
|
||||
{
|
||||
if ( isspace( comment.back() ) )
|
||||
{
|
||||
comment.pop_back();
|
||||
}
|
||||
else
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
struct debugSymbolPage_t
|
||||
|
|
Loading…
Reference in New Issue