# Anjuta IDE Manual

v1.0.0

Manual for the Anjuta IDE

Naba
Kumar
Andy
Piper
Biswapesh
Chattopadhyayr
Johannes
Schmid
2001-2002
2006
Naba Kumar, Andy Piper, Biswapesh Chattopadhyay
Johannes Schmid

Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.1 or any later version published by the Free Software Foundation with no Invariant Sections, no Front-Cover Texts, and no Back-Cover Texts. You may obtain a copy of the GNU Free Documentation License from the Free Software Foundation by visiting their Web site or by writing to: Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.

Many of the names used by companies to distinguish their products and services are claimed as trademarks. Where those names appear in any GNOME documentation, and those trademarks are made aware to the members of the GNOME Documentation Project, the names have been printed in caps or initial caps.

Manual d'Anjuta 2.1.0
2007

Johannes Schmidjhs@gnome.org

Còla d'Anjuta

## Introduccion

Anjuta is a versatile Integrated Development Environment (IDE) for the GNOME desktop. It features a number of advanced programming facilities that include project management, application wizards, an on-board interactive debugger, an integrated glade UI designer, integrated devhelp API help, an integrated valgrind memory profiler, an integrated gprof performance profiler, a class generator, a powerful source editor, source browsing, and more. is a versatile Integrated Development Environment

Anjuta DevStudio has been designed to be simple to operate yet powerful enough to fulfill all your programming needs. Many features have evolved since the early days and several very attractive ones added. Our focus is on delivering power and usability at the same time without overloading your senses and making your software development a pleasurable process. We will always be busy getting you one of the best IDE experiences by straighting up all the neat features and stabilizing it. We hope you will have a good time using Anjuta. If not, please help us make it better by reporting bugs and suggestions. Here are some of the things you will find in Anjuta.

### Anjuta in action

Anjuta in action

Anjuta has a very flexible and advanced docking system that allows you to layout all views in whatever way you like. You can drag and drop the views using drag bars and re-arrange the layout. The layouts are persistent for each project so you can maintain different layouts required by projects. All dock views are minimizable to avoid clutter in main window. Minimized views appear as icons on left side of main window. All menu actions are configurable either by type-in-the-menu (the usual GNOME way) or by a dedicated shortcuts configuration UI.

Please report any problems with Anjuta - this will help to improve the software, as well as helping the Open Source community.

## Getting Familiar with Anjuta

### Menuts e acorchis

At the top of the Anjuta main window is the menubar. Almost all of the functions are available by activating the appropriate menu item. The functions have been grouped according to their type. For example, the file operations have been grouped into the File menu.

#### Barra de menuts

La barra de menuts d'Anjuta

Most of the menus and submenus can be detached. Click on the detach bar (the dashed line just above the first menu item). Once the menu is detached, it will become an independent window.

#### File menu

File menu

Shortcut keys are available for many of the menu options. All of the shortcut keys are shown alongside the corresponding menu items. A useful reference to the shortcut keys which are not directly attached with the menu is also available in the next section. Some useful shortcuts are listed here.

- Switch Editor page: CTRL-TAB (forward) and CTRL-SHIFT-TAB (backward) -- The pages could also be switched by right clicking on the notebook tabs and selecting an editor tab (useful when all the tabs in the editor are not visible at once). Some desktop configuration may already have these shortcut keys assigned. In that case, you will need to reconfigure them (not in anjuta, because they are fixed) if you want to avail these shortcuts.

- Context Help: SHIFT-F1 -- Keep the cursor on the word (for example, the function name) for which you want to get the API help and press the shortcut. Context help only works if you have DevHelp installed. If you do not have DevHelp installed, the context help menu and toolbar button will be inactive. You can get it from DevHelp website. You will also have to install the related DevHelp books.

- Auto complete: CTRL-ENTER -- Press the shortcut with the cursor placed at the end of incomplete word and a list of words matching the remaining part will appear. Scroll and select the right word from the list if you find one.

- More shortcuts: Look for the shortcut keys displayed on right side of the menu item labels. They could also be changed as explained in the tip below.

#### Customize shortcuts

You can change the default shortcuts by using Edit Preferences and selecting the Shortcuts tab.

### Fenèstra principala

In the main window, there are several views which can be reordered by dragging on their title bars. They can also be minimized by clicking on the minimize buttons on the left of title bars.

1. The Documents window will have one document active at a time (if there are any files opened). All of the file commands will apply to this active document. You can switch to any page by clicking on the page tab. You can do the same by right-clicking on the page tabs and choosing the document from the pop-up menu that will appear. This is especially useful when you have a lot of files opened, but not all of them are visible in the page tab area.

2. The Project window shows a tree of the project files if you have a project opened. Otherwise, the Project window is usually hidden. Double-clicking on any item in the Project window will open that file.

3. The Files window shows a file tree. If no project is open, the file tree usually points to the file system root but you can change it in the preferences. If a project is open it shows all files inside the project. Double clicking opens a file in the appropriate application as configured in the gnome mime preferences. Right click opens a popup-menu which gives you choices how to open the file.

4. The Symbols window shows shows a tree of available symbols in the project generated from ctags parser. Double clicking opens an editor window with the corresponding file and line.

   There is also a Search tab in the Symbols window where you can search for symbols.

5. The Message window will list all the messages (both `stdout` and `stderr` outputs) when an external command is executed. The Message window is usually hidden, but appears as soon as an external command is executed, such as during file or project compilation, debugging sessions, searches, and many other operations. Anjuta also adds its own messages here when necessary.

   The colors used to display the messages are important. Messages displayed in the standard foreground color (usually Black) are normal messages. Those displayed in Blue are important messages such as errors or other information. Messages shown in Red are Hot Linked. Double-clicking on such a message will take you to the particular file and line number specified in the message.

   For example, when you compile a file which contains bugs, some red messages will appear showing what the problems are, and where they occur. Double-clicking on such messages will open the file and highlight the line containing the error.

6. The Terminal window is a terminal emulation where you can type commands just like in the gnome-terminal.

#### Gestion de session

All of the settings, including the window sizes and window positions, are saved when you exit Anjuta. Session management is still under development, so you should not exit Anjuta with any unsaved documents. Anjuta will display a warning if you try to exit with unsaved documents still open.

## File Operations

### Creating a New File and inserting texts

#### Crear un fichièr novèl

To create a new file, choose File New from the menubar, or click on the New File button on the toolbar. A new page will appear in the editor (or a new window if the parent document is windowed). This new document will be named `newfile#1`, `newfile#2`, `newfile#3` and so on.

##### Enregistrar lo fichièr

You should save new documents as soon as possible to avoid any data loss in case of a crash.

#### File Wizard

A wizard can also be used to create a new file. To create a new file, choose FileNew File from the menubar. This will open the New File Wizard dialog. Select the file type. Enter the File name. The suffix will be automatically added. You can add a license information (according to your license choice) and a header. In case of C-C++ header file, you can also add an header template. Click OK to validate the creation.

##### New File Wizard

The Open File dialog

Anjuta occasionally also creates new files during some operations. For example, some CVS operations, such as diff, file log, file status etc, create new files and add the output there. These could be saved in real file just like normal new files.

#### Inserir de macròs

Macros can be used to quickly edit repetitive sequences of text.

Macro plugin must be activated.

##### Inserir

