# Anjuta IDE Manual

v1.0.0

Manual for the Anjuta IDE

Naba
Kumar
Andy
Piper
Biswapesh
Chattopadhyayr
Johannes
Schmid
2001-2002
2006-2008
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 includes project management, application wizards, an 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.

Anjuta DevStudio has been designed to be simple to operate yet powerful enough to fulfill all your programming needs. We've added many new features to Anjuta over the course of its development. Our focus is on delivering power and usability at the same time and making your software development enjoyable without overloading your senses. We intend to continue improving and stabilizing Anjuta to give you the best IDE experience possible. We hope you will have a good time using Anjuta. If not, please help us make it better by reporting bugs and suggestions.

The following screenshot illustrates some of the things you will find in Anjuta.

### Anjuta in action

Anjuta in action

Anjuta has a flexible and advanced docking system that allows you to lay out all views in whatever way you like. You can drag and drop the views using drag bars and rearrange the layout. The layouts are persistent for each project so you can maintain different layouts for different projects. All dock views are minimizable to avoid clutter in the main window. Minimized views appear as icons on the left side of the main window. You can configure all menu actions either by typing when the cursor is over a menu item (the usual GNOME way) or through a dedicated shortcut configuration user interface.

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 menu bar. You can access almost all of Anjuta's functionality through menu items. Operations have been grouped according to their type. For example, file operations have been grouped into the File menu.

#### Barra de menuts

La barra de menuts d'Anjuta

#### File menu

File menu

Shortcut keys are available for many menu items. All shortcut keys are shown alongside the corresponding menu items. Some other useful shortcuts are listed here.

- Switch Editor Page: Ctrl Alt Page Up (forward) and Ctrl Alt Page Down (backward). You can also switch pages by right-clicking on the notebook tabs and selecting a filename from the pop-up menu (useful when all the tabs in the editor are not visible at once). Some desktop configurations 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 use these shortcuts.

- Context Help: Shift F1. Place the cursor on the word (for example, the function name) for which you want to get API help and type this shortcut. Context help only works if you have Devhelp installed; otherwise, the context help menu and toolbar button will be inactive. You can get Devhelp from the Devhelp website. You will also have to install the related Devhelp books.

- Autocomplete: Ctrl Enter. Type this shortcut with the cursor placed at the end of an 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 the right side of menu item labels. Shortcuts can also be changed as explained in the tip below.

#### Customize shortcuts

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

### Fenèstra principala

The main window contains several view windows which can be rearranged 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 file commands will apply to this active document. You can switch to any document by clicking on its 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 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 this in the preferences. If a project is open, the window shows all files in the project. Double-clicking opens a file in the appropriate application as configured in the GNOME MIME preferences. Right-clicking opens a context menu which gives you choices about how to open the file.

4. The Symbols window shows a tree of available symbols in the project generated from the 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. Messages displayed in orange are warnings, and those displayed in red are errors. Warning and error messages are 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 errors, 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 emulator where you can type commands just like in the GNOME Terminal application.

#### Gestion de session

All settings, including window sizes and 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 text

#### Creating a New File

To create a new file, choose File New from the menu bar, or click on the New File button on the main toolbar. A new page will appear in the editor (or a new window if the parent document is windowed). New documents 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 File New File from the menu bar. This will open the New File dialog. Select the file type. Enter the filename. The suffix will be automatically added. You can add license information (according to your license choice) and a header. In case of a 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 file windows during some operations. For example, some Subversion operations such as `Diff` and `View Log` create new file windows and add the output there. You can save the contents of these windows to real files if you like.

#### Inserir de macròs

You can use macros to quickly edit repetitive sequences of text.

The Macro plugin must be activated.

##### Inserir

Two types of macros are available: Anjuta macros and user macros (displayed as "My macros"). Anjuta macros are not modifiable, but you can define and modify your own user macros.

To insert a macro, move the cursor to the desired place. Select Edit Macros Macros.... A dialog window appears. Select the desired 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 way to insert a macro is to select Edit Macros Insert Macro..., then to press the desired macro shortcut.

###### Macrò

The Macro dialog

##### Defining Macros

