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.
This commit is contained in:
Rene Gollent
2015-07-17 22:03:22 -04:00
parent 4c880a79bc
commit 5b026a2960
@@ -1509,29 +1509,41 @@ VariablesView::VariableTableModel::GetToolTipForTablePath(
if (node == NULL) if (node == NULL)
return false; return false;
if (node->NodeChild()->LocationResolutionState() != B_OK)
return false;
BString tipData; BString tipData;
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) { switch (columnIndex) {
case 0: case 0:
{ {
ValueLocation* location = node->NodeChild()->Location(); ValueLocation* location = child->Location();
for (int32 i = 0; i < location->CountPieces(); i++) { for (int32 i = 0; i < location->CountPieces(); i++) {
ValuePieceLocation piece = location->PieceAt(i); ValuePieceLocation piece = location->PieceAt(i);
BString pieceData; BString pieceData;
switch (piece.type) { switch (piece.type) {
case VALUE_PIECE_LOCATION_MEMORY: case VALUE_PIECE_LOCATION_MEMORY:
pieceData.SetToFormat("(%" B_PRId32 "): Address: %#" pieceData.SetToFormat("(%" B_PRId32 "): Address: "
B_PRIx64 ", Size: %" B_PRId64 " bytes", i, "%#" B_PRIx64 ", Size: %" B_PRId64 " bytes\n",
piece.address, piece.size); i, piece.address, piece.size);
break; break;
case VALUE_PIECE_LOCATION_REGISTER: case VALUE_PIECE_LOCATION_REGISTER:
{ {
Architecture* architecture = fThread->GetTeam() Architecture* architecture = fThread->GetTeam()
->GetArchitecture(); ->GetArchitecture();
pieceData.SetToFormat("(%" B_PRId32 "): Register (%s)", pieceData.SetToFormat("(%" B_PRId32 "): Register "
i, architecture->Registers()[piece.reg].Name()); "(%s)\n", i,
architecture->Registers()[piece.reg].Name());
break; break;
} }
default: default:
@@ -1539,9 +1551,10 @@ VariablesView::VariableTableModel::GetToolTipForTablePath(
} }
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: case 1:
@@ -1555,6 +1568,7 @@ VariablesView::VariableTableModel::GetToolTipForTablePath(
default: default:
break; break;
} }
}
if (tipData.IsEmpty()) if (tipData.IsEmpty())
return false; return false;