From d51ab41d49c22818ab2701f7aa52c6257369f4ab Mon Sep 17 00:00:00 2001 From: Rene Gollent Date: Fri, 17 May 2013 22:06:04 -0400 Subject: [PATCH] Fix oversight in set visible range support. Detect the case where we have a pointer to an array type, as seen when typecasting a pointer to an array, and present the set visible range option for these as well. --- .../gui/team_window/VariablesView.cpp | 25 +++++++++++++++---- 1 file changed, 20 insertions(+), 5 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 9826f745b1..2b4b040159 100644 --- a/src/apps/debugger/user_interface/gui/team_window/VariablesView.cpp +++ b/src/apps/debugger/user_interface/gui/team_window/VariablesView.cpp @@ -1593,6 +1593,9 @@ VariablesView::MessageReceived(BMessage* message) ->SelectionModel()->NodeAt(0); int32 lowerBound, upperBound; ValueNode* valueNode = node->NodeChild()->Node(); + if (!valueNode->IsRangedContainer()) + valueNode = node->ChildAt(0)->NodeChild()->Node(); + if (valueNode->SupportedChildRange(lowerBound, upperBound) != B_OK) break; @@ -1623,6 +1626,8 @@ VariablesView::MessageReceived(BMessage* message) ->SelectionModel()->NodeAt(0); int32 lowerBound, upperBound; ValueNode* valueNode = node->NodeChild()->Node(); + if (!valueNode->IsRangedContainer()) + valueNode = node->ChildAt(0)->NodeChild()->Node(); if (valueNode->SupportedChildRange(lowerBound, upperBound) != B_OK) break; @@ -1992,13 +1997,23 @@ VariablesView::_GetContextActionsForNode(ModelNode* node, return result; ValueNode* valueNode = node->NodeChild()->Node(); - if (valueNode != NULL && valueNode->IsRangedContainer()) { - result = _AddContextAction("Set visible range" B_UTF8_ELLIPSIS, - MSG_SHOW_CONTAINER_RANGE_PROMPT, actions, message); - if (result != B_OK) - return result; + if (valueNode == NULL) + return B_OK; + + if (!valueNode->IsRangedContainer()) { + if (node->CountChildren() == 1 && node->ChildAt(0)->IsHidden()) { + valueNode = node->ChildAt(0)->NodeChild()->Node(); + if (valueNode == NULL || !valueNode->IsRangedContainer()) + return B_OK; + } else + return B_OK; } + result = _AddContextAction("Set visible range" B_UTF8_ELLIPSIS, + MSG_SHOW_CONTAINER_RANGE_PROMPT, actions, message); + if (result != B_OK) + return result; + return B_OK; }