Skip to content

Commit 05ed425

Browse files
authored
Merge pull request #126 from pvmm/master
cleaning up BreakpointViewer when symbols are deleted
2 parents cccf067 + 2a6e7e7 commit 05ed425

File tree

3 files changed

+24
-0
lines changed

3 files changed

+24
-0
lines changed

src/BreakpointViewer.cpp

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -856,6 +856,27 @@ std::optional<Breakpoint> BreakpointViewer::parseTableRow(BreakpointRef::Type ty
856856
return bp;
857857
}
858858

859+
860+
void BreakpointViewer::onSymbolTableChanged()
861+
{
862+
for (int row = 0; row < bpTableWidget->rowCount(); ++row) {
863+
auto* item = bpTableWidget->item(row, BP_ADDRESS);
864+
865+
// scan tooltip validity
866+
if (!item->text().isEmpty()) {
867+
Symbol* s = debugSession.symbolTable().getAddressSymbol(item->text());
868+
auto address = stringToValue<uint16_t>(item->text());
869+
assert(address);
870+
871+
if (!s || *address != s->value()) {
872+
setTextField(BreakpointRef::BREAKPOINT, row, LOCATION, item->text());
873+
setTextField(BreakpointRef::BREAKPOINT, row, BP_ADDRESS, "");
874+
}
875+
}
876+
}
877+
}
878+
879+
859880
void BreakpointViewer::onAddBtnClicked(BreakpointRef::Type type)
860881
{
861882
auto sa = ScopedAssign(userMode, false);

src/BreakpointViewer.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ class BreakpointViewer : public QTabWidget, private Ui::BreakpointViewer
2828
BreakpointViewer(DebugSession& session, QWidget* parent = nullptr);
2929
void setBreakpoints(Breakpoints* bps);
3030

31+
void onSymbolTableChanged();
3132
void on_btnAddBp_clicked();
3233
void on_btnRemoveBp_clicked();
3334
void on_btnAddWp_clicked();

src/DebuggerForm.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1056,6 +1056,8 @@ void DebuggerForm::systemSymbolManager()
10561056
SymbolManager symManager(session.symbolTable(), this);
10571057
connect(&symManager, &SymbolManager::symbolTableChanged,
10581058
&session, &DebugSession::sessionModified);
1059+
connect(&symManager, &SymbolManager::symbolTableChanged,
1060+
bpView, &BreakpointViewer::onSymbolTableChanged);
10591061
symManager.exec();
10601062
emit symbolsChanged();
10611063
updateWindowTitle();

0 commit comments

Comments
 (0)