Looking at the Call Stack. Simple Debugging

You can examine the call stack of any thread. Even if you are not using threads explicitly, your process will have one thread running your code. You can move up and down the stack, and examine the source being executed at each call.

DBX Mode

 

(idb) where 3

>0  0x080535c4 in ((IntNode*)0x805e600)->IntNode::printNodeData() "src/x_list.cxx":94

#1  0x0804c6f7 in ((List<Node>*)0xbfffb068)->List<Node>::print() "src/x_list.cxx":168

#2  0x08053376 in main() "src/x_list.cxx":203

(idb) up 2

>2  0x08053376 in main() "src/x_list.cxx":203

    203     nodeList.print();

(idb) list $curline - 3:5

    200     CompoundNode* cNode2 = new CompoundNode(10.123, 5);

    201     nodeList.append(cNode2); {static int somethingToReturnTo; somethingToReturnTo++; }

    202

>   203     nodeList.print();

    204 }

(idb) down 1

>1  0x0804c6f7 in ((List<Node>*)0xbfffb068)->List<Node>::print() "src/x_list.cxx":168

    168         currentNode->printNodeData();

 

GDB Mode

 

(idb) backtrace 3

#0  0x080535c4 in IntNode::printNodeData () at src/x_list.cxx:94

#1  0x0804c6f7 in List<Node>::print () at src/x_list.cxx:168

#2  0x08053376 in main () at src/x_list.cxx:203

(idb) up 2

#2  0x08053376 in main () at src/x_list.cxx:203

203     nodeList.print();

(idb) list 200,+5

200     CompoundNode* cNode2 = new CompoundNode(10.123, 5);

201     nodeList.append(cNode2); {static int somethingToReturnTo; somethingToReturnTo++; }

202

203     nodeList.print();

204 }

(idb) down 1

#1  0x0804c6f7 in List<Node>::print () at src/x_list.cxx:168

168         currentNode->printNodeData();