From the Insert Macro window, choose Add or select Edit Macros 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.

You can also erase a macro by selecting it in the list and choosing Remove. This only works for user macros (My Macros), of course.

Similarly, you can edit and modify a macro by selecting it in the list and choosing Edit.

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

Add Edit dialog

##### Macro Keywords

Macro keywords are available. They can be included in macro definitions. These macro keywords start and finish with 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@, and @USETABS@.

###### Keyword Macro

The Keyword macro

### Opening and Saving Files

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

   #### Open File dialog

   The Open File dialog Select or enter the name of file you want to open, then click Open. To open more than one file at once, select multiple files to open by holding down the Ctrl key and clicking each file in turn; then press Open. If you change your mind, click Cancel to dismiss the dialog without opening the file.

   #### Open Multiple File dialog

   The Open File dialog in multiple-select mode

   You can enable the Show Hidden Files option through the pop-up menu that appears when you right-click in the Open File dialog. This option will make hidden files (files starting with ".") visible in the file list. Clear the option to hide hidden files. The Open File dialog also has a built-in 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 menu bar, click on the Save button on the toolbar, or press Ctrl S. 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

   #### File autosave

   If you have enabled autosave, Anjuta will not autosave any new files. You must first save them manually. The same applies to the Save All option: Anjuta will not save new files, if you haven't saved them first manually. You must save a file manually before autosave 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 menu bar. 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 menu bar, or click on the Close button on the toolbar. (You can also close a file by clicking the X in its 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 features which help you edit and work with source files. The following sections describe how to use some of the interesting features available.

#### Editor Margins

Editor Margins: Editor margins appear to the left of the editor and are used for some special purposes. There are three editor margins available: the line number margin, the marker margin and the 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 can be made visible via View Editor.

##### Editor Margins

The Tags toolbar

The line number margin is largest of all the three margins (and is slightly darker then rest) and displays a document's line numbers. The line number margin can be shown or hidden by toggling View Editor Line Numbers Margin. Left-clicking on this margin will select an entire line (including the trailing newline, if present). You can set font properties for the line number margin in the preferences.

The marker margin can be shown or hidden via View Editor Markers Margin. This margin displays graphical icons to mark the given line. The margin may display bookmark markers (blue and rectangular), breakpoint markers (red and circular) and line indicator markers (which look like a yellow pointed arrow). A bookmark marker indicates a bookmarked line, and can be toggled via Goto Bookmark Toggle Bookmark with the cursor placed on that line. A breakpoint marker is used in the debugger to indicate a debugging breakpoint (see the Debugging section for more details). A line indicator marker is used to indicate the current program position in the debugger.

The code fold margin is where the folding tree is visible. Clicking on folding tree nodes will fold or unfold code blocks. An underline will also be drawn below a 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, Anjuta displays markers by changing the background color of a line. For example, if a breakpoint marker is set in a line and the marker margin is not visible, that line will be displayed with a red background. Similarly, for a bookmark marker and a line indicator 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 marker margin via View Editor Marker Margin.

##### Editor markers when the marker margin is invisible

The Tags toolbar

#### Editor Guides

The editor can be set to display certain document information which is normally invisible, including indentation guides, white space and line end characters. They can be make visible or invisible by toggling the menu items in View Editor. Indentation guides are small dotted lines drawn to connect matching braces in source code. When the cursor is over a matching brace, its dotted indentation guide is highlighted to emphasize the indentation level visually.

##### Editor with guides

Editor with guides

#### Syntax highlighting

Anjuta can highlight the syntax of many different languages. This is usually done automatically by determining the type of a file from its extension. If Anjuta cannot determine the type of a 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.

Anjuta uses a properties file named `$prefix/share/anjuta/properties/anjuta.properties`, which has the same format as a SciTE properties file but does not use all properties. The style of each element for all languages is defined in a file named `$prefix/share/anjuta/properties/styles.properties`. It uses some common properties defined by Anjuta in the file `$home/.config/anjuta/scintilla/editor-style.properties`.

#### Code folding

Anjuta can display code folds for source files in block-structured languages (such as C, C++, Pascal, and Java). All code blocks in a source file can be folded or unfolded by clicking on the fold points in the code 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 large source files with thousands of lines. Once the folds are closed, a 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

