You can perform the following operations on source files:
Following is an example that shows listing lines and using the / command to search for a string:
(idb) file
src/x_list.cxx
(idb) list 180:10
180 main()
181 {
182 List<Node> nodeList;
183
184 // add entries to list
185 //
> 186 IntNode* newNode = new IntNode(1);
187 nodeList.append(newNode); {static int somethingToReturnTo; somethingToReturnTo++; }
188
189 CompoundNode* cNode = new CompoundNode(12.345, 2);
(idb) /CompoundNode
192 CompoundNode* cNode1 = new CompoundNode(3.1415, 7)
Aliases are shorthand forms of longer commands. This example shows using the W alias, which lists up to 20 lines around the current line. Note that a right bracket (>) marks the current line.
(idb) alias W
W list $curline - 10:20
(idb) W
176
177
178 // The driver for this test
179 //
180 main()
181 {
182 List<Node> nodeList;
183
184 // add entries to list
185 //
> 186 IntNode* newNode = new IntNode(1);
187 nodeList.append(newNode);
188
189 CompoundNode* cNode = new CompoundNode(12.345, 2);
190 nodeList.append(cNode);
191
192 nodeList.append(new IntNode(3));
193
194 IntNode* newNode2 = new IntNode(4);
195 nodeList.append(newNode2);
Use info source, info line, and list commands for looking at source files:
(idb) info source
Current source file is src/x_list.cxx
(idb) list 180,+10
180 main()
181 {
182 List<Node> nodeList;
183
184 // add entries to list
185 //
186 IntNode* newNode = new IntNode(1);
187 nodeList.append(newNode); {static int somethingToReturnTo; somethingToReturnTo++; }
188
189 CompoundNode* cNode = new CompoundNode(12.345, 2);
(idb) forward-search CompoundNode
192 CompoundNode* cNode1 = new CompoundNode(3.1415, 7);