2

Since moving to Xcode 3 to 4.3, in the debugger I've been unable to view member variables in nested template classes such as linked lists. Does anyone have any thoughts on how to get a look? Here's an example, followed by what I can and can't see in the debugger's 'variables' window:

template<class T> class linkedList;
template<class T> class listItem;

template<class T> class listItem {
public:
    T data;
    listItem<T> *previous, *next;

listItem(T x):data(x), previous(0), next(0){}
};


template<class T> class linkedList{
  public:
int length;
listItem<T> *first,*last;

linkedList(void): first(0), last(0), length(0) {}
~linkedList(void){Clear();}
void Append(T x);
void Clear(void){
            while(length>0) DeleteLast();}
void DeleteLast(void);
};

template<class T> void linkedList<T>::Append (T x) {
    listItem<T> *item = new listItem<T>(x);
    if (length == 0) {first = item;}
        else {  
    item->previous = last;
    last->next = item;}
    item->next = NULL;  
    last = item; 
    length++;
}//Append


template<class T> void linkedList<T>::DeleteLast (void) {
    if (length > 0) {
        listItem<T> *item = last;
    if (length == 1) {
    first = last = NULL;
    length = 0;
    delete item; item = NULL;
    return;}
    else if (length == 2) {
    last = item->previous;
    last->next = NULL;
    first = last;}
    else {
    item->previous->next = NULL;
    last = item->previous;}
    length--;
    delete item;item=NULL;
    }
}//DeleteLast

int main(){
    linkedList<int> theList;
    theList.Append(4);
    theList.Append(5);

return 0;
}

Stepping through and watching in the variables window, I end up with:

theList= (linkedList<int>)
   length= (int) 2
   first= (listItem*) 0x0000000100100a80
   last= (listItem*) 0x0000000100100aa0

What I want to see is not just the addresses of items 'first' and 'last', but their dereferenced contents, the integers 4 and 5. This information was visible in Xcode 3.

Any thoughts?

Some programmer dude
  • 400,186
  • 35
  • 402
  • 621
adam
  • 21
  • 2

0 Answers0