Anjuta can automatically indent (auto-format) C or C++ source or header files. This gives a clean look to the source code, increases legibility, reduces the likelihood of syntax errors, and above all saves time. To auto-indent the current source file, choose Edit Auto Indent on the menu bar. You can change the style of formatting by customizing the choices in the preferences.

### The Symbol Browser

You can browse C and C++ source and header files using tags in the files. A tag (or symbol) refers to a named entity such as a function definition, structure, or macro. Anjuta scans open C and C++ source and header files for available tags.

Anjuta will automatically scan for tags in all of the source and header files of any open project. You can jump to any function definition, structure definition, class definition or other tag without manually opening the containing file. You don't even have to know which file the tag is found in. The symbol browser lists all available symbols in the project.

#### Symbol browser

Symbol browser

#### Tag 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 string or regular expression in the current file, choose Edit Search Find or press Ctrl Alt F. 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. You can also 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, Anjuta will jump to the matched text or perform another action (according to the Search Action you choose in the Search Target tab). If the search is not successful, Anjuta will display a message indicating that the search text was not found.

If you want to search again, click the Search button again or press Ctrl G. This will find the next match (use Shift Ctrl 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 search dialog.

##### Search Text dialog

To stop a long search, press the Stop button.

#### Specifying Search Range

In the Search Target tab, define the search location and the action to be performed if the search succeeds.

You can define the maximum number of actions to be performed.

##### Search Target dialog

You can select which text will be searched.

##### Search Target In choice

##### Searching in Files

To find text in your project, set Search In to All Project Files.

In the Search Expression tab, enter the text you want to search for and specify search options, such as the Match case or Match complete words options. Click Search to start searching.

To find text in a set of files, set Search In to Specify File Patterns. Define the search variables. Click Search to start searching.

###### Search File Pattern

#### Specifying a Search Action

You can select which action will be performed when a search succeeds.

Depending on the previous selections (Search In, Search Direction , and so on), some actions may be unavailable.

##### Search Target Action choice

#### Replacing

Searching and replacing is similar to just finding text, except that you also specify the replacement text in the Replace With text box, and also specify whether or not you want to be prompted before each replacement 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

You may also save search options.

The item highlighted in red is the active item. The default item specifies search settings which are loaded when Anjuta launches.

##### Search Setting dialog

### Estampar un fichièr

You can perform a print preview by selecting File Print Preview. This will render the current file and present a preview of the print. Source code which is highlighted in the editor is also highlighted similarly in the preview (and subsequent print). The Printing tab of your editor plugin preferences contains additional options which let you print with line numbers, wrapped lines and/or headers.

#### 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 press Print to print the file.

You can also set landscaped or portrait page layout and the paper size, page orientation and paper type. Remember to set them up properly according to your printer, otherwise printing may not look correct.

#### 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 uses automake/autoconf in a typical way, it should work.

The neat thing is that Anjuta does not store any project information beyond what is already available in the project structure. That is, there is no separate project data maintained by Anjuta and all project processing is done directly within the project structure. This allows a project to be maintained or developed outside Anjuta without any need to convert to or from an Anjuta-specific format. Since technically Anjuta projects are just automake projects, mixed development (with both 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

#### Creating a project from a 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. The 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 each template is just a collection of text files.

To create a project, choose the menu item File New 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 following pages, enter all necessary details for your project. You can change these settings later, but it is advisable to set them right initially in order 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 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 languages such as English, French and Dutch. 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 for enabling GNOME desktop menu information if necessary. Shared library support allows you to add shared library modules later on. If you plan to have libraries in your project, it would be good to enable this. Depending on the project type that is being created, Anjuta may request additional information.

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

Once the project has been generated, you can try it out by building it and executing it.

#### Importar de projèctes

The import project feature is used to import an already existing project and convert it into an Anjuta project. Activate the import project wizard via File New Project from existing sources and follow the instructions dictated by the wizard. Once a project has been imported, it can be opened in Anjuta subsequently just like any other Anjuta project.

The import project feature only works if your existing project uses autoconf/automake or, to a very limited extent, a plain Makefile.

### 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 File Recent. Choose the project filename 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 project files organized by file type. The second is the symbol browser, which has already been discussed in the section The Symbol Browser. The third pane is the file view of the project and is more or less similar to a mini file-manager. In the file view, all the files present in the project tree are visible. Right-clicking on these files will pop up a context menu with file operations.

If the project is also a CVS tree, then corresponding file revision numbers are also listed to 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 its context menu (accessible by clicking on the right mouse button).

#### Project window

The Project window

The Project window displays the project's 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). The Project window actually has two parts: the lower part shows the complete project hierarchy and the upper part lists important targets directly. Important targets include executable and library targets; the view makes these easily accessible. This is particularly useful in large projects where the hierarchy can 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 subgroups as well as targets. In automake projects, groups are just subdirectories in the project. The top-level group is always labeled "/".

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

- Source files may be used to build targets, though some source files simply belong to targets. They exist only under targets. Many target types expect certain type of source files (e.g. the Programs and Libraries target types), but some can accept any file (e.g. a Miscellaneous Data target).

Each project group and target is configurable in the standard automake way. You can set compiler and linker flags directly for each target, or set configure variables. Groups allow you to set an installation destination for their targets.

Just like the file manager, the project manager view also has convenience actions (accessible from the context menu) for 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 common operations using plugins. However, you might occasionally still need to perform certain operations manually.

You may modify a project's structure using external tools or by hand-editing the project files. It doesn't matter whether the project is loaded in Anjuta or not. Anjuta will update itself with any external changes made to a project.

### Groups and targets

#### Apondre de grops

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

- Select Project Add Group and a dialog to add a new group will pop up.

- Select the group under which to add the new group.

- Enter the name of the new group and click Add.

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

You can also add a new group from the Project window directly. Right-click the group under which to add the new group, then choose Add Group from the context menu.

#### Suprimir de grops

To remove a group:

- Right-click the group in the Project Manager view.

- Select Remove from the context 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 add them to the project again later if you like.)

#### Adding Targets

To add a new target:

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

- Select the group under which to add the target.

- Select the target type.

- Enter a name for the new target and click Add.

You can also add a new target from the Project window directly. Right-click the group under which to add the target, then select Add target from the context menu.

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

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

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

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

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

- The Java Module target type is for Java modules. Select this type 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 the properties of the group containing the target.

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

- The Python Module target type is for Python modules. Select this type 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 the properties of the group containing the target.

- The Scripts target type is for grouping scripts. They will be installed in the standard executable directory.

- The Miscellaneous Data target type is for grouping simple files in a project. You must specify an installation directory in the group properties.

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

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

#### Removing Targets

To remove a target:

- Right-click the target in the Project Manager view.

- Select Remove from the context 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 the 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 the Shift or Ctrl key. Then click Add to add the files to the project.

By default, the current editor file will be preselected for addition in the dialog. Another convenient way to add a file is to right-click it in the File Manager and choose Add to project from the context 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 has already been 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 a target's directory without copying them in.

#### Removing Source Files

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

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 project operations such as compiling, building, or distribution.

### Configuracion del projècte

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

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 define your own variables in Project Properties and use them in properties. This will make it easy to update flags later, especially when a variable is used in several targets.

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

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

- $(bindir): The installation directory for executable binaries. All your executable and script targets will 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) will 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 a package group that you specify in the project properties as described below.

