812 Part VI . Programming in Linux where (Web server address)

812 Part VI . Programming in Linux where it crashes on your system depends on several variables. Those variables could include 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. The expression $1 is an alias that refers to an entry in GDB s value history. GDB creates value history entries for each command you type that produces computed results. The alias numbers increment sequentially each time you execute a command that produces some sort of computed output. As a result, you can access these computed values using aliases rather than retyping the command. For example, the command $1-5 produces the following: (gdb) print $1-5 $2 = 719 Notice that the alias incremented to $2. If you later need to use the value 719, you can use the alias $2. The value history is reset each time you start GDB and the values are not accessible outside of GDB. You are not limited to using discrete values because gdb can display the addresses of data stored in an arbitrary region of memory. For example, to print the first 10 memory locations associated with ary, use the following command: (gdb) print ary@10 $3 = {0xbffffc90, 0×40015580, 0×400115800, 0×0, 0×1, 0×2, 0c3, 0×4, 0×5} The notation @10 means to print the 10 values that begin at ary. Say, on the other hand, that you want to print the five values stored in ary beginning with the first element. The command for this would be the following: (gdb) print ary[1]@5 $4 = {1, 2, 3, 4, 5} Why go to the trouble of printing variable or array values? Although it isn t necessary in this particular example because you know where the trouble occurs, it is often necessary to see the value of a variable at a particular point in a program s execution so you monitor what is happening to variables. In the case of arrays, a command that prints the values in an array, such as print ary[1]@5 in the preceding example, enables you to confirm at a glance the values are what you expect them to be. If the values don t match up with your expectations, however, that is a clue that some code is altering the array in a way you didn t intend. As a result, you can focus your bug hunting on a specific section of code.
From our experience, we can recommend PHP Web Hosting services, if you need affordable webhost to host and run your web application.

Leave a Reply