Version 1. Read about the new features and fixes from April. WSL is a Linux environment within Windows that runs directly on the machine hardware, not in a virtual machine. We recommend this mode of WSL development , where all your source code files, in addition to the compiler, are hosted on the Linux distro. For those subjects, there are many good resources available on the Web.
|Published (Last):||2 December 2004|
|PDF File Size:||14.40 Mb|
|ePub File Size:||5.97 Mb|
|Price:||Free* [*Free Regsitration Required]|
The goal of CGDB is to be lightweight and responsive; not encumbered with unnecessary features. The interface is designed to deliver the familiar GDB text interface, with a split screen showing the source as it executes. The UI is modeled on the classic Unix text editor, vi. Those familiar with vi should feel right at home using CGDB. The library responsible for communicating with GDB is called gdbwire. Those wanting to develop other interfaces to GDB are welcome to use gdbwire as the basis for their program.
The CGDB user interface currently consists of two windows and a status bar. The source window is currently on the top and the GDB window is on the bottom. The status bar currently separates the two windows. The interface has several modes depending on which window is focused. Beginning with CGDB version 1. If you are a ncurses developer, and have spare time to work on this task, please contact me. The source window is the window that provides you a view of the source code that the debugged program is made up of.
It will display to the user a single source file at a time. While the user is debugging, via next and step , CGDB will update the source file and line number to keep you informed as to where GDB is debugging. This allows the user to easily navigate through the source file to look for certain places in the source code.
If you would like to see another source language highlighted, contact us. In addition to showing the source code, CGDB also displays to the user the currently executing line. The line number will be highlighted green, to represent that the particular line, is the current line being debugged by GDB.
Also, CGDB will display an arrow extending from the line number, to the source line. You can configure what type of display CGDB uses with the :set executinglinedisplay configuration option. By default, the longarrow display is used. As you navigate through the source window, the current line the cursor is on will be highlighted with a block. This simply helps you keep track of where you are in the file. You can configure what type of display CGDB uses with the :set selectedlinedisplay configuration option.
By deafult, the block display is used. Also, you can set or delete breakpoints in CGDB from the source window. Simply navigate to the line that you are interested in setting a breakpoint, and hit the space bar.
This will set a breakpoint on the line if one did not already exist. The line number should turn red to indicate that a breakpoint has been set. Hitting the space bar again will delete the breakpoint.
If you disable the breakpoint, the line number will turn yellow, to represent the disabled breakpoint. CGDB also supports regular expression searching within the source window. They are all available in GDB Mode. CGDB attempts to buffer commands the same way they would be if you typed them at the terminal. So, if you type several commands before a single one finishes, they will each be run in order. There will be no way to stop these commands from being run besides from typing Ctrl-C , like you would at any normal terminal when working with GDB.
The file dialog window is available to help the user view and select which file they would like to view. It provides the user with a list of all the files that make up the program being debugged. If there are no files available, because there is no program being debugged or because there is no debug symbols, then the file dialog will not open and a message will be displayed at the status bar.
You can get to the file dialog by hitting o when you are at the source window. Once you enter the file dialog, it is possible to leave it by hitting q. You can navigate the file dialog using the standard direction keys and you can even use regular expression to find your file.
This can save a lot of time as the number of files grow. The full list of commands that are available in the source window is in File Dialog Mode. The status bar is the general purpose way for CGDB to show the user which commands they are currently typing or report errors to the user when they occur.
Simply type : in the source window, and you will see the colon, and the rest of the command you type appear in the status bar. When you are finished typing the command that you are interested in, type enter. This will alert CGDB to execute the command. If at any point you would like to cancel the current command typed so far, type the cgdb mode key.
This will put you back into CGDB mode. For a description of the cgdb mode key, see Switching Windows. To change the focus to the source window, hit the ESC key. The cgdb mode key is the key that is responsible for switching the user into CGDB mode from a different mode.
The cgdb mode key is defaulted to the ESC key. To change this value, look at the configuration options for CGDB. The interface is now in CGDB mode. To switch back into GDB mode , press i. This syntax is based on the popular Unix text-editor, vi. CGDB can be controlled in a variety of different ways. Each mode that CGDB is in acts differently. Currently CGDB implicitly changes modes depending on which window is active. The following information will help you determine what commands are accessible during which modes.
When you are in the source window, you are implicitly in CGDB mode. All of the below commands are available during this mode. This mode is primarily available for the user to view the current source file, search it, or switch to a different mode. Puts the user into command mode. However, you are already in this mode. This is defaulted to the ESC key. Set a mark at the cursor position. A lower case letter sets a local mark that is valid within one file.
An upper case letter sets a global mark valid between files. When in GDB mode , the user is in command mode or scroll mode. When in command mode, the user is typing in commands to interact with GDB. When in scroll mode, the user can scroll through the GDB output. You can enter scroll mode by typing page up and quit scroll mode by typing q , i or enter. When in command mode, CGDB will pass along any other keys to the readline library. The file dialog is primarily used to allow the user to find and open a source file that the program they are debugging is made up of.
The file dialog will be full screen, and will list each file that the debugged program is made up of. A usual instance of the file dialog would be to open it up from the source window using the o key, and then to search for the file of interest. If you are looking for foo. There may be several features that you find useful in CGDB.
CGDB is capable of automating any of these commands through the use of the config file called cgdbrc. If it exists, CGDB executes each line in the file in order. It is as if the user typed in all the commands into the status bar after the tui was initialized. The following variables change the behavior of some aspect of CGDB. For example: :set ignorecase turns on case-insensitive searching; while :set noignorecase turns on case-sensitive searching.
If it is off, the file will never be reloaded, until you start CGDB again. The default is on. The file in this case will be updated to show the new version. Note, CGDB only looks at the timestamp of the source file to determine if it has changed. By default, the ESC key is used. It can also be any keycode, as long as the keycode notation is used.
This option is especially useful when the user wants to use readline in vi mode. This option is used to enable or disable color support in CGDB. When enabled, CGDB can display color when appropriate. This typically occurs when syntax highlighting source files in the source viewer. When disabled, CGDB will not display colors. It may instead use other terminal attributes for syntax highlighting, including bold and reverse attributes.
Using C++ and WSL in VS Code
Fred was a long-standing contributor to GDB and to Free software in general. We will miss him. GDB can do four main kinds of things plus other things in support of these to help you catch bugs in the act:. For more information, see Supported Languages. Support for Modula-2 is partial. For information on Modula-2, see Modula Support for OpenCL C is partial.
CGDB Manual 0.7.1
GDB: The GNU Project Debugger