Two types of macros are available: Anjuta macros and User macros (My macros). Anjuta macros are not modifiable by the user. On the other hand, User macros can be defined and modified by the user.

To insert macro, move the cursor at the desired place. Select EditMacros Macros.... The dialog window appears. Select the wanted macro in the list. The result of the macro expansion is displayed in the window and a summary is shown in the dialog window. Choose Insert. The expanded macro text is inserted at the cursor position.

Another possibility to insert macro is to select Edit Macros Insert Macro..., then to press the wanted macro shortcut.

###### Macrò

The Macro dialog

##### Defining Macros

From the Insert-Macro window, choose Add or select EditMacros Add Macro... . The Add/Edit window appears. Enter the macro name, choose or define a category and enter a shortcut. Then edit text relative to your macro. The character ' | ' will indicate the cursor position after the macro insertion. Choose OK. The macro is added to the list.

The user can also erase a macro by selecting it in the list (only My Macros) then by choosing Remove.

Same manner, macro can be edited and modified by selecting it in the list then by choosing Edit.

###### Apondre/modificar una macrò

Add Edit dialog

##### Macro Keywords

Macros Keywords are available. They can be integrated in the macro definitions. The names of these macro Keywords start and finish by the character ' @ '.

Available macro keywords are : @DATE_TIME@, @DATE_YMD@, @DATE_Y@, @USER_NAME@, @FILE_NAME@, @FILE_NAME_UP@, @FILE_NAME_UP_PREFIX@, @EMAIL@, @TABSIZE@, @INDENTSIZE@, @USETABS@.

###### Keyword Macro

The Keyword macro

### Opening and Saving Files

