mirror of
https://github.com/epasveer/seer.git
synced 2026-08-30 00:50:42 +08:00
Fix bug when automatically bringing up a source file at a breakpoint.
If an exception is raised from a source file (or function) that is not compiled with debug info (resulting in no file or lineno), the EditorManager can't automatically open the next most available file (the one from the next stack frame). StackFramesBrowser now figures out which source file can be available if the file for frame 0 isn't available.
This commit is contained in:
@@ -35,10 +35,12 @@ SeerStackFramesBrowserWidget::~SeerStackFramesBrowserWidget () {
|
||||
|
||||
void SeerStackFramesBrowserWidget::handleText (const QString& text) {
|
||||
|
||||
// Stackframes is important. Always do it.
|
||||
//
|
||||
// Don't do any work if the widget is hidden.
|
||||
if (isHidden()) {
|
||||
return;
|
||||
}
|
||||
// if (isHidden()) {
|
||||
// return;
|
||||
// }
|
||||
|
||||
QApplication::setOverrideCursor(Qt::BusyCursor);
|
||||
|
||||
@@ -66,6 +68,11 @@ void SeerStackFramesBrowserWidget::handleText (const QString& text) {
|
||||
// Parse through the frame list and set the current lines that are in the frame list.
|
||||
QStringList frame_list = Seer::parse(text, "frame=", '{', '}', false);
|
||||
|
||||
QString firstLiveFrameLevel = "";
|
||||
QString firstLiveFrameFile = "";
|
||||
QString firstLiveFrameFullname = "";
|
||||
QString firstLiveFrameLine = "";
|
||||
|
||||
for ( const auto& frame_text : frame_list ) {
|
||||
|
||||
QString level_text = Seer::parseFirst(frame_text, "level=", '"', '"', false);
|
||||
@@ -90,7 +97,18 @@ void SeerStackFramesBrowserWidget::handleText (const QString& text) {
|
||||
|
||||
// Enable/disable interaction with this row depending if there is a valid file and line number.
|
||||
if (file_text != "" && fullname_text != "" && line_text != "") {
|
||||
|
||||
item->setFlags(Qt::ItemIsSelectable | Qt::ItemIsUserCheckable | Qt::ItemIsEnabled | Qt::ItemIsDragEnabled | Qt::ItemIsDropEnabled);
|
||||
|
||||
// Save the first live frame (that has a valid file and lineno) so we can select it automatically.
|
||||
// This only happens if the stack text is different (a stop point is reached).
|
||||
if (firstLiveFrameLevel == "") {
|
||||
firstLiveFrameLevel = level_text;
|
||||
firstLiveFrameFile = file_text;
|
||||
firstLiveFrameFullname = fullname_text;
|
||||
firstLiveFrameLine = line_text;
|
||||
}
|
||||
|
||||
}else{
|
||||
item->setFlags(Qt::NoItemFlags);
|
||||
}
|
||||
@@ -98,6 +116,12 @@ void SeerStackFramesBrowserWidget::handleText (const QString& text) {
|
||||
// Add the frame to the tree.
|
||||
stackTreeWidget->addTopLevelItem(item);
|
||||
}
|
||||
|
||||
// Automatically bring up the file for the first live frame.
|
||||
if (firstLiveFrameLevel != "") {
|
||||
emit selectedFile(firstLiveFrameFile, firstLiveFrameFullname, firstLiveFrameLine.toInt());
|
||||
emit selectedFrame(firstLiveFrameLevel.toInt());
|
||||
}
|
||||
}
|
||||
|
||||
// Select the first frame level.
|
||||
@@ -130,10 +154,12 @@ void SeerStackFramesBrowserWidget::handleText (const QString& text) {
|
||||
|
||||
void SeerStackFramesBrowserWidget::handleStoppingPointReached () {
|
||||
|
||||
// Stackframes is important. Always do it.
|
||||
//
|
||||
// Don't do any work if the widget is hidden.
|
||||
if (isHidden()) {
|
||||
return;
|
||||
}
|
||||
// if (isHidden()) {
|
||||
// return;
|
||||
// }
|
||||
|
||||
refresh();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user