Added symbolic debug popup window capability to hex editor.
This commit is contained in:
parent
97784ec09b
commit
a4b45fc252
|
@ -2274,6 +2274,11 @@ void ConsoleDebugger::updateWindowData(void)
|
||||||
windowUpdateReq = false;
|
windowUpdateReq = false;
|
||||||
}
|
}
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
|
void ConsoleDebugger::queueUpdate(void)
|
||||||
|
{
|
||||||
|
windowUpdateReq = true;
|
||||||
|
}
|
||||||
|
//----------------------------------------------------------------------------
|
||||||
void ConsoleDebugger::updatePeriodic(void)
|
void ConsoleDebugger::updatePeriodic(void)
|
||||||
{
|
{
|
||||||
//printf("Update Periodic\n");
|
//printf("Update Periodic\n");
|
||||||
|
@ -2395,6 +2400,16 @@ bool debuggerWindowIsOpen(void)
|
||||||
return (dbgWinList.size() > 0);
|
return (dbgWinList.size() > 0);
|
||||||
}
|
}
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
|
void updateAllDebuggerWindows( void )
|
||||||
|
{
|
||||||
|
std::list <ConsoleDebugger*>::iterator it;
|
||||||
|
|
||||||
|
for (it=dbgWinList.begin(); it!=dbgWinList.end(); it++)
|
||||||
|
{
|
||||||
|
(*it)->queueUpdate();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//----------------------------------------------------------------------------
|
||||||
static int getGameDebugBreakpointFileName(char *filepath)
|
static int getGameDebugBreakpointFileName(char *filepath)
|
||||||
{
|
{
|
||||||
int i,j;
|
int i,j;
|
||||||
|
|
|
@ -169,6 +169,7 @@ class ConsoleDebugger : public QDialog
|
||||||
void setBookmarkSelectedAddress( int addr );
|
void setBookmarkSelectedAddress( int addr );
|
||||||
int getBookmarkSelectedAddress(void){ return selBmAddrVal; };
|
int getBookmarkSelectedAddress(void){ return selBmAddrVal; };
|
||||||
void edit_BM_name( int addr );
|
void edit_BM_name( int addr );
|
||||||
|
void queueUpdate(void);
|
||||||
|
|
||||||
QLabel *asmLineSelLbl;
|
QLabel *asmLineSelLbl;
|
||||||
protected:
|
protected:
|
||||||
|
@ -279,5 +280,6 @@ bool debuggerWindowIsOpen(void);
|
||||||
void saveGameDebugBreakpoints(void);
|
void saveGameDebugBreakpoints(void);
|
||||||
void loadGameDebugBreakpoints(void);
|
void loadGameDebugBreakpoints(void);
|
||||||
void debuggerClearAllBreakpoints(void);
|
void debuggerClearAllBreakpoints(void);
|
||||||
|
void updateAllDebuggerWindows(void);
|
||||||
|
|
||||||
extern debuggerBookmarkManager_t dbgBmMgr;
|
extern debuggerBookmarkManager_t dbgBmMgr;
|
||||||
|
|
|
@ -35,6 +35,8 @@
|
||||||
#include "Qt/keyscan.h"
|
#include "Qt/keyscan.h"
|
||||||
#include "Qt/fceuWrapper.h"
|
#include "Qt/fceuWrapper.h"
|
||||||
#include "Qt/HexEditor.h"
|
#include "Qt/HexEditor.h"
|
||||||
|
#include "Qt/SymbolicDebug.h"
|
||||||
|
#include "Qt/ConsoleDebugger.h"
|
||||||
#include "Qt/ConsoleUtilities.h"
|
#include "Qt/ConsoleUtilities.h"
|
||||||
#include "Qt/ConsoleWindow.h"
|
#include "Qt/ConsoleWindow.h"
|
||||||
|
|
||||||
|
@ -960,6 +962,134 @@ void HexEditorDialog_t::actvHighlightRVCB(bool enable)
|
||||||
editor->setHighlightReverseVideo( enable );
|
editor->setHighlightReverseVideo( enable );
|
||||||
}
|
}
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
|
void HexEditorDialog_t::openDebugSymbolEditWindow( int addr )
|
||||||
|
{
|
||||||
|
int ret, bank, charWidth;
|
||||||
|
QDialog dialog(this);
|
||||||
|
QHBoxLayout *hbox;
|
||||||
|
QVBoxLayout *mainLayout;
|
||||||
|
QLabel *lbl;
|
||||||
|
QLineEdit *filepath, *addrEntry, *nameEntry, *commentEntry;
|
||||||
|
QPushButton *okButton, *cancelButton;
|
||||||
|
char stmp[512];
|
||||||
|
debugSymbol_t *sym;
|
||||||
|
QFont font;
|
||||||
|
font.setFamily("Courier New");
|
||||||
|
font.setStyle( QFont::StyleNormal );
|
||||||
|
font.setStyleHint( QFont::Monospace );
|
||||||
|
|
||||||
|
QFontMetrics fm(font);
|
||||||
|
|
||||||
|
#if QT_VERSION > QT_VERSION_CHECK(5, 11, 0)
|
||||||
|
charWidth = fm.horizontalAdvance(QLatin1Char('2'));
|
||||||
|
#else
|
||||||
|
charWidth = fm.width(QLatin1Char('2'));
|
||||||
|
#endif
|
||||||
|
|
||||||
|
if ( addr < 0x8000 )
|
||||||
|
{
|
||||||
|
bank = -1;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
bank = getBank( addr );
|
||||||
|
}
|
||||||
|
|
||||||
|
sym = debugSymbolTable.getSymbolAtBankOffset( bank, addr );
|
||||||
|
|
||||||
|
generateNLFilenameForAddress( addr, stmp );
|
||||||
|
|
||||||
|
dialog.setWindowTitle( tr("Symbolic Debug Naming") );
|
||||||
|
|
||||||
|
hbox = new QHBoxLayout();
|
||||||
|
mainLayout = new QVBoxLayout();
|
||||||
|
|
||||||
|
lbl = new QLabel( tr("File") );
|
||||||
|
filepath = new QLineEdit();
|
||||||
|
filepath->setFont( font );
|
||||||
|
filepath->setText( tr(stmp) );
|
||||||
|
filepath->setReadOnly( true );
|
||||||
|
filepath->setMinimumWidth( charWidth * (filepath->text().size() + 4) );
|
||||||
|
|
||||||
|
hbox->addWidget( lbl );
|
||||||
|
hbox->addWidget( filepath );
|
||||||
|
|
||||||
|
mainLayout->addLayout( hbox );
|
||||||
|
|
||||||
|
sprintf( stmp, "%04X", addr );
|
||||||
|
|
||||||
|
hbox = new QHBoxLayout();
|
||||||
|
lbl = new QLabel( tr("Address") );
|
||||||
|
addrEntry = new QLineEdit();
|
||||||
|
addrEntry->setFont( font );
|
||||||
|
addrEntry->setText( tr(stmp) );
|
||||||
|
addrEntry->setReadOnly( true );
|
||||||
|
addrEntry->setAlignment(Qt::AlignCenter);
|
||||||
|
addrEntry->setMaximumWidth( charWidth * 6 );
|
||||||
|
|
||||||
|
hbox->addWidget( lbl );
|
||||||
|
hbox->addWidget( addrEntry );
|
||||||
|
|
||||||
|
lbl = new QLabel( tr("Name") );
|
||||||
|
nameEntry = new QLineEdit();
|
||||||
|
|
||||||
|
hbox->addWidget( lbl );
|
||||||
|
hbox->addWidget( nameEntry );
|
||||||
|
|
||||||
|
mainLayout->addLayout( hbox );
|
||||||
|
|
||||||
|
hbox = new QHBoxLayout();
|
||||||
|
lbl = new QLabel( tr("Comment") );
|
||||||
|
commentEntry = new QLineEdit();
|
||||||
|
|
||||||
|
hbox->addWidget( lbl );
|
||||||
|
hbox->addWidget( commentEntry );
|
||||||
|
|
||||||
|
mainLayout->addLayout( hbox );
|
||||||
|
|
||||||
|
hbox = new QHBoxLayout();
|
||||||
|
okButton = new QPushButton( tr("OK") );
|
||||||
|
cancelButton = new QPushButton( tr("Cancel") );
|
||||||
|
|
||||||
|
mainLayout->addLayout( hbox );
|
||||||
|
hbox->addWidget( cancelButton );
|
||||||
|
hbox->addWidget( okButton );
|
||||||
|
|
||||||
|
connect( okButton, SIGNAL(clicked(void)), &dialog, SLOT(accept(void)) );
|
||||||
|
connect( cancelButton, SIGNAL(clicked(void)), &dialog, SLOT(reject(void)) );
|
||||||
|
|
||||||
|
if ( sym != NULL )
|
||||||
|
{
|
||||||
|
nameEntry->setText( tr(sym->name.c_str()) );
|
||||||
|
commentEntry->setText( tr(sym->comment.c_str()) );
|
||||||
|
}
|
||||||
|
|
||||||
|
dialog.setLayout( mainLayout );
|
||||||
|
|
||||||
|
ret = dialog.exec();
|
||||||
|
|
||||||
|
if ( ret == QDialog::Accepted )
|
||||||
|
{
|
||||||
|
if ( sym == NULL )
|
||||||
|
{
|
||||||
|
sym = new debugSymbol_t();
|
||||||
|
sym->ofs = addr;
|
||||||
|
sym->name = nameEntry->text().toStdString();
|
||||||
|
sym->comment = commentEntry->text().toStdString();
|
||||||
|
|
||||||
|
debugSymbolTable.addSymbolAtBankOffset( bank, addr, sym );
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
sym->name = nameEntry->text().toStdString();
|
||||||
|
sym->comment = commentEntry->text().toStdString();
|
||||||
|
}
|
||||||
|
//fceuWrapperLock();
|
||||||
|
updateAllDebuggerWindows();
|
||||||
|
//fceuWrapperUnLock();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//----------------------------------------------------------------------------
|
||||||
void HexEditorDialog_t::updatePeriodic(void)
|
void HexEditorDialog_t::updatePeriodic(void)
|
||||||
{
|
{
|
||||||
//printf("Update Periodic\n");
|
//printf("Update Periodic\n");
|
||||||
|
@ -1575,8 +1705,9 @@ void QHexEdit::contextMenuEvent(QContextMenuEvent *event)
|
||||||
{
|
{
|
||||||
case MODE_NES_RAM:
|
case MODE_NES_RAM:
|
||||||
{
|
{
|
||||||
act = new QAction(tr("TODO Add Symbolic Debug Name"), this);
|
act = new QAction(tr("Add Symbolic Debug Name"), this);
|
||||||
menu.addAction(act);
|
menu.addAction(act);
|
||||||
|
connect( act, SIGNAL(triggered(void)), this, SLOT(addDebugSym(void)) );
|
||||||
|
|
||||||
sprintf( stmp, "Add Read Breakpoint for Address $%04X", addr );
|
sprintf( stmp, "Add Read Breakpoint for Address $%04X", addr );
|
||||||
act = new QAction(tr(stmp), this);
|
act = new QAction(tr(stmp), this);
|
||||||
|
@ -1687,6 +1818,11 @@ void QHexEdit::addBookMarkCB(void)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//----------------------------------------------------------------------------
|
//----------------------------------------------------------------------------
|
||||||
|
void QHexEdit::addDebugSym(void)
|
||||||
|
{
|
||||||
|
parent->openDebugSymbolEditWindow( ctxAddr );
|
||||||
|
}
|
||||||
|
//----------------------------------------------------------------------------
|
||||||
void QHexEdit::addRamReadBP(void)
|
void QHexEdit::addRamReadBP(void)
|
||||||
{
|
{
|
||||||
int retval, type;
|
int retval, type;
|
||||||
|
|
|
@ -184,6 +184,7 @@ class QHexEdit : public QWidget
|
||||||
private slots:
|
private slots:
|
||||||
void jumpToROM(void);
|
void jumpToROM(void);
|
||||||
void addBookMarkCB(void);
|
void addBookMarkCB(void);
|
||||||
|
void addDebugSym(void);
|
||||||
void addRamReadBP(void);
|
void addRamReadBP(void);
|
||||||
void addRamWriteBP(void);
|
void addRamWriteBP(void);
|
||||||
void addRamExecuteBP(void);
|
void addRamExecuteBP(void);
|
||||||
|
@ -203,6 +204,7 @@ class HexEditorDialog_t : public QDialog
|
||||||
void gotoAddress(int newAddr);
|
void gotoAddress(int newAddr);
|
||||||
void populateBookmarkMenu(void);
|
void populateBookmarkMenu(void);
|
||||||
void setWindowTitle(void);
|
void setWindowTitle(void);
|
||||||
|
void openDebugSymbolEditWindow( int addr );
|
||||||
|
|
||||||
QHexEdit *editor;
|
QHexEdit *editor;
|
||||||
protected:
|
protected:
|
||||||
|
|
Loading…
Reference in New Issue