Continuing Execution of the Process: General Information

When you have finished examining the current state of the process, you can move the process forward and see what happens. The following table shows the aliases and commands you can use to do this.

Desired Behavior

Command

Alias

Can Take Repeat Cont

Continue until another interesting thing happens cont c Yes*
Single step by line, but step over calls next n Yes
Single step to a new line, stepping into calls step

 

Yes
Continue until control returns to the caller return (dbx)

finish (gdb)

None No
Single step by instruction, over calls nexti ni Yes
Single step by instruction, into calls stepi si Yes

* For the cont command, in GDB mode repeat count specifies the number of times to ignore a breakpoint. For the other commands repeat count has the same meaning in both modes.

The following examples demonstrate stepping through lines of source code and stepping at the instruction level.

GDB Mode

Stepping through lines of source code:

(idb) list

172

173     if (i == 1) cout << "The list is empty ";

174     cout << endl << endl;

175 }

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);   {static int somethingToReturnTo; somethingToReturnTo++; }

188

189     CompoundNode* cNode = new CompoundNode(12.345, 2);

190     nodeList.append(cNode); {static int somethingToReturnTo; somethingToReturnTo++; }

191

(idb) next

186     IntNode* newNode = new IntNode(1);

(idb) next 3

190     nodeList.append(cNode); {static int somethingToReturnTo; somethingToReturnTo++; }

(idb) step

List<Node>::append (this=0xbfffb5c0, node=0x805c510) at src/x_list.cxx:148

148     if (!_firstNode)

(idb) list -2,+6

146 {

147

148     if (!_firstNode)

149         _firstNode = node;

150     else {

151         Node* currentNode = _firstNode;

(idb) step

151         Node* currentNode = _firstNode;

(idb) list -2,+5

149         _firstNode = node;

150     else {

151         Node* currentNode = _firstNode;

152         while (currentNode->getNextNode())

153             currentNode = currentNode->getNextNode();

(idb) finish

main () at src/x_list.cxx:190

190     nodeList.append(cNode); {static int somethingToReturnTo; somethingToReturnTo++; }

(idb) next 2

193     nodeList.append(cNode1); {static int somethingToReturnTo; somethingToReturnTo++; }

Stepping at the instruction level:

(idb) x /2i $pc

0x0804ae54 <append>:                 pushl    %ebp

0x0804ae55 <append+1>:                 movlr    %esp, %ebp

(idb) nexti

0x0804ae55 in List<Node>::append (this=0x1, node=0xbfffd774) at src/x_list.cxx:146

146 {

(idb) x /1i $pc

0x0804ae55 <append+1>:                 movlr    %esp, %ebp

(idb) run

Program exited normally.

Starting program: /home/user/examples/test/idb/Examples/exp/i686-Linux-currstable/debuggable/x_list

Breakpoint 3, main () at src/x_list.cxx:193

193     nodeList.append(cNode1); {static int somethingToReturnTo; somethingToReturnTo++; }

(idb) x /2i $pc

0x08051826 <main+574>:                 call     0x0804ae54 <append>

0x0805182b <main+579>:                 addl     $0x8, %esp

(idb) stepi

List<Node>::append (this=0x1, node=0xbfffe2b4) at src/x_list.cxx:146

146 {

(idb) x /1i $pc

0x0804ae54 <append>:                 pushl    %ebp

DBX Mode

Stepping through lines of source code:

(idb) list $curline - 10:20

    172

    173     if (i == 1) cout << "The list is empty ";

    174     cout << endl << endl;

    175 }

    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);   {static int somethingToReturnTo; somethingToReturnTo++; }

    188

    189     CompoundNode* cNode = new CompoundNode(12.345, 2);

    190     nodeList.append(cNode); {static int somethingToReturnTo; somethingToReturnTo++; }

    191

(idb) next

stopped at [int main(void):186 0x08051615]

    186     IntNode* newNode = new IntNode(1);

(idb) next 3

stopped at [int main(void):190 0x08051760]

    190     nodeList.append(cNode); {static int somethingToReturnTo; somethingToReturnTo++; }

(idb) step

stopped at [void List<Node>::append(class Node* const):148 0x0804ae5a]

    148     if (!_firstNode)

(idb) list $curline - 2:6

    146 {

    147

>   148     if (!_firstNode)

    149         _firstNode = node;

    150     else {

    151         Node* currentNode = _firstNode;

(idb) next

stopped at [void List<Node>::append(class Node* const):151 0x0804ae6d]

    151         Node* currentNode = _firstNode;

(idb) list $curline - 2:5

    149         _firstNode = node;

    150     else {

>   151         Node* currentNode = _firstNode;

    152         while (currentNode->getNextNode())

    153             currentNode = currentNode->getNextNode();

(idb) return

stopped at [int main(void):190 0x08051778]

    190     nodeList.append(cNode); {static int somethingToReturnTo; somethingToReturnTo++; }

(idb) next 2

stopped at [int main(void):193 0x08051813]

    193     nodeList.append(cNode1); {static int somethingToReturnTo; somethingToReturnTo++; }

Stepping at the instruction level:

(idb) $pc/2i

int main(void): src/x_list.cxx

*[line 193, 0x08051826] main+0x23e:                   call     append(class Node* const)

 [line 193, 0x0805182b] main+0x243:                   addl     $0x8, %esp

(idb) nexti

stopped at [int main(void):193 0x0805182b] main+0x243:                   addl     $0x8, %esp

(idb) $pc/1i

int main(void): src/x_list.cxx

*[line 193, 0x0805182b] main+0x243:                   addl     $0x8, %esp

(idb) rerun

Process has exited

[3] stopped at [int main(void):193 0x08051826]

    193     nodeList.append(cNode1); {static int somethingToReturnTo; somethingToReturnTo++; }

(idb) $pc/2i

int main(void): src/x_list.cxx

*[line 193, 0x08051826] main+0x23e:                   call     append(class Node* const)

 [line 193, 0x0805182b] main+0x243:                   addl     $0x8, %esp

(idb) stepi

stopped at [void List<Node>::append(class Node* const):146 0x0804ae54] append(class Node* const):                 pushl    %ebp

(idb) $pc/1i

void List<Node>::append(class Node* const): src/x_list.cxx

*[line 146, 0x0804ae54] append(class Node* const):                 pushl    %ebp

See also

Continuing Execution of the Process