Ticket #8286: variable_address.patch

File variable_address.patch, 2.4 KB (added by anevilyak, 12 years ago)
  • src/apps/debugger/user_interface/gui/team_window/VariablesView.cpp

    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 04ad5d4..1cbdc47 100644
    a b  
    1616
    1717#include <AutoDeleter.h>
    1818#include <AutoLocker.h>
     19#include <ControlLook.h>
    1920
    2021#include "table/TableColumns.h"
    2122
     
    2930#include "StackFrame.h"
    3031#include "StackFrameValues.h"
    3132#include "TableCellValueRenderer.h"
     33#include "TargetAddressTableColumn.h"
    3234#include "Team.h"
    3335#include "Thread.h"
    3436#include "Tracing.h"
    VariablesView::VariableTableModel::ValueNodeValueChanged(ValueNode* valueNode)  
    10431045int32
    10441046VariablesView::VariableTableModel::CountColumns() const
    10451047{
    1046     return 2;
     1048    return 3;
    10471049}
    10481050
    10491051
    VariablesView::VariableTableModel::GetValueAt(void* object, int32 columnIndex,  
    11021104
    11031105    switch (columnIndex) {
    11041106        case 0:
    1105             _value.SetTo(node->Name(), B_VARIANT_DONT_COPY_DATA);
     1107        {
     1108            if (node->NodeChild()->LocationResolutionState()
     1109                == VALUE_NODE_UNRESOLVED) {
     1110                return false;
     1111            }
     1112            ValueLocation* location = node->NodeChild()->Location();
     1113            if (location == NULL)
     1114                return false;
     1115
     1116            ValuePieceLocation piece = location->PieceAt(0);
     1117            if (piece.type != VALUE_PIECE_LOCATION_MEMORY)
     1118                return false;
     1119            _value.SetTo(piece.address);
    11061120            return true;
     1121        }
    11071122        case 1:
     1123            _value.SetTo(node->Name(), B_VARIANT_DONT_COPY_DATA);
     1124            return true;
     1125        case 2:
    11081126            if (node->GetValue() == NULL)
    11091127                return false;
    11101128
    VariablesView::_Init()  
    17251743    fVariableTable->SetSortingEnabled(false);
    17261744
    17271745    // columns
    1728     fVariableTable->AddColumn(new StringTableColumn(0, "Variable", 80, 40, 1000,
     1746    float addressWidth = be_plain_font->StringWidth("0x00000000")
     1747        + be_control_look->DefaultLabelSpacing() * 2 + 5;
     1748
     1749    fVariableTable->AddColumn(new TargetAddressTableColumn(0, "Address",
     1750        addressWidth, 40, 1000, B_TRUNCATE_END, B_ALIGN_RIGHT));
     1751    fVariableTable->AddColumn(new StringTableColumn(1, "Variable", 80, 40, 1000,
    17291752        B_TRUNCATE_END, B_ALIGN_LEFT));
    1730     fVariableTable->AddColumn(new VariableValueColumn(1, "Value", 80, 40, 1000,
     1753    fVariableTable->AddColumn(new VariableValueColumn(2, "Value", 80, 40, 1000,
    17311754        B_TRUNCATE_END, B_ALIGN_RIGHT));
    17321755
    17331756    fVariableTableModel = new VariableTableModel;