#### Propietats del projècte

The project properties dialog can be opened only by choosing Project Properties from the toplevel menu bar. You can:

- Set the project name, version and URL in the 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 the Packages page. See below for details.

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

Dependencies are external packages that the project uses and are 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 groups of packages and can be named anything (only alphanumeric characters and _ are allowed in module names). Usually, they follow the name of targets they would be used 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 the project properties dialog.

- Select the tab Packages to bring up the 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 other configure variables (only use alphanumeric and '_' characters) and press Enter to create it.

- Click Add Package to bring up the package selection dialog.

- Select the package to add and click Add.

- Click Close to close the properties dialog.

#### Propietats del grop

To edit a group's properties, double-click the group in the Project window to open the Group Properties dialog. (You can alternatively right-click the group and select Properties from the context menu.)

##### Group properties dialog

Group properties dialog

Properties set for a group apply to all the targets under it. So any compiler or linker flags set for a group will be automatically be part of all the targets in it (in addition to each target's individual properties). The following fields are available in the Group Properties dialog.

- Includes: Set your include directories for your C and C++ targets here. You need to provide the full include options of the compiler here, e.g. -I/usr/include/blah. The include paths will be used to find header files included by your source files. (You can also add other compiler flags here, but it's preferable to set them in their respective compiler flags fields as described below.)

- Compiler flags: 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 used for C/C++ is gcc/g++ (the GNU C compiler). Check out the gcc info documentation for more details.

- Install directories: The dialog will display a field for each target in the group that requires an installation directory. Set each installation directory as relative to one of the many automake directory variables, such as $(prefix), $(bindir), $(libdir), or $(datadir).

#### Target properties

Any properties set for a target apply to that target only. A target also inherits properties from its containing group.

To set a target's properties, double-click the target in the Project window to open the Target Properties dialog. (You can alternatively right-click the target and select Properties from the context menu.)

##### Target properties dialog

Target properties dialog

You can add the modules you have added in Project properties to a specific target here. To activate the module simply toggle the checkbox next to the module name. This will automatically add include and linker flags to that target and enable you to use the module within this target.

##### Advanced target options

The following fields are available in the advanced target configuration that you reach when you clicked the Advanded... button in the target properties dialog.

###### Target properties dialog

Target properties dialog

- 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 used for C/C++ is gcc/g++ (the GNU C compiler). Check out the gcc info documentation for more details.

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

- Libraries: Set the libraries that the target depends on.

## Building

Anjuta handles autotools projects. It is able to cope with other kinds of projects, such as projects using a user-written Makefile, but the current build interface is targeted at autotools projects. Some knowledge of them is useful to better understand the way a project is built.

An autotools project is built in three steps:

1. Generate

2. Configurar

3. Build

Build is the main step in which all target files are generated from the source files. It can be divided into two subphases: Compile and Link. In the Compile phase each object file is generated from its corresponding source file. 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. In the Link phase, all object files and libraries are linked together to create the final executable. Some programming languages do not need a Compile and a Link phase. Moreover the Build step may be used to generate other files, like documentation which doesn't need such phases.

Configure is the step in which the source tree is adjusted to your system. autotools projects can be built on a wide range of systems using different compilers and having different library functions. This step runs a script named `configure` that will check for various characteristics of your system and create some of the files required to perform a build (such as `Makefile` and `config.h`). This step is used to select build options, too; for instance, a build option may disable optimization to make debugging easier or disable some experimental part of a program.

Generate is the step in which the `configure` script and other related files are created. The `configure` script used above needs to run on various systems and checks a lot of things. It would be quite difficult to write it by hand. Moreover autotools enforces some project organization rules such as the presence of some mandatory files: `NEWS` and `COPYING`, for example. It includes several tools to create necessary files from simpler files written by the developer such as `configure.in` (or `configure.ac`) and `Makefile.am`. All these tools are commonly run from a script named `autogen.sh` in the project directory. This step is useful only for a developer (someone modifying the source files), as the `configure` script depends only on the source files, and is distributed within the project package. Note that the makefiles created by configure include some rules to automatically regenerate the project when needed, so it often not needed to rerun it directly.

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

### Generate and Configure

#### Configure a project

You need to run this step before being able to build your project. This 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 this separately: the wizard will run it as a part of the project generation process.

There is no requirement to run this 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.

Both generate and configure steps are launched with a single menu item: Build Configure Project…. This menu item brings a dialog where you can choose:

- Whether you want to run the generate step or not

  The generate step needs to be run once at the beginning of the project; then it is automatically handled by the build process. You can force it to run by checking the checkbox Regenerate project; you might do this if you encounter difficulties while building a project (e.g. if you receive build errors after you've modified lots of build files).

- The configuration name

  This name is used to refer to each configuration. Some configurations (Default, Debug, Optimized) are already defined by default. One configuration includes a build directory and some configuration options.

- The build directory

  This is the build directory name. In the Default configuration, it is the same directory as the source directory but autotools supports building in a different directory.

  Each configuration must have a different build directory and if one configuration uses the source directory, you cannot have other configurations at the same time. You need to run Build Remove Configuration on the configuration using the source directory before adding a new configuration.

- Configure options

  These options are passed to the `configure` script. Some are standard, such as --prefix and CFLAGS; others depend on the project. You can get a list of allowed configuration options by running the `configure` script with the `--help` argument.

#### Select a configuration

If you have created different configurations, you can select which one is active by selecting it in Build Select Configuration.

#### Clean a configuration

To clean the project and leave it in a state that requires rerunning the configure step, choose Build Remove Configuration. It run `make distclean` and deletes more files than Clean Project. In other words, it leaves the project as though it has just been extracted from a distribution tarball. Note that it does not remove the configuration directory itself; you can do that yourself if you like.

### Compile and Build

#### Compiling a file

In a project, 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 iterations while developing a 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 source files and link them together along with the necessary libraries. The build command will not recompile those files which are already up-to-date (this is called the dependency check). If you have already compiled all 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 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 just 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 regenerated.

Can you imagine how your life (as a programmer) would be if the dependency check were not there? If you cannot answer just yet, then you will find out when you start developing big projects!

Build Build will build all files in the directory of the currently active file.

Build Build Project will build the whole project — all subdirectories are built recursively.

### Other operations

#### Creating a distribution package

To build a 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.

#### Installing a project

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.

#### Cleaning

This deletes all of the files generated by the build process, including all object files (`*.o` files) and the executable(s). It can be applied on one directory or the whole project.

Choose the menu item Build Clean Project to clean all project files.

Choose the menu item Build Clean to clean only the directory of the current active file.

## 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. A bug is not a compilation error — compilation errors are relatively easy to clear, because the compiler tells you where the problems are. By contrast, bugs are errors that happen during program execution 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

Almost every feature of Anjuta is provided by a plugin. If you do not see the menus described here. It is probably because the debugger plugin is not loaded. Go in Edit Preferences General Installed plugins and check that the debugger plugin is loaded. It is an user activatable plugin, so loaded or unloaded on request.

#### Running an executable

Running a program with or without the debugger uses the same menu: select Run Run Program to run a program without the debugger and Run Debug Program to run it with the debugger.

In order to better use the debugger, it is strongly recommended that you build your program with debugging information (-g for gcc) and no optimization (-O0 for gcc). This can be done by selecting the Debug configuration before building the program for the first time.

You can select which program to run and its environment using Run Program Parameters…. You can choose:

- The program that you want to debug

  The drop-down menu of the target drop-down combination box is pre-filled with all executables of the current project. But you can alternatively select another executable which is not part of the project. The debugger also accepts libtool executables; these are scripts generated by libtool which wrap real executables.

- The command-line parameters

- The working directory

- Environment variables

  Environment variables displayed in light gray are the current environment variables. You can add, modify or remove environment variables here.

  To debug Anjuta using Anjuta, you can use a different theme to change the look of the instance being debugged; for example, you could add "GTK2_RC_FILES=/usr/share/themes/Crux/gtk-2.0/gtkrc".

- Whether the program should run in a terminal or not. If so, the Anjuta terminal plugin is used.

#### Attaching to a Process

It is also possible to attach to a running process and debug it by choosing the menu item Run Debug Process …. A list of all processes 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 information for an attached process. Symbols should be included in the process.

#### Stopping the Debugger

Choose the menu item Run Stop Debugger to stop the debugger. This will kill the program which is being debugged. If the debugger has been attached to a running process, the debugger 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 normally not useful. But some executables include only file names without paths; in this case, the debugger will search for source files in all these directories. The order of directories can be important if several files have the same name, so you can change it using the Up and Down buttons. The directory list is sent to the debugger when it is started. After changing it, you need to restart the debugger to cause it to use the new list.

### 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 following sections. These commands are available only when the program has already been 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, you can study your program's state.

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 the cursor is reached.

This option continues the execution of the program until the line or the address (if the Disassembly window has the focus) at 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 such as the function containing the breakpoint.

Address

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

Type

  This always displays "breakpoint". It will be used in a future release supporting different kinds 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, or zero if it is not defined.

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

State

  This is the state of the breakpoint. It may be

  - Pending: the breakpoint is not set in your program.

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

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

All breakpoints are kept across Anjuta sessions even if they correspond to a non-existing location. In this case their states are set as pending. The interface tries 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

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 can be specified in any of the following formats:

  1. File_name:Line_number

  2. Function_name

  3. File:Function_name

  The first format is obvious — the location refers to the line number Line_number in the source file File. The second format 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 cast to a Boolean.

  Every time the breakpoint is encountered during your program's 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 leave this field blank, of 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 leave 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 context menu or the Toggle Breakpoint icon in the Debug toolbar.

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

#### Editing Breakpoints

You can change the condition and the pass count by selecting the breakpoint in the breakpoint list and clicking Edit Breakpoint in the popup menu.

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 its line in the editor and choosing the menu item Debug Toggle Breakpoint, the editor context menu item Toggle Breakpoint or the Toggle Breakpoint icon in the Debug toolbar.

You can remove all breakpoints by clicking on Debug Remove All Breakpoints or on Remove All Breakpoints in the breakpoint list context menu.

#### Enabling or Disabling Breakpoints

Click on the Enable column of the Breakpoint list window or in the context 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 context menu.

### Expressions

#### Listing local variables

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 window. During execution of the program (e.g. during single stepping), local variables will be updated. If any variable value was changed in the last debugging step, its value will be highlighted in red. 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 that you use the latest version (6.6) of gdb. With older versions, gdb can crash when the front end asks for an pointer with an invalid (but unused) value.

#### Listing watched expressions

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

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

#### Adding an expression to watch

Right-click on the Watches window to open the context 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 expressions 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 Watches window context menu. A watched expression can be updated manually by choosing Update Watch or Update All in the context 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 a watched expression

Right-click the watch expression that you want to remove in the Watches window, then choose the context menu item Remove to remove it.

All watches can be removed by choosing Remove All in the context menu of the Watches 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 context 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.

You can add the expression to the list of watched expressions directly by clicking on the 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 mouse pointer over it and staying there for a short time. If the expression is already present in the Locals or Watches window, its value is displayed in a tooltip.

This capability is currently working only for simple variables, not for structures or arrays.

### Stack Trace

#### Stack Window

The stack trace window shows the contents of the program stack. It lists all 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 function nesting becomes 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 evaluation and inspection of expressions or variables will be with reference to this selected frame. The scope of 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 sets 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 context 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 window content, but not the Watches window as each expression is evaluated in the frame used when it was defined.

### Thread

#### Thread Window

The Thread window shows all threads used by the program and indicates 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, the current thread is the thread which has been interrupted. Each thread has its own stack frame, so changing the current thread changes 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 context 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 window changes 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 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 highlighted 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 column displays memory addresses in hexadecimal, the second displays memory contents in hexadecimal and the last column shows memory contents in ASCII.

The addressing space of even a 32-bit microprocessor is quite large (4 gigabytes), so it is very difficult to go to a particular address with the scrollbar. But you can click on the right mouse button to display a context 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 displays addresses in hexadecimal. In the second column, you can have a label starting at the beginning of the line and ending with a colon or a assembly-language instruction indented by 4 space characters.

Again, as the addressing space is very large, the scrollbar is quite useless. You can click on the right mouse button to display the context 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 a program, choose the menu item Debug Info Shared Libraries. This will bring open a window which will list all shared libraries the program has loaded and their locations in memory. It also shows whether each library's 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 Debug Info Kernel Signals. A window will open which lists all 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 a 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 context menu that is displayed when you click on the right mouse button has all its items disabled because the corresponding functions are not implemented yet.

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

You can 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 this information.

#### Information about debugged program

You can get some information about the debugged program by choosing the menu item Debug Information Program. A window will open displaying this information.

#### Information about kernel structure

You can get some information about kernel data for the current process by choosing the menu item Debug Information Kernel user struct. A window will open displaying this information.

#### Information about global variables

You can 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

You can 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

You can 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 performing any checks. 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.

## Glade Interface Designer

### Quick start

If you don't want to read all this boring manual, here is few steps to get all things ready for use:

1. You should have a project containing Glade file opened;

2. Unlike original Glade designer, Anjuta plugin uses double click for creating handlers for default signal. You can perform a click on widgets (e.g. switch current tab in a GtkNotebook) by keeping "Windows" or "Super" key pressed;

3. Open Preferences Glade GUI Designer and check the three topmost flags Insert handler on edit, Separated designer layout and Automatically add resources;

4. Check View Designer flag and move this window to a better place;

5. Switch to a Glade file in the design area and to the source code file that should contain callbacks for the Glade file, then press Glade Associate last designer and editor;

6. Optionally select a target for image and other resources in the project manager and press Set as default resource target in the context menu.

### Glade general usage questions

Glade plugin mostly copies functionality of standalone Glade designer, but there are some special features. The four windows of the Glade desinger are design area, palette, widgets inspector and property editor. They have the same purpose as in the standalone designer, so please consult Glade Interface Designer Manual for their description. An extra functionality allows you to use infrastructure of Anjuta more effectively and is described here.

### Editor and designer association

You can associate text editor and Glade designer so you will easily switch between them and automatically insert handler stubs for newly entered handlers. You can associate more then one editor to a designer. The most recent editor or associated with the current toplevel widget will be used. There are two ways of associating editor and designer. The first way is using associations dialog. The second way is to choose designer and editor document in any order and then press Glade Associate last designer and editor menu item.

### Associations dialog

Allows you to create and manager associations. To create an association select designer and editor in the comboboxes and press Associate. You can also select the document by switching to it in document manager or windows list in the main menu. The list in the middle of the dialog shows existing associations. A couple of controls below are intended for editing association properties. Here is their description:

Spec regexp

  Shortened from "special regular expression". Used for defining a custom position for inserting stubs.

Widget name

  The name of the toplevel widget this assoctiation belongs to.

Position type

  Describes a position at which a handler stub will be inserted. After begin means after special mark (which may be entered in the Spec regexp entry) and before end means before special end mark. Default begin mark is /* window_name callbacks */ and default end mark is /* end of window_name callbacks */. window_name may be ommited.

### Default signal

Double click on a widget in the design area will create a new handler for default signal using a predefined template for its naming. For example, the default signal is "clicked" for button, "toggled" for check box, etc. If Insert handler on edit option is enabled then a new handler stub will be inserted to the position which depends on Position type setting.

### Inserting a stub

One of the most valuable goal of Anjuta and Glade integration is automatical creating of handler stubs, so you will not need to do a lot of routine work for that, it will be done automatically.

There are several ways to create a stub:

- Automatically if Insert handler on edit option if enabled

- Using Glade Insert handler stub, autoposition in hte main menu

- Using Insert handler stub item in the context menu of text document

### Preferéncias

Insert handler on edit

  Enables inserting a handler stub into the associated editor after entering a new handler into signal editor or creating a default signal handler

Separated designer layout

  Detaches the design area from document manager so you can dock it separately from text editors.

Automatically add resources

  When checked then all resources (e.g. images) will be added to the target in the current project. You can choose the target using project manager context menu or by entering target id in the entry below the check button.

Handler template

  You can choose between the two formats of automatic naming of signal handler.

## Preferéncias

Preferences are ways to customize Anjuta to suit your tastes. Activate Edit Preferences to bring up the preferences dialog. Some preferences are explained below.

### General

1. Project Directory is the path where you plan to put all your projects. The application wizard creates new projects in this directory only. The default project directory is ~/Projects and generally this is fine for most people.

2. User Info: Provide your name and email address here. These are not used to do software registration; rather, they are used to create ChangeLog entries and other text insertions.

### Gestionari de fichièrs

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

2. File Filter: You can filter out some files 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

You'll sometimes find the built-in 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 its 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. This page lists 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, Andy Piper, Biswapesh Chattopadhyay and Johannes Schmid. Please send all comments and suggestions regarding this manual to the 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