Using gdb With GNU Emacs
5.11 Installing GDB
GNU debugger is included in all Linux distributions in the development package. In certain cases, you may want to get a new copy in the source code form and build and install it manually. The compilation and building process is similar to other GNU development tools. By this time you have already built and installed the GNU compiler and the C library. With that experience, you should not find the compilation and installation of GNU debugger difficult.5.11.1 Downloading and Building
You can download the latest version from ftp:ftp.gnu.orggnugdb directory. The current version at the time of writing this book is 5.1.1. The source code is available in the compressed tar format. The file name is gdb-5.1.1.tar.gz. You have to uncompress it using the fol- lowing command. tar zxvf gdb-5.1.1.tar.gz I have untarred this file in opt directory. The tar program will create optgdb- 5.1.1 directory and uncompress all source code tree under this directory. Move into this direc- tory using the cd command. Run the configure script and the make command to build and install the debugger. This is a similar process as with all other GNU tools. The following com- mands will build gdb. cd optgdb-5.1.1 .configure –-prefix=optgcc-3.0.4 make Note that – -prefix shows the directory where the gdb binary and other files will be installed. Usually this is the same directory where your other development tools are installed.5.11.2 Final Installation
The following command places the gdb binary and other files in the proper location. After running this command, you can start using the new debugger. make install Other Open Source Debuggers 1695.12 Other Open Source Debuggers
In addition to gdb, there are many other debuggers available to the open source community. Many of these debuggers are built on top of the GNU debugger or they use gdb concepts. Some of these debuggers are introduced in this section. The most popular of these is the ddd debugger. xxgdb is a GUI interface to gdb and many people also use it. The kdbg comes with KDE on Linux. All of these debuggers use the same concepts as used by the gdb debugger.5.12.1 The kdbg Debugger
KDE debugger comes with KDE desktop development utilities. It is a GUI based upon GNU debugger. You can start it using the kdbg command or from a KDE menu. Using icons in the tool bar or menus, you can open files to be debugged. Once a file is loaded in the debugger window, you can click on a line to set or remove break points. To find out the purpose of an icon, you can move your cursor over the icon on the toolbar to display a short description. The kdbg is a simple debugger but keep in mind that you may not find it as powerful as a native GNU debugger is. The window that appears when you start the debugger is shown in Figure 5-3. In this window the pointer is on the first printf statement where we have a break point set. You can add a variable to the watch list using the watch window. This window can be opened by selecting the “Watched Expressions” option from the View menu. The window is shown in Figure 5-4 where two variables num1 and num2 are added to the watch list. You can click on a variable and then press the “Del” button to remove a variable from the watch list. The kdbg also has an output window that is used to display any output from the program. This output window is actually an input window as well. You can enter input for the program in this window. The output window is started when you start the kdbg debugger. The output win- dow is shown Figure 5-5.Parts
» the linux development platform 2003
» Requirement Gathering Life Cycle of a Software Development Project
» Writing Functional Specifications Life Cycle of a Software Development Project
» Creating Architecture and Design Documents
» Implementation and Coding Life Cycle of a Software Development Project
» Testing Life Cycle of a Software Development Project
» Technical documentation developed during the development process. This includes
» Technical documentation prepared for technical support staff. This includes technical
» End-user manuals and guides. This is the documentation for the end user to assist the
» Software Releases Support and New Features
» Hardware Platform Components of a Development System
» Operating System Components of a Development System
» Editors Components of a Development System
» Compilers and Assemblers Components of a Development System
» Debuggers Components of a Development System
» Version Control Systems Components of a Development System
» Selection Criteria for Hardware Platform Selection Criteria for Software Development Tools
» Creating Deadlines Managing Development Process
» Managing the Development Team
» Resolving Dependencies Managing Development Process
» Libraries Linux Development Platform Specifications LDPS and Linux
» Open Source Developers Network at http:www.osdn.org
» Extensibility What to Look for in an Editor
» References and Resources the linux development platform 2003
» Target machine. This is the machine for which the newly built compiler will generate
» Post-Installation Tasks Installing GNU Compiler
» Compiling to Intermediate Levels
» Compilation with Debug Support
» Compilation with Optimization Compiling a Program
» Compiling Source Code for Other Languages
» Linking a program Assembling a Program
» Creating Libraries the linux development platform 2003
» Standard Libraries the linux development platform 2003
» Compiling Fortran Programs the linux development platform 2003
» Smalltalk Oberon Other Compilers
» The target 2. Dependencies Basic Terminology
» The explicit rules 2. The implicit rules
» Input Files Introduction to GNU make
» Typical Contents of a Makefile
» Running make Introduction to GNU make
» Shell to Execute Commands Include Files
» The ftp server The The dnsresolver
» FTPOBJS OBJS Another Example of Makefile
» Explicit Rules The make Rules
» Implicit Rules The make Rules
» Defining Variables Types of Variables
» Pre-Defined Variables Automatic Variables
» Makefile in The Top Directory
» Makefile in common-dir Directory
» Makefile in the ftp-dir Directory
» Makefile in the tftp-dir Directory Makefile in the dns-dir Directory
» Building Everything Working with Multiple Makefiles and Directories
» The ifdef Directive Control Structures and Directives
» The ifndef Directive Control Structures and Directives
» Compilation Getting the Latest Version and Installation
» Most Commonly Used gdb Commands
» Passing Command Line Arguments to the Program Being Debugged
» The step and finish Commands
» Introduction to GDB Working with the Stack
» Displaying Program Variables Displaying Variables
» Automatic Displaying Variables with Each Command
» Displaying Environment Variables Displaying Variables
» Modifying Variables Displaying Variables
» Disabling Break Points Enabling Break Points
» Debugging Optimized Code the linux development platform 2003
» Debugging Running Processes the linux development platform 2003
» The kdbg Debugger Other Open Source Debuggers
» The ddd Debugger Other Open Source Debuggers
» The xxgdb Debugger Other Open Source Debuggers
» CVS Policies the linux development platform 2003
» Project Management and Communication
» Remote Repositories Checking out a Project
» Finding the Status of a Project
» Finding Differences Using the CVS Client
» Resolving Conflicts Using the CVS Client
» Checking the Project Back In Adding Files to a Project
» Removing Files from a Project
» Tags and Releases Using the CVS Client
» System Requirements Introduction to jCVS
» Installation Instructions Introduction to jCVS
» Using jCVS Introduction to jCVS
» Installing pcl-cvs Using Emacs with CVS
» Using pcl-cvs Using Emacs with CVS
» Have a shell account on the CVS server. 2. Create a publicprivate key pair on the client.
» Selecting Coding Styles Using indent Utility
» Formatting Braces Using indent Utility
» Formatting Declarations Using indent Utility
» Breaking Long Lines Using indent Utility
» Summary of Options Using indent Utility
» Using sed Utility Using cscope and cbrowser
» Generating C Function Prototypes from C Source Code Using cproto
» Using ltrace and strace Utilities
» Value 2. Type Name Using the nm Utility
» Using the ranlib Utility Using the strip Utility
» Using the strings Utility Using the addr2line Utility
» Host Machine Introduction to the Cross-Platform Development Process
» Target Machine Introduction to the Cross-Platform Development Process
» Cross Platform Development Cycle
» Embedded Systems and Moving Parts
» Embedded Systems and Power Consumption
» Embedded Operating Systems What are Embedded Systems?
» Knowledge of Target System Hardware
» Software Emulators Cross Compilations
» Using gdbserver with GNU Debugger
» Attaching to a Running Process Using gdbserver
» Arcom SBC-GX1 Board Hardware Used for Cross-Platform and Embedded Systems
» Artesyn PMPPC Mezzanine Card
» References the linux development platform 2003
» Java Compiler Java Virtual Machine
» Kaffe the linux development platform 2003
» The Jboss Java Development System
» Getting and Installing Java SDK from Sun Creating jar Files
» Creating Source Code File Compiling Java Code
» Running Java Applications Building Java Applications
» Using gcj to Build Java Applications
» Building Applets the linux development platform 2003
» Testing Applets with Netscape
» Jikes for Java the linux development platform 2003
Show more