Home | Download | Support

C-Free - A Professional Excellent C/C++ IDE

Debug in C-Free
C-Free provides basic debugging function. The following sections guide you to use the debugging function in C-Free.
  1. Add/Remove Breakpoint
  2. Breakpoints Management
  3. Breakpoint Conditions
  4. Start Debug
  5. End Debug
  6. Step Into
  7. Step Over
  8. Step Out
  9. Run to Cursor
  10. Locals
  11. Inspect/Change
  12. Watch
  13. Memory
  14. Console


1、Add/Remove Breakpoint

There are two methods to add a breakpoint:
(1) Move the mouse to the left margin of edit area, left click the mouse button, then C-Free highlights the line to show a breakpoint has been added. The following figure shows a breakpoint is added:

(2) Second method: Move the caret of edit area to one line, and click on the "Insert/Remove Breakpoint" button on the toolbar. The button is showed in the below figure:




For a line that is added a breakpoint, we name it as a "breakpoint line". If you do the same operation that is mentioned above again to a breakpoint line, the breakpoint will be removed.


2、Breakpoints Management

Go to the "Debug" menu, and choose "Breakpoints...". The Breakpoints dialog appears. You can manage breakpoints by this dialog.



3、Breakpoint Conditions

The simplest sort of breakpoint breaks every time your program reaches a specified place. You can also specify a condition for a breakpoint. A condition is just a Boolean expression in C/C++ language. A breakpoint with a condition evaluates the expression each time your program reaches it, and your program stops only if the condition is true. From the Breakpoints dialog (as showed above), you can set condition for a breakpoint. Select one item from the list box of breakpoints, enter a expression for "Condition", and press "Set" button.

4、Start Debug

Click on the "Start Debug" button on toolbar, the program begins to be debugged. The Debug toolbar appears:



When the program is break at one breakpoint, the "Start Debug" button turn its function to "Continue". Click on the "Continue" button, the program continues to run tile meets with next breakpoint or terminates.


5、End Debug

When the program is debugging, you can click on the "Stop Debugging" button on the Debug toolbar to exit from the debugging state and return to edit state.


6、Step Into

When the program breaks at one calling function statement, you can click on the "Stop Into" button on the Debug toolbar to run into the function body.

As the following figure shows, program breaks at UpperCase function:




Now we invoke the "Step Into" command, program runs into
UpperCase function:





7、
Step Over

When the program is break, click on the "Step Over" button on the Debug toolbar, the program runs to next statement.   The following figure shows that program run over the breakpoint, and stoped at printf statement.


8、Step Out

When the program is break in a function body, click on the "Step Out" button on the Debug toolbar, the program will run to the position of return from the function.


9、Run to Cursor

Click on the "Run to Cursor" button, the program will run to the line that the caret at.



10、Locals

When the program is break at debugging state, the Locals window displays the values of all local variables in the current context. The following figure shows two variables/values of the "ComputeValue" function runtime context:


11、Inspect/Change

Right-click one item in Locals window, and choose "Inspect/Change" from the popup menu. Different dialog appears according to the type of variable you clicked on: array type, structure, or class variable: displays Inspector window. the other type variable: displays Change window. You can also double-click on one item in Locals window to display corresponding dialog.


12、Watch

You can use Watch window to trace the value of a expression during debugging. Right click watch window, and choose "Add Watch" from the popup menu. You can enter the expression you want to trace.



13、Memory

Input address of variable such as &s, pVariable or ex240ff50 on the Memory window and press "Enter" key, you can look into the content of variable in the context of memory. The following figure is a Memory window.

14、Console

When debugging C-Free communicate with GDB debugger for information. By default the console window is displayed to list all input and output messages from GDB. You also can input commands directly to communicate with GDB.