Web site template - 748 Part VI . Programming in Linux It

748 Part VI . Programming in Linux It would be helpful, however, to have some idea of the context in which the offending line(s) of code exist. For this purpose, use the list command, which takes the general form, list [m,n], where m and n are the starting and ending line numbers you want displayed. For example: (gdb) list 10,32 would display code lines 10 through 32. A bare list command displays 10 lines of code that includes the line where the error was first detected, as illustrated here: (gdb) list 15 index_to_the_moon(intary); 16 17 exit(EXIT_SUCCESS); 18 } 19 20 void index_to_the_moon(int ary[]) 21 { 22 int i; 23 for (i = 0; i < BIGNUM; ++I { 24 ary[i] = i; Examining Data One of GDB s most useful features is its ability to display both the type and the value of almost any expression, variable, or array in the program being debugged. It can print the value of any expression legal in the language in which your program is written. The command is, predictably enough, print. Here are a couple of print commands and their results: (gdb) print i $1 = 724 (gdb) print ary[i] Cannot access memory at address 0xc0000000. This example continues the earlier examples of debugging debugme.c because you are still trying to identify where and why debug me crashed. Although in this example, the program crashed at the point when the counter variable i equaled 724 (the expression $1 refers to an entry in GDB s value history, explained in a moment), where it crashes on your system depends on the system s memory layout, the process s memory space (especially the kernel s stack space), the amount of available memory on your system, and other factors. The result of the second command (print ary[i]) makes it pretty clear that the program does not have access to the memory location specified, although it does have legal access to the preceding one.
From our experience, we are can tell you that you can find a reliable and cheap webhost service at Java Web Hosting services.

Leave a Reply