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.
GDB Mode
(idb) backtrace 3
#0 0x08051c7c in IntNode::printNodeData (this=0x805c500) at src/x_list.cxx:94
#1 0x0804af73 in List<Node>::print (this=0xbfffa330) at src/x_list.cxx:168
#2 0x08051a3c in main () at src/x_list.cxx:203
(idb) up 2
#2 0x08051a3c 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 0x0804af73 in List<Node>::print (this=0xbfffa330) at src/x_list.cxx:168
168 currentNode->printNodeData();
DBX Mode
(idb) where 3
>0 0x08051c7c in ((IntNode*)0x805c500)->IntNode::printNodeData() "src/x_list.cxx":94
#1 0x0804af73 in ((List<Node>*)0xbfffa4d0)->List<Node>::print() "src/x_list.cxx":168
#2 0x08051a3c in main() "src/x_list.cxx":203
(idb) up 2
>2 0x08051a3c 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 0x0804af73 in ((List<Node>*)0xbfffa4d0)->List<Node>::print() "src/x_list.cxx":168
168 currentNode->printNodeData();
See also
Looking at the Call Stack