1. Opening a file: To open an existing file, choose File Open from the menubar, click on the Open button on the toolbar, or press CtrlO. This will display the Open File dialog.

   #### Open File dialog

   The Open File dialog Select or enter the file you want to open, then click Open. To open more than one file at once, select multiple files to open by first pressing CTRL and clicking the files in the list and press Open. If you change your mind, click Cancel to dismiss the dialog without opening the file.

   For selecting multiple files at once, select a file in the dialog and press CTRL once. This will bring the file selection dialog in multiple-select mode and multiple files could be selected from the list. Multiple file select mode is similar to single file select mode, except that the file operation (for which the file selection was being done) will be performed for all the selected files.

   #### Open Multiple File dialog

   The Open File dialog in multiple-select mode

   The Show Hidden Files, if switched on (Click right), will make the hidden files (files starting with "."; visible in the file list. Depress it to make them hide. Anjuta file selection dialog also has inbuilt file type filter. Select the appropriate file type filter in the dialog and the file list will be limited to the files of the selected type only.

2. Saving a file: To save a file, choose File Save from the menubar, click on the Save button on the toolbar, or press CtrlS. This will save the file. If the file is new, a Save As dialog will appear. Enter a filename and click Save to save the new file with the name supplied. The Save As File

   #### Enregistrament automatic de fichièr

   If you have enabled auto-save, it will not auto-save any new files. You must first save them manually. The same applies to the Save All option: it will not save new files, if you haven't saved them first manually. You must save a file manually before auto-save or Save All will work with it.

3. Saving a file with a different name: You can explicitly save a file with a new filename. To do this, choose File Save As from the menubar. A Save As dialog will appear prompting you to enter the new filename. Enter the name and click Save.

   #### File save as overwrite

   When you use Save As with an existing file, the original is not deleted. It is left unchanged since the last save. If a file with the new filename already exists, a confirmation dialog will appear, to ensure that you want to overwrite it. Clicking Yes will overwrite the file with the file you are saving.

4. Closing a file: To close a file, choose File Close from the menubar, or click on the Close button on the toolbar. The file could also be closed by clicking the cross in the filename tab. This will close the current file. If the file is not saved, or is a new file, then Anjuta will prompt you to save the file before closing it.

### Modificar de fichièrs

Anjuta has a number of helpful features which aid in editing and working with source files. The following sections describe how to use some of the interesting features available.

#### Editor Margins

Editor Margins: Editor margins are the small area on the left of the editor for some special purposes. There are three editor margins available and all of them may not be available when you first start anjuta. They are Line numbers margin, Markers margin and Code fold margin. By default (that is, when you run anjuta for the first time) only the code fold margin will be visible. The rest could be made visible from View Editor.

##### Editor Margins

The Tags toolbar

The Line Numbers Margin is largest of all the three margins (and slightly darker then rest) and displays the document's line numbers. Line Number Margin could be made visible or invisible by toggling View Editor Line Numbers Margin. Single left clicking on this margin will select the whole line (including the last newline, if present). You can set the font properties for line number margin in the preferences.

Markers Margin is the next margin which can be made visible or invisible by selecting View Editor Markers Margin. This margin displays graphical icons to mark the given line. The markers which will be displayed in this margin are Bookmark marker (rectangular blue colored icon), Breakpoint marker (circular red colored) and Line indicator (pointed arrow yellow colored). Bookmark marker is used to indicate bookmarked lines which could be toggled from Goto Bookmark Toggle Bookmark with the cursor placed in that line. The breakpoint marker is used in debugger to mark the line with debugging breakpoints (see debugging section for more details). The line indicator marker is used to indicate a line when we do a jump from another part, for example when navigating the bookmarks and during single stepping in debugger.

Code folding margin is where the folding tree is visible. Clicking on these folding tree nodes will fold or unfold the code blocks. An underline will also be drawn below the folded line to make it more obvious that a block of code has been folded below the line. For more details on code folding, see the section Code Folding below.

##### Invisible margin marker

If the marker margin is not visible, the markers will be displayed by changing the background color of the line. For example, if there a breakpoint marker is set in a line and the marker margin is not visible, that line will be displayed with red background. Similarly, for bookmark marker and line indication marker, the background color of the line will be sky blue and yellow, respectively. If you do not like this (perhaps due to some contrasting themes), enable the Markers Margins from View Editor Markers Margin.

##### Editor markers when markers margin is invisible

The Tags toolbar

#### Editor Guides

The editor could be made to make certain document information, which otherwise are normally not visible. Indentation guides, white spaces and line end characters are such information which could be made visible for editing comfort. They could be make visible or invisible by toggling the menu items in View Editor. Indentation guides are the small dotted lines drawn to connect the matching braces in the source code. When the cursor is over one such matching braces, the dotted indentation guide is highlighted to give a visual region of the indentation.

##### Editor with guides

Editor with guides

#### Syntax highlighting

Anjuta can highlight many different languages. This is usually done automatically by determining the type of the file from the file extension. If Anjuta cannot determine the type of the file, there will be no syntax highlighting. You can explicitly force a particular highlight style by selecting the style from the menu View Editor Highlight Mode.

#### Code folding

Source files which have block coding properties (such as C, C++, Pascal, Java etc.), have the advantage of working with code folds. All of the code blocks in the source file can be folded or unfolded by clicking on the fold points in the fold margin of the Editor window (usually a +/- symbol or up/down arrow). These fold points automatically appear for source files which use code blocks.

Code folding is especially useful when editing big source files that run to thousands of lines. Once the folds are closed, the document appears to become smaller, facilitating easy browsing and editing of the file.

Please note that code folding and editor guides are only available in the scintilla based editor.

#### Auto-formatting source code

If the current file is a C or C++ source or header file, then it is possible to automatically indent (auto-format) the file. This gives a clean look to the source code, increases legibility, reduces the likelihood of syntax errors, and above all it saves time. This can be performed by choosing Edit Auto Indent on the menubar. Change the style of formatting by customizing the choices in the preferences.

### Symbol browser and Browsing Files

All C and C++ source and header files can be browsed using the tags in the files. All of the open C and C++ source and header files are scanned for available tags (a "tag" refers to a function definition, structure, macro, etc.). Please note that Tag and Symbol is used synonymously in this manual, except when referring to Tags browser and Symbol browser, which two different interfaces.

1. Tags Browser: Tags browser is available on the Browser toolbar. It shows a list of tags available in the currently active file (source file). If there is no tags (or symbols) available in the file, the tags list will be invisible and a "No Tags" will be displayed instead. The tags in this list are shown along with the line numbers where they are found. If there are multiple symbols with the same name, they will be shown with different line numbers.

   #### Tags toolbar

   The Tags toolbar

   #### Function symbols

   Function prototype and definition, if present in the same file, can be usually distinguished from the corresponding line numbers. Prototypes usually comes before the definition, so they are likely to have smaller line numbers.

2. Symbol Browser: If there is a project open, Anjuta will scan for tags in all of the source and header files of the project. This way it is possible to go to any function definition, structure definition, class definition etc. without manually opening the file. You don't even have to know which file that tag is found in (except in the case of function definitions). The symbol browser lists all the available symbols in the project.

   #### Tags toolbar

   Symbol browser

#### Tags synchronization

You don't have to worry about the synchronization and update of the tag database. Anjuta will take care of everything. You just have to decide which tag you want to go to!

### Searching for and Replacing text in files

#### Recèrca

To search for a text or regular expression string in the current file, choose Edit Search Find or press CtrlF. This will open the Find dialog.

Use the text box to specify the string to search for, and select whether it is a normal string or a regular expression (RegExp). It is also possible to specify the direction of search, whether the search is case-sensitive or not, and the scope of the search. Click Search to start searching.

If the search is successful, the matched text in the document will be highlighted, marked... (according to the search action choice). If the search is not successful, a The match "search text" was not found message will be displayed.

If you want to search again, click on the Search button on the main toolbar or press CtrlG. This will find the next match (ShiftCtrl G for the previous match). You can even change the search text when you do this. Enter the new string in the Search Expression text box in the main toolbar.

##### Search Text dialog

To stop a long research, choose Stop button.

If the "Basic Search" option is selected in the Setting window, the search direction can be chosen from the Expression window.

##### Basic Search Text dialog

#### Specifying Search Range

In the "Search Target dialog", define the search location and the action to be done in case of search success.

The maximum number actions can be defined by User.

##### Search Target dialog

The user can select where the text will be searched.

##### Search Target In choice

##### Searching in Files

To find text in your project, select "search in" All Project Files.

Enter the text you want to search and specify search options (case-sensitive, complete words ...). Click Search to start searching.

To find text in File list, select "search in" Specifying File List. Define the Search variables. Click Search to start searching.

###### Search File Pattern

#### Specifying Search Action

The user selects which action will be done in case of search success.

According to the previous selections (Search in, Search direction ...), some actions could be unavailable.

##### Search Target Action choice

#### Replacing

Search and replace is similar to just finding text, except that you also specify the replace text in the Replace With: text box, and whether or not you want to be prompted before the replace takes place (Replace First Match or Replace All Matches).

##### Replacing

Choose Replace to replace the matched text or Forward to jump to the next matched text.

#### Search Setting

The user has the possibility of saving the setting of his search options.

Item highlighted in red is the active item. Item by default is the search setting which is loaded at Anjuta launching.

##### Search Setting dialog

### Estampar un fichièr

Print preview could be taken by selecting File Print Preview. It will render the current file and present a preview of the print. Source codes which are highlighted in the editor are also highlighted similarly in the print (or preview). Additional options are available to print with the line numbers, wrapped lines and/or headers in the Printing tab of your editor plugin preferences.

#### Print preview of a C file

Previsualizacion de l'estampatge

#### Preferéncias d'estampatge

Preferéncias d'estampatge

When you are ready to print and satisfied with the preview, select File Print or Print from the print preview window. This will bring up the actual print dialog as shown below. Select the appropriate print parameters and print the file with Print on it.

Landscaped or portrait page layout, paper size, page orientation and paper type could also be set. Remember to set them up properly according to your printer, otherwise printing may not come up properly.

#### Print Dialog

Print Dialog

## Gestion de projècte

Anjuta has a powerful Project Manager plugin which can open most automake/autoconf based projects. It might fail on some oddly configured projects, but as long as the project is done by using automake/autoconf in a typical way, it should work.

The neat thing is that it does not store any project information beyond what is already available in project structure. That is, there is no separate project data maintained by Anjuta and all project processing are done directly within the project structure. This allows the project to be maintained or developed outside Anjuta without having to so-called 'porting' or 'switching' to a new platform. Since technically Anjuta projects are just automake projects, mixed development of it (Anjuta and non-Anjuta users) or switching back and forth between Anjuta and other tools is quite possible without any hindrance.

### Crear un projècte novèl

#### New project from template

The project wizard plugin uses a powerful template processing engine called autogen. All new projects are created from templates that are written in autogen syntax. Project wizard lets you create new projects from a selection of project templates. The selection includes simple generic, flat (no subdirectory), gtk+, gnome, java, python projects and more. New templates can be easily downloaded and installed since they are just a collection of text files.

Choose the menu item FileNew Project … to start the application wizard. Read the first page carefully. Click on Next to proceed.

Select the type of application you want to create in the second page. Click on Next to proceed.

On the next pages, enter all necessary details for your project. You can change these settings later also, but it is advisable to put them right in first run to maintain the project's integrity. White spaces or any non-alphanumeric characters, except underscore (_) and dash (-), are not allowed in many of the entry boxes that would follow (except perhaps the Author text box).

You can also specify whether your project will have internationalization support using gettext (read the gettext info page for more details). This gives your project multilingual support for different regional languages such as English, French, Dutch etc.. The rest of the options are for setting whether the GNU copyright statement should appear in the comments at the top of each file, and enabling GNOME desktop menu information if necessary. Shared library support allows adding shared library modules later in the project. If you plan to have libraries in your project, it would be good to enable. Depending on the project type that is being created, there would be other information requested.

The final step is to verify the information you have just supplied. Click on Finish to start generating the project.

Once project generation is over, you can try it out by building the project and executing it.

#### Importar de projèctes

The import project feature is used to import an already existing project and convert it into anjuta project. Activate the import project wizard from FileNew Project from existing sources and follow instructions dictated by the wizard. Once the project is imported, it could be opened in anjuta subsequently just like any other anjuta project.

The import project features only works if your existing project is using autoconf/automake and, to a very limited extend, plain makefiles.

### Loading and Saving Projects

#### Loading Projects

To open a project, choose the menu item File Open …. Select the project file (`*.anjuta`) in the dialog and click OK.

If the project has recently been opened, then you will find it listed in the menu FileRecent. Choose the project file from the list, and the project will be opened.

As soon as a project is opened, Anjuta will enter Project mode. There are three panes in the project window. The first is the project pane and lists the project files organized in file types. The second is the symbol browser, which has already been discussed in section Symbol Browser and tags Browser. The third pane is the file view of the project and is more or less similar to a mini file-manager. In file view, all the files present in the project tree is visible. Right clicking on these files will pop up the file Operation menu.

If the project is also a CVS tree, then corresponding file revision numbers are also listing on the right of file names in the file view pane.

#### Enregistrar de projèctes

The project is automatically saved when you close because all changes are made directly in the project structure.

### Estructura de projècte

Here is the Project window with the the Operation menu (accessible by clicking on the right mouse button).

#### Project window

The Project window

Project window lists the project in standard automake hierarchy organized into groups of targets. Groups correspond to directories in your project and targets correspond to normal automake targets (not to be confused with make targets). Project window actually has two parts; one part (lower one) shows complete project hierarchy and the other part (upper one) lists important targets directly. Important targets constitute executable and library targets -- making them very accessible in from the view. This is particularly useful in big projects where the hierarchy could be deep and hard to navigate from the tree alone. Targets are, in turn, composed of source files.

- Groups are used to logically organize targets. A project can contain any number of groups. Each group can have sub-groups as well as targets. In automake projects, groups are just sub-directories in the project. The top level group is called root and is always "/".

- Targets are the build targets in project, such as programs (executable binaries), scripts, libraries, miscellaneous data etc. Not all target types are built from sources, but exist just to organize the sources and therefore may not exist physically (e.g. Miscellaneous data target). Targets exist under groups. See "Adding targets" for full list of available target types.

- Source files are the files used to build the targets or just to be part of it. They exist only under targets. Many target types expect certain type of source files (e.g. programs and libraries target types), but some can accept any file (e.g. Miscellaneous data target).

Each of the project groups and targets is configurable in standard automake way. You can set complier and linker flags directly for each target, or set configure variables. Groups allow setting installation destinations for its targets.

Just like file manager, project manager view also has convenience actions (accessible from the Operation menu) for the source files and targets.

Many command-line tools are available to maintain and manage a project, and each tool has its own specific rules and capabilities. Anjuta tries to automate most of the common operations using plugins. However, you might occasionally still need to do them manually.

It is possible to make use of other tools or hand edit the project files simultaneously. It doesn't matter if the project is loaded in Anjuta or not. Anjuta would update itself with any external changes made to project.

### Groups and targets

#### Apondre de grops

To add a new group (a directory in automake based projects):

- Select Project Add Group and a dialog to add a new group would popup.

- Select the group under which to add new group.

- Give a name of the new group and click Ok.

With automake projects, a new directory with the given name would be created under the parent group's directory.

New group can also be added from the Operation menu in Project window by selecting Add Group. First select the group under which to add the group in Project window.

#### Suprimir de grops

To remove a group:

- Select the target in Project Manager view.

- Select Remove from the Operation menu.

The target and sources associated with the group will also be removed from the project (they are not deleted from the file system, though. You can still add them later).

#### Adding Targets

To add a new target:

- Select Project Add Target and a dialog to add a new target would popup.

- Select the group under which to add the target.

- Select the target type.

- Give a name of the new target and click Ok.

New target can also be added from the Operation menu in Project window by selecting Add target. First select the group under which to add the target in Project window.

Target names usually require some standard prefix and suffix, depending on the type of target. Anjuta would warn if the name is not valid and may give an example of a name.

There are several target types for automake project. They are:

- Program target type is for executable binaries. Select this if you want to add an executable to the project. By default, all program targets would be installed in standard executable directory, e.g. /usr/bin or /usr/local/bin. You can override it by specifying a different installation directory in its group properties.

- Shared Library target type is for shared or dynamic libraries. Select this if you are adding a shared library to the project. By default, all shared libraries are installed in standard libraries directory, e.g. /usr/lib or /usr/local/lib. You can override it by specifying a different installation directory in its group properties.

- Static Library target type is for static library. Select this if you are adding a static library to the project. By default, all static libraries are installed in standard libraries directory, e.g. /usr/lib or /usr/local/lib. You can override it by specifying a different installation directory in its group properties.

- Java module target type is for java module. Select this if you are grouping java sources into a module. You need to provide an installation directory for this target where the .class files will be installed. It can be set in group properties of the group where this target belongs.

  There can really be only one java module in a group. This is a restriction put by automake. Please read automake info page for more details.

- Python module target type is for python module. Select this if you are grouping python sources into a module. You need to provide an installation directory for this target where the sources will be installed. It can be set in group properties of the group where this target belongs.

- Scripts target is to group scripts. They will be installed in standard executable directory.

- Miscellaneous Data target type is to group simple files in the project. An installation directory needs to be specified in its group properties.

- Header Files target type is to group C/C++ header files that need to be installed in system (for example as part of library API). For header files that do not need to be installed, make them part of the Program target along with the sources. They will be installed in standard include directory unless installation path is specified in its group properties.

- Man documentation and Info documentation target types are for grouping man and info documentation respectively. By default, they will be installed in standard installation directories.

#### Removing Targets

To remove a target:

- Select the target in Project Manager view

- Select Remove from the Operation menu.

The sources associated with the targets will also be removed from the project (they are not deleted from the file system, though).

### Adding and Removing Files

#### Adding Source Files

Select menu item Project Add Source File. From the dialog, select the target to which the file should be added and the file itself. You can add multiple files at once. To do that, select multiple files from the file selection dialog using either SHIFT or CONTROL key. Then click Add button to finally add the files in project.

By default, current editor file would be preselected for addition in the dialog. Other convenient way to add a file is to select it in File Manager and choosing Add to project from the Operation menu.

If the file you choose has already been added to the project, then Anjuta will not add it again. It will also give you a warning that the file is already added.

If the file you choose is not in the project directory, you will be asked to confirm that you wish to copy the file into the target's directory. Anjuta cannot add files which are outside of target's directory.

#### Removing Source Files

To remove a file from the project, select the file you want to remove from the Project window, right-click to open the Operation menu and choose Remove.

A confirmation dialog will appear, and the file will be removed from the project.

##### Lo fichièr es pas suprimit !

The file is not deleted from the filesystem. It still exists, and you can add it back again later if you so wish. The file is only removed from the project listing, and will not take part in any of the project operations such as compiling, building, distribution etc..

### Configuracion del projècte

Project configuration involves setting the correct build flags for targets, groups and project itself. You can set these flags in their respective properties dialog.

You can freely use autoconf and automake variables that are automatically set for the project during configuration. Apart from these automatically set variables, you can also defined your own variables in Project Properties use them in properties. This will make it easy to update flags later, especially when the variable is used in several targets.

Some of the many common variables are listed here. For full list of them see automake info documentation.

- $(prefix): The installation prefix. The project is installed under various sub-directories under this prefix. By default it is /usr/local.

- $(bindir): The installation directory for executable binaries. All your executable and scripts targets would be installed in this directory. By default, it is $(prefix)/bin.

- $(libdir): The installation directory for libraries. All your library targets (both shared and static) would be installed in this directory or a subdirectory below it. By default, it is $(prefix)/lib.

- $(module_CFLAGS) and $(module_LIBS): These flags are set by configure for the packages that your project depends on. The packages used by the project are set in Project Properties. 'module' is the packages group that you give in project properties.

#### Propietats del projècte

Project properties dialog can be only brought by choosing Project Properties. You can:

- Set project name, version and URL in General page. Configure variables can also be use in these fields. The URL is the bug report URL for the project.

- Add and remove dependencies for your project in Packages page. See below for details.

- Create more configure variables in Variables page to use in group and target properties.

Dependencies are external packages that the project uses and hence required to build it. Only packages installed using pkg-config can be added from this interface. For others, the configure.ac file can be edited manually.

##### Project properties dialog

Project properties dialog

External package dependencies are grouped into modules, so that their combined build flags can be conveniently added to different targets. Modules are just arbitrary names given to group the packages and can be named anything (only alphanumeric and _ are allowed in module name). Usually, they follow the name of targets they would be use in. Consequently, for small projects with single targets, just one module to hold all dependencies is enough.

Each package exports a set of compiler flags and libraries. They are aggregated together for all packages under a module and configure variables $(module_CFLAGS) and $(module_LIBS) are defined. These variables can then be used in Group properties and Target properties.

To add a package dependency:

- Select Project Properties to bring up project properties dialog.

- Select the tab Packages to bring up packages page.

- Select the module to add the package to. If there is no module created yet or there is no appropriate module, create one by clicking Add module. Give a sensible name to the module, preferably in UPPERCASE to match with rest of configure variables (only use alphanumeric and '_' characters) and press Enter to create it.

- Click Add Package to bring up package selection dialog.

- Select the package to add and click Add.

- Click Close to close the properties dialog.

#### Propietats del grop

To set group properties, select it in the Project window and active it. You can also bring it by selecting Operation menu Properties

Group Properties set to a group applies to all the targets under it. So any compiler or linker flags set there would be automatically be part of all the targets in it (in addition the targets individual properties). Following flags are available in group properties.

- Includes: Set your $(module_CFLAGS) variables and other include directories for your c and c++ targets. You need to provide the full include options of the compiler here, e.g. -I/usr/include/blah. The include paths will be use to find the include files in your source files. You can also add other sort of compiler flags here, but they are preferred to be set in their respective compiler flags properties (see below).

  Usually your configure script would also make some automatically determined compiler flags. The variables usually end with _CFLAGS, e.g $(PACKAGE_CFLAGS). They are also set here. See setting Project properties for more details on these variables.

- Compiler settings: Set your compiler specific flags here. There are different fields for different compiler categories. Flags that can be set here depend on the actual compiler used. The default compiler use for c/c++ is gcc/g++ (gnu c compiler). Check out gcc info documentation for more details.

- Install directories: Targets in the group that require installation directories would each get a field to enter the installation directory. Set their installation directories as relative to one of the many automake directory variables, such as $(prefix), $(bindir), $(libdir), $(datadir) etc.

#### Target properties

To set target properties, select it in the Project window and active it. You can also bring it by selecting Operation menu Properties

Target Properties set to a target applies to that target. So any compiler or linker flags set there would be just part of it (in addition the its group properties). Following flags are available in target properties.

- Compiler settings: Set your compiler specific flags here. There are different fields for different compiler categories. Flags that can be set here depend on the actual compiler used. The default compiler use for c/c++ is gcc/g++ (gnu c compiler). Check out gcc info documentation for more details.

- Linker flags: Set linker flags that should be used when linking the target. It applies only to Program and library targets. See ld info documentation for available linker options.

- Libraries: Set the libraries that the target depends on. Usually they are the $(module_LIBS) configure variables. See setting Project properties for more details on these variables.

### Compiling and Building

#### Overview

An executable for a project is generated in two steps:

1. Compiling

2. Linking

These steps are collectively known as Building. Some other steps may also be involved in the build process, but for the sake of simplicity, we will only look at these two steps.

Compiling is the step in which object files are generated from their corresponding source files. For instance, a source file `hello.c` will generate `hello.o` after compilation. Usually you do not need to worry about these object files — just think of them as intermediate files involved in creating the final executable.

Once the object files (`*.o` files) are ready, they are all linked together (along with any libraries) to generate the final executable. This step is called Linking.

#### Compiling the source

In a project, the individual source files can be compiled separately into objects (`*.o` files). Although you do not have to worry about these object files, sometimes it is handy to compile a file first (for example, to make sure there are no syntax errors). Building a whole project can take a lot of time, especially in the case of larger and more complex applications. Therefore, you will probably go through a series of edit-compile-edit-compile-.... loops while a developing the project.

To compile a file, choose the menu item Build Compile or press F11. This will compile the active file.

#### Building an executable

Anjuta has no separate link command, simply because it is not necessary. The build process will compile all the source files and link them together along with the libraries. The build command will note recompile those files which are already up-to-date (this is called the dependency check). If you have already compiled all of the files individually, then the only thing the build step performs is the link. If you have already built the project and no dependent file has been modified, even the link stage will be skipped.

So how exactly does the dependency check influence the project development? If you have modified a file, then all of the source files that depend on the modified file are recompiled. All files (not only the object files and executable) in the project are checked for these dependencies during the build process. If it is found that a particular file is dependent on some other file which has been modified, then that file will be re-generated.

Since you have now got a rough understanding of the value of the dependency check, can you imagine how your life (as a programmer) would be if it had not been there? If you cannot answer just yet, then will find out when you start developing big projects!

Build Build will build all of the files in the `src` (source) directory, and generate the executable. Build Build Project will build the whole project — all of the subdirectories (including `src`), are built recursively.

#### Creating a distribution package

To build the tarball distribution of the project choose Build Build Tarball. This will create a tarball (`*.tar.gz`) and put it in the top level project directory. Copy the file to a safe place for distribution.

#### Installar

Choosing the menu item Build Install will install the generated application on your system.

##### System wide installation

You must be logged in as root to perform a system-wide install. Also note that for a GNOME application to use the pixmaps in the project, it must be installed as a system-wide application. Otherwise, when the application is executed in your project, there will be lots of "pixmap not found" errors. You can configure anjuta to use `sudo` or `su` before installing the project in the build preferences.

#### Configurar

To run the `configure` script found in the top level project directory, choose the menu item Build Run Configure…. The script will determine the system configuration and create some of the files required to perform a build (such as `Makefile` and `config.h`). This is necessary because the application may depend on specific configuration of some of these options.

##### When to run configure

Until you run `configure`, you cannot start building the project.

The `configure` script is (usually) run only once at the beginning of the first build process — for example, just after you have extracted a source tarball of a project distribution. After that, configuration is automatically handled by the subsequent build processes. If you have used the Application Wizard to create the application, then you will not need to run `configure` separately: the wizard will run it as a part of the project generation process.

You can also supply additional options to the configuration script. After choosing the Run Configure… menu item, a dialog will appear to prompt for additional options.

##### Configure options dialog

Configure options dialog

Enter any options (or leave it blank to accept the defaults) and click OK. To find out the options available to the `configure` script, enter `--help` in the option entry box and click OK. The options will be displayed in the Message window.

There is no requirement to run `configure` only once. It can be run at any time, usually when the configuration options need to be changed. One thing to note is that, if the `config.h` file in the top level directory is changed, running `configure` again will not overwrite it.

#### Auto generate

Auto generation consists of two steps: running automake and then running autoconf. If an executable `autogen.sh` script is found in the top level project directory, this file will be executed instead of the two steps. Like configuration, auto generation is automatically handled by the build process. It can also be run in cases where it is difficult to configure the project (such as lots of errors reported due to mis-synchronization after modifying lots of build files).

##### When to run autogen.sh

Unlike configuration, auto generation does not need to be run even once — in fact, it does not need to be run at all! The option is available because it can be handy in some circumstances.

Choose the menu item Build Run Autogenerate… to auto generate the project.

Read the info pages of automake and autoconf for more details on how these tools work.

#### Clean

This option cleans the project and leaves it in a state that requires Build Project to be performed. It deletes all of the files generated by the build process, including all object files (`*.o` files) and the executable(s) in the `src` directory (and other directories).

Choose the menu item Build Clean to clean the project.

#### Clean Project

There is not a great deal to say about Clean Project (which might also be called Clean distribution, or clean dist for short). It cleans the project and leaves it in a state that requires Run Configure… and Build Project to be performed. It deletes all of the files generated by the build processes, including all the object files (`*.o` files), executable(s) and Makefiles. In other words, it leaves the project as though it has just been extracted from a distribution tarball.

Choose the menu item Build Clean Project to completely clean the project.

### Executar un programa

Once an executable is ready after the build, you can execute it by choosing the menu item Build Execute, or pressing F3. You can specify which executable you want to use in case your project provides more than one and specify command line arguments.

#### Dependéncias

Unlike the build stage, execution doesn't check for dependencies (at least for the time being). In other words, it does not check if the executable is up-to-date before it executes the program. So, you must take care of that yourself.

#### Choose executable and set program parameters

Setting program parameters

## Debugging

To debug is human. To fix it is divine...

Well, the human part is what this section is about. The divine part is up to you!

When a program does not behave in the way it is supposed to, we say the program contains a bug or bugs. This does not refer to compilation errors — those are simply errors and they are relatively easy to clear, because the compiler tells you where the problems are. On the other hand, bugs are errors that happen during the execution of the program and they can be hard (sometimes very hard!) to detect.

Any program that you think is bug-free is never completely bug-free. All we can try to do is to reduce the number of bugs contained in the program. The process of removing bugs is known as debugging, and the tool that is used for debugging is called the debugger. Anjuta provides a very user-friendly and powerful debugging environment (actually, a GUI wrapper over gdb, a powerful command line debugging tool and standard on Linux).

A debugger tracks and traces the execution of the program and provides various views of information needed to study the execution of the program.

### Start and stop

The debugger is always started with a program loaded. There are two ways to do this:

- Running an executable

- Attaching to a process

#### Running an executable

Choose the menu item Debug Run Target… to display a dialog box where you can select:

- The program that you want to debug
- The command line parameters
- If you want a terminal or not (the Anjuta terminal plugin is used)
- If you want to stop the program at the beginning or not

The drop-down menu of the target drop-down combination box is already filled with all executables of the current project. But you can select another executable not part of the project. The debugger accepts libtool executable, it means script,generated by libtool, wrapping the real executable. Note that an URI is expected here, not a file path even if the debugger currently supports only local files.

When you have set everything you can click on Execute to start the debugger, load your program and stop at its beginning if requested.

In order to better user the debugger, it is strongly recommended to debug program with debugging information (-g for gcc) and no optimization (-O0 for gcc).

#### Attaching to a Process

It is also possible to attach to a running process and debugging it by choosing the menu item Debug Attach to Process …. A list of all the process running on the system will appear.

##### Attach to Process dialog

Attach to Process dialog

Select the process to attach to and click OK to start the debugger, attach to the selected process and stop it.

It is currently not possible to load symbol informations for the attached process. They should be included in the process.

#### Restarting an executable

After running an executable at least one time, you can choose the menu item Debug Restart Target to restart your program. It is just a shortcut that will stop the debugger if it is currently running and restart it with the last executable without displaying the start dialog.

#### Stopping the Debugger

Choose the menu item Debug Stop Debugger to stop the debugger. This option will kill the program which is being debugged. If the debugger has been attached to a running process, it will just detach from it without killing it. You will get a confirmation box if a program is currently attached or running.

#### Adding source directories

Choose the menu item Debug Add source paths… to display a dialog box allowing you to add and remove source directories.

Most executables include full file paths, so defining the directories where are the source files is not useful. But some executables include only file names without paths, in this case, the source files will be searched in all these directories by the debugger. The directories order can be important if several files have the same name, so you can change it using the Up and Down buttons. The directories list is send to the debugger when it is started. After changing it, you need to restart the debugger to take it in account.

### Execucion

Execution of a program in the debugger can be finely controlled. The program can be executed in single steps, or allowed to continue until it encounters a breakpoint. Executing like this is essential for tracking program behavior. Like a video editing session, the program can be executed in slow motion with the ability to go forward, pause, stop, and so on. You cannot go backward yet though.

The methods those can be used to execute a program in the debugger are described in the next sections. These commands are available only when the program is already started.

#### Single stepping (step in)

Choose the menu item Debug Step In or click on the Step In icon in the Debug toolbar to step into a program.

Single stepping executes only one statement of the program (from the place where it has stopped) and then returns control. If the statement that is executed contains one or more functions, the debugger tries to step inside the functions (in the sequence in which the functions are executed). Once the statement is executed and control is passed back, it is possible to study the various program parameters.

If the Disassembly window has the focus when this command is selected, it executes only one assembler instruction.

#### Single stepping (step over)

Choose the menu item Debug Step Over or click on the Step Over icon in the Debug toolbar to step over statements in a program.

Step over is similar to step in, except that it does not step inside any function in the statement being executed. The statement will be executed in one go.

If the Disassembly window has the focus when this command is selected, it executes one assembler instruction but does not stop inside if this instruction is a call to a subroutine.

If a dynamic library is loaded during the step, the program will not stop at the end of the step. But it will run until it finds a breakpoint or you stop it.

#### Single stepping (step out)

Choose the menu item Debug Step Out or click on the Step Out icon in the Debug toolbar to step out in a program.

Step out will execute the current function until it returns. The program will be stopped once it exits from the function. Step out is not really single stepping, because it does not only execute a single statement — it executes the whole function until that function returns to the calling function.

#### Run/Continue

Choose the menu item Debug Run/Continue or click on the Run/Continue icon in the Debug toolbar to continue the execution of a program.

This option continues the execution of the program until a breakpoint is encountered, or the program exits.

#### Run To

Choose the menu item Debug Run to Cursor or click on the Run to Cursor icon in the Debug toolbar to run until the line at cursor is reached.

This option continues the execution of the program until the line or the address (if the Disassembly window has the focus) where the cursor is reached.

#### Stop Program

While the program is running and has control, no debugging tasks can be performed. To obtain control while the program is running, choose the menu item Debug Pause Program or click on the Pause Program icon in the Debug toolbar. This will interrupt the program and return control to the debugger.

### Breakpoints

When debugging a program, it is useful to be able to stop the execution of the program at a particular point, so that the state of the program can be examined at that location. Breakpoints enable this to happen. Breakpoints can be set at different locations in a source file and then the program is allowed to run. When a breakpoint is encountered, the execution of the program is suspended, enabling expressions to be evaluated, variables to be inspected, the stack trace to be studied, and so on.

#### Listing Breakpoints

The Breakpoint list window can be opened by choosing View Breakpoints

##### Breakpoint view

Breakpoint view

The view has the following columns:

Location

  This is the position of the breakpoint in the source file. When the breakpoint is set by the debugger, you can get additional information like the function where is the breakpoint.

Address

  This field is filled with the address of the breakpoint when it is set by the debugger.

Type

  This displays always "breakpoint". It will be used in a next version supporting different kind of breakpoints.

Condition

  This is the breakpoint condition, it is empty if no condition is defined.

Pass count

  When the debugger is not running, this column displays the pass count of the breakpoint, zero if it is not defined.

  When the debugger is running, if pass count is zero, this column displays the number of time this breakpoint has been triggered. If pass count is not zero, both numbers are displayed. The pass count is the second number.

State

  This is the state of the breakpoint. You could have.

  - Pending: breakpoint is not set in your program.

  - Permanent: breakpoint is set (id number in given inside the parenthesis).

  - Temporary: breakpoint is set but will be deleted if reached.

All breakpoints are kept across anjuta session even if they correspond to a non existing place. In this case their state are set as pending.The interface try to set them each time the program is started or a new dynamic library is loaded.

#### Adding or Setting Breakpoints

Choose the menu item Debug Add Breakpoint… or Add Breakpoint… in the breakpoint list popup menu to open the add breakpoint dialog.

##### Breakpoint add dialog

Breakpoint add dialog

You need to enter the location and optionally, the break condition and the pass count then click OK to set the breakpoint.

Location

  Enter the location at which to set the breakpoint. It has to be specified in one of the following formats:

  1. File_name:Line_number

  2. Function_name

  3. File:Function_name

  The first one is obvious — The location refers to the line number Line_number in the source file File. The second refers to the first line of the function Function_name. The third is similar to the second, except that this notation is used where there is more than one function with the name Function_name in the program. It is possible to differentiate between them by providing the File, so the notation refers to the function Function_name in the file File.

Condition

  The Condition parameter displays a associated expression which should evaluate to a Boolean value — that is, the evaluation of the expression should result in either TRUE(1) or FALSE(0). If the final evaluation value is not a Boolean value, then it will be appropriately type casted to a Boolean.

  Every time the breakpoint is encountered during the execution, the break condition will be evaluated. The debugger will break the execution only if the evaluation results in a TRUE value, otherwise it will continue the execution as though there had been no breakpoint.

  The default value, if you left this field blank, of Break condition is TRUE. The debugger will always break the execution at the breakpoint location.

Pass Count

  The Pass count is an integer (unsigned) value which tells the debugger to skip the breakpoint that number of times before it is considered. Pass count has a higher priority than the Break condition. Only when the Pass count reaches zero will the debugger evaluate the Break condition (if any condition is present). If there is no condition, the debugger will break the execution once the Pass count counts down to zero.

  The default value, if you left this field blank, of the Pass count is zero. The breakpoint will be considered when it is first encountered.

A breakpoint may also be set by selecting a line in the editor and choosing the menu item Debug Toggle Breakpoint in the editor popup menu item or the Toggle Breakpoint icon in the Debug toolbar.

Breakpoints can be added even if the debugger is not started or in dynamic library not loaded yet. But they cannot be added while a program is running under control of the debugger.

#### Editing Breakpoints

It is possible to change the condition and the pass count by selecting the breakpoint in the breakpoint list and click in the popup menu item Edit Breakpoint.

Edit the entries as required and click on OK to commit the changes.

#### Deleting Breakpoints

Select the breakpoint in the breakpoint list view and click on Remove Breakpoint to delete it.

A existing breakpoint may also be deleted by selecting the line in the editor and choosing the menu item Debug Toggle Breakpoint, the editor popup menu item Toggle Breakpoint or the Toggle Breakpoint icon in the Debug toolbar.

It is possible to remove all breakpoints by clicking on Debug Remove All Breakpoints or on Remove All Breakpoints in the breakpoint list popup menu.

#### Enabling or Disabling Breakpoints

Click on the Enable column of the Breakpoint list window or in the menu item Enable Breakpoint to enable or disable the selected breakpoint. The breakpoint will be enabled or disabled, depending on its current state.

To disable all breakpoints, click on Debug Disable All Breakpoints or on Disable All Breakpoints in the breakpoint list popup menu.

### Expressions

#### Listing local variable

When a program is running under the control of the debugger, the Locals list window can be opened by choosing View Locals

Local variables of the current frame (the current function in which the program control is present) are displayed in the Locals list window. During execution of the program (eg. during single stepping), local variables will be updated. If any variable value was changed in the last debugging step, its value will be highlight in red. The variables are presented in a tree form for easy view.

##### Local variables

Local variables

The value of a local variable can be modified by selecting it and clicking in the value column.

Gdb is more and more often used as a back end for a graphical front end. It has been improved recently in this area. It is recommended to use the latest version (6.6) of gdb. On older version, gdb can crash when the front end ask for an pointer with an invalid (but not used) value.

#### Listing watched expressions

Inspecting or evaluating an expression provides the result only once. To continuously monitor some variables or expressions, use expression watch.

Choose the menu item View Watches to display the expression watch window.

#### Adding an expression to watch

Right-click on the expression watch window to open the Operation menu. Choose the menu item Add Watch…. Alternatively, you can use Debug Add Watch… A dialog prompting for the expression will appear. Enter the expression and click OK.

By default watch expression are updated automatically each time the program is stopped. This can be changed in the add watch dialog or later using the Automatic update menu item in the expression watch window popup menu. A watched expression can be update manually by choosing Update Watch or Update All in the previous menu.

It is not necessary to have the debugger running to add a new watch expression. If the debugger is not running or the corresponding expression cannot be found, the front end will try to create the watch expression, each time the program is stopped.

#### Removing an expression from watch

Select the watch expression that you want to remove in the expression watch window, then open the Operation menu, clicking with the right mouse button, and choose the menu item Remove to remove it.

All watch can be removed by choosing Remove All in the popup menu of the expression watch window.

#### Evaluating expressions

When control is returned from a program — possibly at a breakpoint — it is possible to evaluate expressions or inspect the values of variables in the program. Choose the menu item Debug Inspect/Evaluate …, Inspect/Evaluate … in the popup menu of the editor or click the Inspect button on the Debug Toolbar.

A window will appear showing the evaluation of the expression highlighted in the editor. You can evaluate a new expression by clicking on the name column and entering the new one.

The expression can be added directly in the list of watched expressions by clicking on Add button.

#### Inspecting expressions in editor window

When the debugger is active with the program stopped, you can get the value of an expression just by putting the pointer over it and stay here for a few time. If the expression is already present in the local or watch window, its value is displayed in a tool tips window.

It is currently working only for simple variable, not for structures or arrays.

### Stack Trace

#### Stack Window

The Stack trace window shows the contents of the program stack. It lists all of the functions and their arguments in the sequence they were called. There is also a number representing each call. This number is called the Frame. Each call in the trace exists in a different frame. This starts from frame 0 (the last function called) and grows higher as the function nesting become deeper.

Choose the menu item View Stack, to open the stack trace for the program being debugged.

##### Stack trace window

Stack trace window

A small arrow points to the currently selected frame in the stack trace. By default, this will be frame 0, the last function called. All of the evaluation and inspection of expressions or variables will be with reference to this selected frame. The scope of the variables or expressions being evaluated will be limited to the selected frame only. The same applies for new expressions only in the watch.

#### Setting the current frame

Double-clicking on any frame in the stack trace set that frame as the currently selected frame (the arrow will point to the frame, indicating that it has been selected as the current frame). Alternatively, open the Operation menu by right-clicking on the Stack trace window, and choose the menu item Set current frame to set the frame.

Changing the stack frame changes the Locals list window content, but not the expression watch window as each expression is evaluated in the frame used when it was defined.

### Thread

#### Thread Window

The Thread window show all threads used by the program and display the current thread. Choose the menu item View Thread, to open this window.

A small arrow points to the current thread. When the program is stopped, it correspond to the thread which has been interrupted. Each thread has its own stack frame,so changing the current thread change the current stack frame.

#### Setting the current thread

Double-clicking on any thread in the thread list will set that thread as the currently selected thread (the arrow will point to the thread, indicating that it has been selected as the current thread). Alternatively, open the Operation menu by right-clicking on the Thread list window, and choose the menu item Set current thread to set the thread.

Changing the thread changes the value of CPU registers and the current stack frame, so the Locals list window change too.

### CPU

#### Register window

It is possible to examine the contents of the internal registers of the CPU (microprocessor). Choose the menu item View Registers. A window listing all of the available registers in the microprocessor and their corresponding contents will appear.

If any register value was changed in the last debugging step, its value will be highlight in red. It is possible to change one register value by selecting it and clicking in the value column.

#### Memory window

Choose the menu item View Memory , to open the memory window for the program being debugged. This window shows the contents of all memory.

The first is the memory address in hexadecimal, the second is the memory content in hexadecimal too and the last column is the memory content in ASCII.

The addressing space of even a 32 bits microprocessor is quite big(4 Giga bytes), so it is very difficult to go to a particular address with the scrollbar. But you can click on the right mouse button, get a new menu and select Goto address to get a small edit box where you can enter an address in hexadecimal.

#### Disassembly window

Choose the menu item View Disassembly , to open the disassembly window for the program being debugged.

The first column is the address in hexadecimal. In the second column, you can have a label starting at the beginning of the line and ended with a colon or a assembler instruction starting after 4 space characters.

Again, as the addressing space is very big, the scrollbar is quite useless. You can click on the right mouse button, get a new menu and select Goto address to get a small edit box where you can enter an address in hexadecimal. The position in the disassembly window will be changed to the program counter value when the program is stopped.

### Autres

There are a number of other debugger features used less frequently and not very well integrated in the new front end but which are still working.

#### Dynamically loaded Libraries

To obtain a list of the dynamic libraries used by the program, choose the menu item DebugInfo Shared Libraries. This will bring open a window which will list all the shared libraries the program has loaded and their locations in the memory. It also shows whether the symbol table is loaded or not (Yes/No).

##### Shared Libraries window

Shared Libraries window

#### Kernel Signals

Kernel signals are a way of signaling between processes in Linux. The list of signals available for a program can be displayed by choosing the menu item DebugInfo Kernel Signals. A window will open which lists all of the signals available in the system along with a brief description of each signal.

##### Kernel Signals window

Kernel Signals window

There are three columns which specify what to do when the signal is received:

1. Stop — this tells the debugger whether to stop the program execution (and return control) when the program receives this signal.

2. Print — this tells the debugger whether to display the received signal.

3. Pass — this tells the debugger whether to pass the signal to the program.

The popup menu that is displayed when you click on the right mouse button has all its item disabled because the corresponding functions are not implemented yet.

#### Entresenhas a prepaus de fichièrs utilizats

It is possible to get some information about the files used by the debugged program. by choosing the menu item Debug Information Target files. A window will open displaying all informations.

#### Information about debugged program

It is possible to get some information about the debugged program by choosing the menu item Debug Information Program. A window will open displaying all informations.

#### Information about kernel structure

It is possible to get some information kernel data on the current process by choosing the menu item Debug Information Kernel user struct. A window will open displaying all informations.

#### Information about global variables

It is possible to list all global variables by choosing the menu item Debug Information Info Global Variable. A window will open listing all global variables.

#### Information about the current frame

It is possible to obtain information about the currently selected frame by choosing the menu item Debug Information Info Current Frame. A window will open describing the current frame.

#### Information about the current function arguments

It is possible to obtain information about the arguments of the current function by choosing the menu item Debug Information Arguments. A window will open describing the arguments.

#### Comanda personalizada

To send directly a command to the back end choose the menu item Debug Debugger command. This will bring a small dialog where you can enter commands that will be send to the debugger when you press Return.

The front end sends this command directly to the back end without doing any check. By example if you set a breakpoint like this, it will not appear in the breakpoint list window. It is better to avoid using this command unless you know exactly what you are doing.

## Preferéncias

Preferences are ways to customize anjuta to suit your tastes. Activate Settings Preferences to bring up the preferences dialog. If you want to reset the preferences to their default values, it can be done from Settings Set Default Preferences. Some are explained below.

### General

1. Project Directory is the path where you plan to put all your projects. Application wizard creates new projects in this directory only. The default project directory is ~/Projects and generally, this is just fine for most people. Also, when Open project is activated, this is the base directory where the file selection will start.

2. User Info: Provide your correct Name and Email address here. They are not used to do software registration (pun), rather they are used to create ChangeLog entries and other insert text bits.

### Gestionari de fichièrs

1. Root directory if no project is open is the path where the root of the file manager points to if no project is currently open.

2. File Filter: It is possible to filter out some file from the file tree, for example hidden files or files that are ignored by the version control system which usually means they are generated at build time and should not be changed.

## User-defined Tools

### Introduccion

Often, you'll find the inbuilt functionality provided by Anjuta to be insufficient. In these cases, you might be tempted to either add the feature yourself to the Anjuta codebase or submit a feature request to implement the feature. However, both approaches are likely to be slow and problematic, especially if your tool is a specialized one. In these circumstances, it is advisable to use the Anjuta tools framework instead.

Anjuta provides a powerful framework for defining user-defined tools for extending it's functionality. Tools have access to almost all features of the IDE through the use of variables. You can add tools under any menu item, specify input, output and error redirection within the GUI framework and supply command line parameters to the tool.

The tools plugin has to be enabled to use this feature!

### Tools Examples

This is a simple example how to use the tools plugin to integrate the GNOME ChangeLog generation script

#### The tool editor

The tool editor

## Autors

The Anjuta project was founded by Naba Kumar. Please visit this online list to know all Anjuta contributors.

For more information on Anjuta, please visit the project website at http://anjuta.org. Bug reports should be made using the Bug Tracker at the project development site http://www.sourceforge.net/projects/anjuta

This manual was written by Naba Kumar and Andy Piper. Please send all comments and suggestions regarding this manual to Anjuta Devel list anjuta-devel@list.sourceforge.net. Comments may also be submitted via the project trackers at SourceForge.

## Licéncia

This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

A copy of the GNU General Public License is included as an appendix to the GNOME Users Guide. You may also obtain a copy of the GNU General Public License from the Free Software Foundation by visiting their Web site or by writing to

         Free Software Foundation, Inc.
         51 Franklin Street Fifth Floor
         Boston, MA 02110-1301
         USA