Web hosting providers - Chapter 29 . Programming Tools and Utilities 809

Chapter 29 . Programming Tools and Utilities 809 A core dump refers to an application failing and copying all data stored in memory for the application into a file named core in the current directory. That file can be used to help debug a problem with the application. If you don t see the core dumped message, try executing the shell command ulimit -c unlimited, which allows programs to drop a memory dump in their current working directory. The program has a bug, so you need to debug it. The first step is to start GDB, using the program name, debugme, and the core file, core, as arguments: $ gdb debugme core After GDB initializes, the screen should resemble Figure 29-1. Figure 29-1: GDB s startup screen As you can see near the middle of the figure, GDB displays the name of the executable that created the core file: ` + , . Obviously, the displayed name is wrong; it should be debugme. The odd characters and the incorrect program name would give an experienced developer an immediate clue that the program has a significant memory bug. The next line in the figure, the text that reads Program terminated with signal 11, Segmentation fault, explains why the program terminated. A segmentation fault occurs anytime a program attempts to access memory that doesn t explicitly belong to it. GDB also helpfully displays the function it was executing, index_to_the_moon. If you don t like the licensing messages (they annoy me), use the -q (or –quiet) option when you start GDB to suppress them. Another useful command-line option is -d dirname, where dirname is the name of a directory, which tells gdb where to find source code (it looks in the current working directory by default). Tip Note
Looking for affordable and reliable webhost to host and run your business application? Then look no more and go to servlet web hosting services.

Leave a Reply