From 5b026a2960484d7c862ed8e9142d57b8f71fb797 Mon Sep 17 00:00:00 2001 From: Rene Gollent Date: Sun, 14 Jun 2015 12:27:59 -0400 Subject: [PATCH] Debugger: Improve variable tooltips. VariablesView: - Tooltips now indicate if there was a problem resolving either the location or the actual value of a given variable, as well as whether or not the variable is editable in its current location. --- .../gui/team_window/VariablesView.cpp | 92 +++++++++++-------- 1 file changed, 53 insertions(+), 39 deletions(-) diff --git a/src/apps/debugger/user_interface/gui/team_window/VariablesView.cpp b/src/apps/debugger/user_interface/gui/team_window/VariablesView.cpp index 33feb49f66..df0c924650 100644 --- a/src/apps/debugger/user_interface/gui/team_window/VariablesView.cpp +++ b/src/apps/debugger/user_interface/gui/team_window/VariablesView.cpp @@ -1509,51 +1509,65 @@ VariablesView::VariableTableModel::GetToolTipForTablePath( if (node == NULL) return false; - if (node->NodeChild()->LocationResolutionState() != B_OK) - return false; - BString tipData; - switch (columnIndex) { - case 0: - { - ValueLocation* location = node->NodeChild()->Location(); - for (int32 i = 0; i < location->CountPieces(); i++) { - ValuePieceLocation piece = location->PieceAt(i); - BString pieceData; - switch (piece.type) { - case VALUE_PIECE_LOCATION_MEMORY: - pieceData.SetToFormat("(%" B_PRId32 "): Address: %#" - B_PRIx64 ", Size: %" B_PRId64 " bytes", i, - piece.address, piece.size); - break; - case VALUE_PIECE_LOCATION_REGISTER: - { - Architecture* architecture = fThread->GetTeam() - ->GetArchitecture(); - pieceData.SetToFormat("(%" B_PRId32 "): Register (%s)", - i, architecture->Registers()[piece.reg].Name()); - break; + ValueNodeChild* child = node->NodeChild(); + status_t error = child->LocationResolutionState(); + if (error != B_OK) + tipData.SetToFormat("Unable to resolve location: %s", strerror(error)); + else { + ValueNode* valueNode = child->Node(); + if (valueNode == NULL) + return false; + error = valueNode->LocationAndValueResolutionState(); + if (error != B_OK) { + tipData.SetToFormat("Unable to resolve value: %s\n\n", + strerror(error)); + } + + switch (columnIndex) { + case 0: + { + ValueLocation* location = child->Location(); + for (int32 i = 0; i < location->CountPieces(); i++) { + ValuePieceLocation piece = location->PieceAt(i); + BString pieceData; + switch (piece.type) { + case VALUE_PIECE_LOCATION_MEMORY: + pieceData.SetToFormat("(%" B_PRId32 "): Address: " + "%#" B_PRIx64 ", Size: %" B_PRId64 " bytes\n", + i, piece.address, piece.size); + break; + case VALUE_PIECE_LOCATION_REGISTER: + { + Architecture* architecture = fThread->GetTeam() + ->GetArchitecture(); + pieceData.SetToFormat("(%" B_PRId32 "): Register " + "(%s)\n", i, + architecture->Registers()[piece.reg].Name()); + break; + } + default: + break; } - default: - break; + + tipData += pieceData; } - - tipData += pieceData; - if (i < location->CountPieces() - 1) - tipData += "\n"; + tipData += "Editable: "; + tipData += error == B_OK && location->IsEditable() + ? "Yes" : "No"; + break; } - break; - } - case 1: - { - Value* value = node->GetValue(); - if (value != NULL) - value->ToString(tipData); + case 1: + { + Value* value = node->GetValue(); + if (value != NULL) + value->ToString(tipData); - break; + break; + } + default: + break; } - default: - break; } if (tipData.IsEmpty())