Home  >  Article  >  Software Tutorial  >  How to debug dev c? -dev c Chinese debugging

How to debug dev c? -dev c Chinese debugging

WBOY
WBOYforward
2024-03-18 15:04:06786browse

php editor Xiaoxin will take you to explore dev c Chinese debugging skills. When using dev c for programming, debugging is a very important link, which can help us find bugs in the code and fix them. This article will introduce how to debug in dev c, including setting breakpoints, observing variable values, single-step execution and other techniques to help you debug programs more efficiently and improve programming efficiency.

1. Debugging using breakpoints

If debugging is not possible: Tools –>Compile Options–>Code Generation/Optimization–>Connector–>Generate debugging information–>no changed to yes

Basic steps for debugging; 1. Change the release mode in the upper right corner to debug mode

2. Set breakpoints

3. Click Compile All and click the check mark.

(There are blue arrows indicating statements that have not yet been executed and are about to be executed, but there are more than one blue line. Variables can be viewed in two ways after debugging. ① Add view to enter the variable value and view ② Select a variable or expression, click Add to view, and you will see the variable value in the left column). Of course, you can also observe the value of the variable through the terminal console;

Regarding the setting and viewing of loop statement breakpoints: Set breakpoints at the beginning and end of the loop, and you can view the progress of statement execution through the terminal.

Debugging buttons and functions;

Next step: execute the next statement and treat the function as a statement to directly give the result

Single-step entry: execute the next statement, and when a function is encountered, enter the function and execute it in a single step (the best way to observe the transformation of variables in loops and functions)

Skip: execute until the next breakpoint, if there is no next breakpoint, execute directly to the end

Common endpoint errors:

① Under normal circumstances (no bug), it will stop at the breakpoint and display a blue arrow. If there is a bug and the breakpoint is still red, it means that the return statement has not been executed, and the past statement will not be executed because the conditions are not met.

② Debugging error: When an invalid memory reference is executed, that is, an empty address is operated, or the array is out of bounds, an error will be reported

For example, char a[100000000000] will report an error, because there is no such a large value at all, and it has far exceeded its own byte length, and an error will be reported during debugging. So char a[100] is fine. The table is that a has 100 characters. Each character can be written as 1000000000...one hundred.

Problems that arise during debugging:

1. When the scanf input cannot be performed during debugging, there must be a problem with the loop condition. Even an error message appears during debugging, indicating that there is a problem with the input statement. Please check the relevant knowledge here in time. ,

It may also be that the array is out of bounds, or it may be trapped in an infinite loop. Usually, it is caused by (loop statement, first execute i or the like, or execute loop while), so be careful.

2. When debugging the scanf function, be sure to write the next step (or single-step entry), enter the value in the terminal -> press Enter, and then enter the next step (single-step entry)

Usage problem: The code in dev C is caused by accidentally pressing insert. If you want to cancel, press insert again.

dev c++ 怎么调试?-dev c++中文调试

1. How to adjust Dev-C to Chinese?

If you missed the language selection step during the initial installation, you will need to set it up after the installation is complete. The specific setting steps are as follows:

​ ​ 1. First open the devc software, you can see that it is all in English. Click Tools on the menu bar and select Environment Options in the menu to open the environment settings.

dev c++ 怎么调试?-dev c++中文调试

​​ 2. Next, click the drop-down box in the blue position of the anguage that pops up, select Simplified Chinese, and press Enter to confirm.

dev c++ 怎么调试?-dev c++中文调试

3. After confirmation, the software will become the Chinese version.

dev c++ 怎么调试?-dev c++中文调试

It’s not difficult to set up. If you need it, just give it a try.



The above is the detailed content of How to debug dev c? -dev c Chinese debugging. For more information, please follow other related articles on the PHP Chinese website!

Statement:
This article is reproduced at:onlinedown.net. If there is any infringement, please contact admin@php.cn delete