Skip to content

Commit

Permalink
Debugger: Improve variable tooltips.
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
anevilyak committed Jul 18, 2015
1 parent 4c880a7 commit 5b026a2
Showing 1 changed file with 53 additions and 39 deletions.
92 changes: 53 additions & 39 deletions src/apps/debugger/user_interface/gui/team_window/VariablesView.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
if (i < location->CountPieces() - 1)
tipData += "\n";
tipData += pieceData;
}
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())
Expand Down

0 comments on commit 5b026a2

Please sign in to comment.