Читать книгу Beginning Programming All-in-One For Dummies - Wallace Wang - Страница 98

Stepping line-by-line

Оглавление

Stepping or tracing lets you run your program line-by-line, so you can see exactly what the program is doing at any given time. The second you see your program doing something wrong, you also see the exact command in your program that caused that problem. Then you can fix the problem, as shown in Figure 4-6.


FIGURE 4-6: Stepping through a program, line-by-line, can help you find errors or bugs in your program.

Sometimes when programmers find one error and fix it, their fix accidentally creates another error in the program.

Here are the two types of debuggers:

 Source level: Lets you examine your source code line-by-line. So if you write a program in C++, a source-level debugger shows you each line of your entire C++ program.

 Machine language: Lets you examine the machine language code, line-by-line, that your compiler created from your source code. Programmers often use machine-language debuggers to examine programs when they don’t have access to the source code, such as a computer virus or a rival’s program.

Stepping line-by-line through a small program may be feasible, but in a large program that consists of a million lines of code, stepping line-by-line would take far too long. So, to make stepping easier, most debuggers include breakpoints and stepping over/stepping out commands.

Beginning Programming All-in-One For Dummies

Подняться наверх