814 Part VI . Programming in Linux (Web design software) (gdb)
814 Part VI . Programming in Linux (gdb) break filename:linenum (gdb) break filename:funcname Conditional breakpoints are usually more useful. They enable you to temporarily halt program execution if or when a particular condition is met. The correct syntax for setting conditional breakpoints is as follows: (gdb) break linenum if expr (gdb) break funcname if expr In the preceding code, expr can be any expression that evaluates to true (non-zero). For example, the following break command stops execution at line 24 of debugme when the variable i equals 15: (gdb) break 24 if i == 15 Breakpoint 1 at 0×80483cb: file debugme.c, line 24. (gdb) run Starting program: /home/kwall/code/debugme Breakpoint 1, index_to_the_moon (ary=0xbffff4b0) at debugme.c:24 24 ary[i] = i; Stopping when i equals 15 is an arbitrary choice to demonstrate conditional breaks. As you can see, gdb stopped on line 24. A quick print command confirms that it stopped when the value of i reached the requested value: (gdb) print i $1 = 15 To resume executing after hitting a breakpoint, type continue. If you have set many breakpoints and have lost track of what has been set and which ones have been triggered, you can use the info breakpoints command to refresh your memory. Working with Source Code Locating a specific variable or function in a multi-file project is a breeze with GDB, provided you use the -d switch to tell it where to find additional source code files. This is a particularly helpful option when not all of your source code is located in your current working directory or in the program s compilation directory (which GCC recorded in its symbol table). To specify one or more additional directories containing source code, start GDB using one or more -d dirname options, as this example illustrates: $ gdb -d /source/project1 -d /oldsource/project1 -d /home/b ubba/src killerapp
We recommend cheap and reliable webhost to host and run your web applications: Coldfusion Web Hosting services.