1 on 1 web hosting - Chapter 29 . Programming Tools and Utilities 813
Chapter 29 . Programming Tools and Utilities 813 GDB also can tell you the types of variables using the whatis command. GDB s whatis command is comparable to the man -f command, which searches the whatis database of system commands for short descriptions of those system commands (the manual page whatis database is totally separate from the whatis command used by GDB). While man s whatis database works on system commands, GDB s whatis command describes the types of variables and other data structures used in a program. (gdb) whatis i type = int (gdb) whatis ary type = int * (gdb) whatis index_to_the_moon type = void (int *) This feature may seem rather useless because, of course, you know the types of all the variables in your program (yeah, right!). But, you will change your mind the first time you have to debug someone else s code or have to fix a multi-file project for which you haven t seen the source files for a couple of months. The whatis command can also help you track down bugs that result from assigning an inappropriate value to a variable. Setting Breakpoints As you debug problematic code, it is often useful to halt execution at some point. Perhaps you want to stop execution before the code enters a section that is known to have problems. In other cases, you can set breakpoints so you can look at the values of certain variables at a given point in the execution flow. In still other situations, you might find it useful to stop execution so you can step through the code one instruction at a time. GDB enables you to set breakpoints on several different kinds of code constructs, including line numbers and function names, and also enables you to set conditional breakpoints, where the code stops only if a certain condition is met. To set a breakpoint on a line number, use the following syntax: (gdb) break linenum To stop execution when the code enters a function, use the following: (gdb) break funcname In either case, GDB halts execution before executing the specified line number or entering the specified function. You can then use print to display variable values, for example, or use list to review the code that is about to be executed. If you have a multi-file project and want to halt execution on a line of code or in a function that is not in the current source file, use the following forms:
Note: If you are looking for cheap and reliable webhost to host and run your mysql application check mysql web server services.