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,51 +1509,65 @@ 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;
switch (columnIndex) { ValueNodeChild* child = node->NodeChild();
case 0: status_t error = child->LocationResolutionState();
{ if (error != B_OK)
ValueLocation* location = node->NodeChild()->Location(); tipData.SetToFormat("Unable to resolve location: %s", strerror(error));
for (int32 i = 0; i < location->CountPieces(); i++) { else {
ValuePieceLocation piece = location->PieceAt(i); ValueNode* valueNode = child->Node();
BString pieceData; if (valueNode == NULL)
switch (piece.type) { return false;
case VALUE_PIECE_LOCATION_MEMORY: error = valueNode->LocationAndValueResolutionState();
pieceData.SetToFormat("(%" B_PRId32 "): Address: %#" if (error != B_OK) {
B_PRIx64 ", Size: %" B_PRId64 " bytes", i, tipData.SetToFormat("Unable to resolve value: %s\n\n",
piece.address, piece.size); strerror(error));
break; }
case VALUE_PIECE_LOCATION_REGISTER:
{ switch (columnIndex) {
Architecture* architecture = fThread->GetTeam() case 0:
->GetArchitecture(); {
pieceData.SetToFormat("(%" B_PRId32 "): Register (%s)", ValueLocation* location = child->Location();
i, architecture->Registers()[piece.reg].Name()); for (int32 i = 0; i < location->CountPieces(); i++) {
break; 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 += "Editable: ";
tipData += pieceData; tipData += error == B_OK && location->IsEditable()
if (i < location->CountPieces() - 1) ? "Yes" : "No";
tipData += "\n"; break;
} }
break; case 1:
} {
case 1: Value* value = node->GetValue();
{ if (value != NULL)
Value* value = node->GetValue(); value->ToString(tipData);
if (value != NULL)
value->ToString(tipData);
break; break;
}
default:
break;
} }
default:
break;
} }
if (tipData.IsEmpty()) if (tipData.IsEmpty())