Cari di RHE Linux 
    RHE Linux User Manual
Daftar Isi
(Sebelumnya) 29 : High Availability Add-On ...30 : Chapter 2. Collaborating ... (Berikutnya)

Developer Guide

An introduction to application development tools in Red Hat Enterprise Linux 6

Edition 2

Edited by

Jacquelynn East

Red Hat Engineering Content Services

Red Hat Subject Matter Experts

Dave Brolley

Profiling 
Red Hat Engineering Tools Development

William Cohen

Profiling 
Red Hat Engineering Tools Development

Roland Grunberg

Eclipse and Eclipse plug-ins 
Red Hat Engineering Tools Development

Aldy Hernandez

Compiling and Building 
Red Hat Engineering Tools Development

Karsten Hopp

Compiling 
Base Operating System Core Services - BRNO

Jakub Jelinek

Profiling 
Red Hat Engineering Tools Development

Jeff Johnston

Eclipse and Eclipse plug-ins 
Red Hat Engineering Tools Development

Benjamin Kosnik

Libraries and Runtime Support 
Red Hat Engineering Tools Development

Chris Moller

Debugging 
Red Hat Engineering Tools Development

Phil Muldoon

Debugging 
Red Hat Engineering Tools Development

Alex Kurtakov

Eclipse and Eclipse plug-ins 
Red Hat Engineering Tools Development

Charley Wang

Eclipse and Eclipse plug-ins 
Red Hat Engineering Tools Development

Development Community

Kent Sebastian

Profiling 

Legal Notice

Copyright © 2012 Red Hat, Inc. and others.
The text of and illustrations in this document are licensed by Red Hat under a Creative Commons Attribution-Share Alike 3.0 Unported license ("CC-BY-SA"). An explanation of CC-BY-SA is available at http://creativecommons.org/licenses/by-sa/3.0/. In accordance with CC-BY-SA, if you distribute this document or an adaptation of it, you must provide the URL for the original version.
Red Hat, as the licensor of this document, waives the right to enforce, and agrees not to assert, Section 4d of CC-BY-SA to the fullest extent permitted by applicable law.
Red Hat, Red Hat Enterprise Linux, the Shadowman logo, JBoss, MetaMatrix, Fedora, the Infinity Logo, and RHCE are trademarks of Red Hat, Inc., registered in the United States and other countries.
Linux® is the registered trademark of Linus Torvalds in the United States and other countries.
Java® is a registered trademark of Oracle and/or its affiliates.
XFS® is a trademark of Silicon Graphics International Corp. or its subsidiaries in the United States and/or other countries.
MySQL® is a registered trademark of MySQL AB in the United States, the European Union and other countries.
All other trademarks are the property of their respective owners.


1801 Varsity Drive
RaleighNC 27606-2072 USA
Phone: +1 919 754 3700
Phone: 888 733 4281
Fax: +1 919 754 3701

Daftar Isi

Abstract

This document describes the different features and utilities that make Red Hat Enterprise Linux 6 an ideal enterprise platform for application development. It focuses on Eclipse as an end-to-end integrated development environment (IDE), but also includes command line tools and other utilities outside Eclipse.
Preface
1. Document Conventions
1.1. Typographic Conventions
1.2. Pull-quote Conventions
1.3. Notes and Warnings
2. Getting Help and Giving Feedback
2.1. Do You Need Help?
2.2. We Need Feedback!
1. Eclipse Development Environment
1.1. Starting an Eclipse project
1.2. Eclipse User Interface
1.2.1. The Quick Access Menu
1.2.2. Keyboard Shortcuts
1.2.3. Customize Perspective
1.3. Editing C/C++ Source Code in Eclipse
1.3.1. libhover Plug-in
1.4. Editing Java Source Code in Eclipse
1.5. Eclipse RPM Building
1.6. Eclipse Documentation
2. Collaborating
2.1. Concurrent Versions System (CVS)
2.1.1. CVS Overview
2.1.2. Typical Scenario
2.1.3. CVS Documentation
2.2. Apache Subversion (SVN)
2.2.1. Installation
2.2.2. SVN Repository
2.2.3. Importing Data
2.2.4. Working Copies
2.2.5. Committing Changes
2.2.6. SVN Documentation
2.3. Git
2.3.1. Installation
2.3.2. Initial Setup
2.3.3. Git Repository
2.3.4. Untracked Files
2.3.5. Unmodified Files
2.3.6. Modified Status
2.3.7. Staged Files
2.3.8. Remote Repositories
2.3.9. Commit Logs
2.3.10. Fixing Problems
2.3.11. Git Documentation
3. Libraries and Runtime Support
3.1. Version Information
3.2. Compatibility
3.2.1. API Compatibility
3.2.2. ABI Compatibility
3.2.3. Policy
3.2.4. Static Linking
3.2.5. Core Libraries
3.2.6. Non-Core Libraries
3.3. Library and Runtime Details
3.3.1. compat-glibc
3.3.2. The GNU C++ Standard Library
3.3.3. Boost
3.3.4. Qt
3.3.5. KDE Development Framework
3.3.6. GNOME Power Manager
3.3.7. NSS Shared Databases
3.3.8. Python
3.3.9. Java
3.3.10. Ruby
3.3.11. Perl
4. Compiling and Building
4.1. GNU Compiler Collection (GCC)
4.1.1. GCC Status and Features
4.1.2. Language Compatibility
4.1.3. Object Compatibility and Interoperability
4.1.4. Backwards Compatibility Packages
4.1.5. Previewing Red Hat Enterprise Linux 6 compiler features on Red Hat Enterprise Linux 5
4.1.6. Running GCC
4.1.7. GCC Documentation
4.2. Distributed Compiling
4.3. Autotools
4.3.1. Autotools Plug-in for Eclipse
4.3.2. Configuration Script
4.3.3. Autotools Documentation
4.4. Eclipse Built-in Specfile Editor
4.5. CDT in Eclipse
4.5.1. Managed Make Project
4.5.2. Standard Make Project
4.5.3. Autotools Project
4.6. build-id Unique Identification of Binaries
4.7. Software Collections and scl-utils
5. Debugging
5.1. ELF Executable Binaries
5.2. Installing Debuginfo Packages
5.2.1. Installing Debuginfo Packages for Core Files Analysis
5.3. GDB
5.3.1. Simple GDB
5.3.2. Running GDB
5.3.3. Conditional Breakpoints
5.3.4. Forked Execution
5.3.5. Debugging Individual Threads
5.3.6. Alternative User Interfaces for GDB
5.3.7. GDB Documentation
5.4. Variable Tracking at Assignments
5.5. Python Pretty-Printers
5.6. Debugging C/C++ Applications with Eclipse
6. Profiling
6.1. Valgrind
6.1.1. Valgrind Tools
6.1.2. Using Valgrind
6.1.3. Valgrind Plug-in for Eclipse
6.1.4. Valgrind Documentation
6.2. OProfile
6.2.1. OProfile Tools
6.2.2. Using OProfile
6.2.3. OProfile Plug-in For Eclipse
6.2.4. OProfile Documentation
6.3. SystemTap
6.3.1. SystemTap Compile Server
6.3.2. SystemTap Support for Unprivileged Users
6.3.3. SSL and Certificate Management
6.3.4. SystemTap Documentation
6.4. Performance Counters for Linux (PCL) Tools and perf
6.4.1. Perf Tool Commands
6.4.2. Using Perf
6.5. ftrace
6.5.1. Using ftrace
6.5.2. ftrace Documentation
7. Red Hat Developer Toolset
7.1. What is Red Hat Developer Toolset?
7.2. What Does Red Hat Developer Toolset Offer?
7.3. Features and Improvements Provided by Red Hat Developer Toolset
7.3.1. GNU Compiler Collection (GCC)
7.3.2. GNU Debugger (GDB)
7.3.3. Binutils
7.4. Which Platforms Are Supported?
7.5. For More Information
8. Documentation Tools
8.1. Publican
8.1.1. Commands
8.1.2. Create a New Document
8.1.3. Files
8.1.4. Building a Document
8.1.5. Packaging a Publication
8.1.6. Brands
8.1.7. Building a Website
8.1.8. Documentation
8.2. Doxygen
8.2.1. Doxygen Supported Output and Languages
8.2.2. Getting Started
8.2.3. Running Doxygen
8.2.4. Documenting the Sources
8.2.5. Resources
A. Appendix
A.1. mallopt
B. Revision History
Index

Preface

This book describes the some of the more commonly-used programming resources in Red Hat Enterprise Linux 6. Each phase of the application development process is described as a separate chapter, enumerating tools that accomplish different tasks for that particular phase.
Note that this is not a comprehensive listing of all available development tools in Red Hat Enterprise Linux 6. In addition, each section herein does not contain detailed documentation of each tool. Rather, this book provides a brief overview of each tool, with a short description of updates to the tool in Red Hat Enterprise Linux 6 along with (more importantly) references to more detailed information.
In addition, this book focuses on Eclipse as an end-to-end integrated development platform. This was done to highlight the Red Hat Enterprise Linux 6 version of Eclipse and several Eclipse plug-ins.

1. Document Conventions

This manual uses several conventions to highlight certain words and phrases and draw attention to specific pieces of information.
In PDF and paper editions, this manual uses typefaces drawn from the Liberation Fonts set. The Liberation Fonts set is also used in HTML editions if the set is installed on your system. If not, alternative but equivalent typefaces are displayed. Note: Red Hat Enterprise Linux 5 and later includes the Liberation Fonts set by default.

1.1. Typographic Conventions

Four typographic conventions are used to call attention to specific words and phrases. These conventions, and the circumstances they apply to, are as follows.
Mono-spaced Bold
Used to highlight system input, including shell commands, file names and paths. Also used to highlight keys and key combinations. For example:
To see the contents of the file my_next_bestselling_novel in your current working directory, enter the cat my_next_bestselling_novel command at the shell prompt and press Enter to execute the command.
The above includes a file name, a shell command and a key, all presented in mono-spaced bold and all distinguishable thanks to context.
Key combinations can be distinguished from an individual key by the plus sign that connects each part of a key combination. For example:
Press Enter to execute the command.
Press Ctrl+Alt+F2 to switch to a virtual terminal.
The first example highlights a particular key to press. The second example highlights a key combination: a set of three keys pressed simultaneously.
If source code is discussed, class names, methods, functions, variable names and returned values mentioned within a paragraph will be presented as above, in mono-spaced bold. For example:
File-related classes include filesystem for file systems, file for files, and dir for directories. Each class has its own associated set of permissions.
Proportional Bold
This denotes words or phrases encountered on a system, including application names; dialog box text; labeled buttons; check-box and radio button labels; menu titles and sub-menu titles. For example:
Choose SystemPreferencesMouse from the main menu bar to launch Mouse Preferences. In the Buttons tab, click the Left-handed mouse check box and click Close to switch the primary mouse button from the left to the right (making the mouse suitable for use in the left hand).
To insert a special character into a gedit file, choose ApplicationsAccessoriesCharacter Map from the main menu bar. Next, choose SearchFind . . . . . . from the Character Map menu bar, type the name of the character in the Search field and click Next. The character you sought will be highlighted in the Character Table. Double-click this highlighted character to place it in the Text to copy field and then click the Copy button. Now switch back to your document and choose EditPaste from the gedit menu bar.
The above text includes application names; system-wide menu names and items; application-specific menu names; and buttons and text found within a GUI interface, all presented in proportional bold and all distinguishable by context.
Mono-spaced Bold Italic or Proportional Bold Italic
Whether mono-spaced bold or proportional bold, the addition of italics indicates replaceable or variable text. Italics denotes text you do not input literally or displayed text that changes depending on circumstance. For example:
To connect to a remote machine using ssh, type ssh username@domain.name at a shell prompt. If the remote machine is example.com and your username on that machine is john, type ssh [email protected].
The mount -o remount file-system command remounts the named file system. For example, to remount the /home file system, the command is mount -o remount /home.
To see the version of a currently installed package, use the rpm -q package command. It will return a result as follows: package-version-release.
Note the words in bold italics above - username, domain.name, file-system, package, version and release. Each word is a placeholder, either for text you enter when issuing a command or for text displayed by the system.
Aside from standard usage for presenting the title of a work, italics denotes the first use of a new and important term. For example:
Publican is a DocBook publishing system.

1.2. Pull-quote Conventions

Terminal output and source code listings are set off visually from the surrounding text.
Output sent to a terminal is set in mono-spaced roman and presented thus:
books Desktop   documentation  drafts  mss photos   stuff  svnbooks_tests  Desktop1  downloads  images  notes  scripts  svgs
Source-code listings are also set in mono-spaced roman but add syntax highlighting as follows:
package org.jboss.book.jca.ex1;import javax.naming.InitialContext;public class ExClient{   public static void main(String args[]) throws Exception   {  InitialContext iniCtx = new InitialContext();  Object ref = iniCtx.lookup("EchoBean");  EchoHome   home   = (EchoHome) ref;  Echo   echo   = home.create();  System.out.println("Created Echo");  System.out.println("Echo.echo('Hello') = " + echo.echo("Hello"));   }}

1.3. Notes and Warnings

Finally, we use three visual styles to draw attention to information that might otherwise be overlooked.

Note

Notes are tips, shortcuts or alternative approaches to the task at hand. Ignoring a note should have no negative consequences, but you might miss out on a trick that makes your life easier.

Important

Important boxes detail things that are easily missed: configuration changes that only apply to the current session, or services that need restarting before an update will apply. Ignoring a box labeled 'Important' will not cause data loss but may cause irritation and frustration.

Warning

Warnings should not be ignored. Ignoring warnings will most likely cause data loss.

2. Getting Help and Giving Feedback

2.1. Do You Need Help?

If you experience difficulty with a procedure described in this documentation, visit the Red Hat Customer Portal at http://access.redhat.com. Through the customer portal, you can:
  • search or browse through a knowledgebase of technical support articles about Red Hat products.
  • submit a support case to Red Hat Global Support Services (GSS).
  • access other product documentation.
Red Hat also hosts a large number of electronic mailing lists for discussion of Red Hat software and technology. You can find a list of publicly available mailing lists at https://www.redhat.com/mailman/listinfo. Click on the name of any mailing list to subscribe to that list or to access the list archives.

2.2. We Need Feedback!

If you find a typographical error in this manual, or if you have thought of a way to make this manual better, we would love to hear from you! Please submit a report in Bugzilla: http://bugzilla.redhat.com/ against the product Red_Hat_Enterprise_Linux.
When submitting a bug report, be sure to mention the manual's identifier: doc-Developer_Guide
If you have a suggestion for improving the documentation, try to be as specific as possible when describing it. If you have found an error, please include the section number and some of the surrounding text so we can find it easily.

Chapter 1. Eclipse Development Environment

Eclipse is a powerful development environment that provides tools for each phase of the development process. It is integrated into a single, fully configurable user interface for ease of use, featuring a pluggable architecture which allows for extension in a variety of ways.
Eclipse integrates a variety of disparate tools into a unified environment to create a rich development experience. The Valgrind plug-in, for example, allows programmers to perform memory profiling (normally done through the command line) through the Eclipse user interface. This functionality is not exclusive only to Eclipse.
Being a graphical application, Eclipse is a welcome alternative to developers who find the command line interface intimidating or difficult. In addition, Eclipse's built-in Help system provides extensive documentation for each integrated feature and tool. This greatly decreases the initial time investment required for new developers to become fluent in its use.
The traditional (that is, mostly command line based) Linux tools suite (gcc, gdb, etc) and Eclipse offer two distinct approaches to programming. Most traditional Linux tools are far more flexible, subtle, and (in aggregate) more powerful than their Eclipse-based counterparts. These traditional Linux tools, on the other hand, are more difficult to master, and offer more capabilities than are required by most programmers or projects. Eclipse, by contrast, sacrifices some of these benefits in favor of an integrated environment, which in turn is suitable for users who prefer their tools accessible in a single, graphical interface.

1.1. Starting an Eclipse project

Install eclipse with the following command:
# yum install eclipse
Once installed, Eclipse can be started either by manually executing /usr/bin/eclipse or by using the system menu created.
Eclipse stores all project and user files in a designated workspace. You can have multiple workspaces and can switch between each one on the fly. However, Eclipse will only be able to load projects from the current active workspace. To switch between active workspaces, navigate to File > Switch Workspace > /path/to/workspace. You can also add a new workspace through the Workspace Launcher wizard; to open this wizard, navigate to File > Switch Workspace > Other.
Workspace Launcher

Figure 1.1. Workspace Launcher


For information about configuring workspaces, refer to Reference > Preferences > Workspace in the Workbench User Guide (Help Contents).
A project can be imported directly into Eclipse if it contains the necessary Eclipse metafiles. Eclipse uses these files to determine what kind of perspectives, tools, and other user interface configurations to implement.
As such, when attempting to import a project that has never been used on Eclipse, it may be necessary to do so through the New Project wizard instead of the Import wizard. Doing so will create the necessary Eclipse metafiles for the project, which you can also include when you commit the project.
New Project Wizard

Figure 1.2. New Project Wizard


The Import wizard is suitable mostly for projects that were created or previously edited in Eclipse, that is, projects that contain the necessary Eclipse metafiles.
Import Wizard

Figure 1.3. Import Wizard


1.2. Eclipse User Interface

The entire user interface in Figure 1.4, "Eclipse User Interface (default)" is referred to as the Eclipse workbench. It is generally composed of a code Editor, Project Explorer window, and several views. All elements in the Eclipse workbench are configurable, and fully documented in the Workbench User Guide (Help Contents). Refer to Section 1.2.3, "Customize Perspective" for a brief overview on customizing the user interface.
Eclipse features different perspectives. A perspective is a set of views and editors most useful to a specific type of task or project; the Eclipse workbench can contain one or more perspectives. Figure 1.4, "Eclipse User Interface (default)" features the default perspective for C/C++.
Eclipse also divides many functions into several classes, housed inside distinct menu items. For example, the Project menu houses functions relating to compiling/building a project. The Window menu contains options for creating and customizing perspectives, menu items, and other user interface elements. For a brief overview of each main menu item, refer to Reference>C/C++ Menubar in the C/C++ Development User Guide or ReferenceMenus and Actions in the Java Development User Guide. These are found in the Eclipse help.
The following sections provide a high-level overview of the different elements visible in the default user interface of the Eclipse integrated development environment (IDE).
The Eclipse workbench provides a user interface for many features and tools essential for every phase of the development process. This section provides an overview of Eclipse's primary user interface.
Eclipse User Interface (default)

Figure 1.4. Eclipse User Interface (default)


Figure 1.4, "Eclipse User Interface (default)" displays the default workbench for C/C++ projects. To switch between available perspectives in a workbench, press Ctrl+F8. For some hints on perspective customization, refer to Section 1.2.3, "Customize Perspective". The figures that follow describe each basic element visible in the default C/C++ perspective.
Eclipse Editor

Figure 1.5. Eclipse Editor


The Editor is used to write and edit source files. Eclipse can auto-detect and load an appropriate language editor (for example, C Editor for files ending in .c) for most types of source files. To configure the settings for the Editor, navigate to Window > Preferences > language (for example, Java, C++) > Code Style.
Project Explorer

Figure 1.6. Project Explorer


The Project Explorer View provides a hierarchical view of all project resources (binaries, source files, etc.). You can open, delete, or otherwise edit any files from this view.
The View Menu button in the Project Explorer View allows you to configure whether projects or working sets are the top-level items in the Project Explorer View. A working set is a group of projects arbitrarily classified as a single set; working sets are handy in organizing related or linked projects.
Outline Window

Figure 1.7. Outline Window


The Outline window provides a condensed view of the code in a source file. It details different variables, functions, libraries, and other structural elements from the selected file in the Editor, all of which are editor-specific.
Console View

Figure 1.8. Console View


Some functions and plugged-in programs in Eclipse send their output to the Console view. This view's Display Selected Console button allows you to switch between different consoles.
Tasks View

Figure 1.9. Tasks View


The Tasks view allows you to track specially-marked reminder comments in the code. This view shows the location of each task comment and allows you to sort them in several ways.
Sample of Tracked Comment

Figure 1.10. Sample of Tracked Comment


Most Eclipse editors track comments marked with //FIXME or //TODO tags. Tracked comments-that is, task tags-are different for source files written in other languages. To add or configure task tags, navigate to Window > Preferences and use the keyword task tags to display the task tag configuration menus for specific editors/languages.
Task Properties

Figure 1.11. Task Properties


Alternatively, you can also use Edit > Add Task to open the task Properties menu (Figure 1.11, "Task Properties"). This will allow you to add a task to a specific location in a source file without using a task tag.
Problems View

Figure 1.12. Problems View


The Problems view displays any errors or warnings that occurred during the execution of specific actions such as builds, cleans, or profile runs. To display a suggested "quick fix" to a specific problem, select it and press Ctrl+1.

1.2.1. The Quick Access Menu

One of the most useful Eclipse tips is to use the quick access menu. Typing a word in the quick access menu will present a list of Views, Commands, Help files and other actions related to that word. To open this menu, press Ctrl+3.
Quick Access Menu

Figure 1.13. Quick Access Menu


In Figure 1.13, "Quick Access Menu", clicking Views > Project Explorer will select the Project Explorer window. Click any item from the Commands, Menus, New, or Preferences categories to run the selected item. This is similar to navigating to or clicking the respective menu options or taskbar icons. You can also navigate through the quick access menu using the arrow keys.

1.2.2. Keyboard Shortcuts

It is also possible to view a complete list of all keyboard shortcut commands; to do so, press Shift+Ctrl+L.
Keyboard Shortcuts

Figure 1.14. Keyboard Shortcuts


To configure Eclipse keyboard shortcuts, press Shift+Ctrl+L again while the Keyboard Shortcuts list is open.
Configuring Keyboard Shortcuts

Figure 1.15. Configuring Keyboard Shortcuts


1.2.3. Customize Perspective

To customize the current perspective, navigate to Window > Customize Perspective. This opens the Customize Perspective menu, allowing the visible tool bars, main menu items, command groups, and shortcuts to be configured.
The location of each view within the workbench can be customized by clicking on a view's title and dragging it to a desired location.
Customize Perspective Menu

Figure 1.16. Customize Perspective Menu


Figure 1.16, "Customize Perspective Menu" displays the Tool Bar Visibility tab. As the name suggests, this tab allows you to toggle the visibility of the tool bars (Figure 1.17, "Toolbar").
Toolbar

Figure 1.17. Toolbar


The following figures display the other tabs in the Customize Perspective Menu:
Menu Visibility Tab

Figure 1.18. Menu Visibility Tab


The Menu Visibility tab configures what functions are visible in each main menu item. For a brief overview of each main menu item, refer to Reference > C/C++ Menubar in the C/C++ Development User Guide or Reference > Menus and Actions in the Java Development User Guide.
Command Group Availability Tab

Figure 1.19. Command Group Availability Tab


Command groups add functions or options to the main menu or tool bar area. Use the Command Group Availability tab to add or remove a Command group. The Menubar details and Toolbar details fields display the functions or options added by the Command group to either Main Menu or Toolbar Area, respectively.
Shortcuts Tab

Figure 1.20. Shortcuts Tab


The Shortcuts tab configures what menu items are available under the following submenus:
  • File > New
  • Window > Open Perspective
  • Window > Show View

1.3. Editing C/C++ Source Code in Eclipse

Red Hat Enterprise Linux 6 provides Eclipse plug-ins for C/C++ development with the CDT. Specialized editors for C/C++ source code, makefiles, and GNU Autotools files are included. Functionality is also available for running and debugging programs.
The Eclipse text editor supports most of the features expected in a text editor, such as cut, copy, paste, and block selection (Ctrl+Shift+A). It also has some relatively unique features, such as the ability to move a selection (Alt+Up/Down Arrow).
Of particular interest to C/C++ programmers is the Content Assist feature. This feature presents a pop-up window with possible functions, variables, and templates for the current file/location. It is invoked by pressing Ctrl+Space while the cursor is at the desired location.
See Section 1.3.1, "libhover Plug-in" for more information on completion of function calls from libraries.
The Eclipse C/C++ code editor also has error highlighting and refactoring.
Code errors and warnings are annotated with colored wavy underlines. These errors and warnings may be present as code is entered into the editor, or they may be present only after a build has occurred and the compiler output has been transformed into these markers.
The provided refactoring tools include the ability to rename code elements. This change can then be reflected in both uses and declarations of the function.
See Section 5.6, "Debugging C/C++ Applications with Eclipse", or Section 4.3.1, "Autotools Plug-in for Eclipse" for more information, or refer to ConceptsCoding aids, ConceptsEditing C/C++ Files, and TasksWrite code in the C/C++ Development User Guide, found in the Help Contents.

1.3.1. libhover Plug-in

The libhover plug-in for Eclipse provides plug-and-play hover help support for the GNU C Library and GNU C++ Standard Library. This allows developers to refer to existing documentation on glibc and libstdc++ libraries within the Eclipse IDE in a more seamless and convenient manner via hover help and code completion.
C++ Language
Documentation for method completion is not supported for C++; only the prototypes from header files are supplied. In addition, the ability to add header files to the source file is not supported for C++ methods.
For C++ library resources, libhover has to index the file using the CDT indexer. Indexing parses the given file in context of a build; the build context determines where header files come from and how types, macros, and similar items are resolved. To be able to index a C++ source file, libhover usually requires an actual build to be performed first, although in some cases it may already know where the header files are located.
A C++ member function name is not enough information to look up its documentation so the libhover plug-in may require indexing for C++ sources. C++ allows different classes to have members of the same name, and even within a class, members may have the same name but with different method signatures. This requires the class name and parameter signature of the function to be provided to determine exactly which member is being referenced.
In addition, C++ also has type definitions and templated classes. Such information requires parsing an entire file and its associated include files; libhover can only do this via indexing.
C Language
For C functions, performing a completion (Ctrl+Space) will provide the list of C functions added to the potential sources (for example, typing prin and then hitting Ctrl+Space will list printf as one of the possible completions) and the documentation is viewed in an additional window, for determining exactly what C function is required.
Using Code Completion

Figure 1.21. Using Code Completion


C functions can be referenced in their documentation by name alone. As such, libhover does not have to index C source files in order to provide hover help or code completion. The appropriate header file include statement for a C library function can be automatically added if it is not already present.
Select the C function in the file and use right-click > Source > Add Include to automatically add the required header files to the source. This can also be done using Shift+Ctrl+N.

1.3.1.1. Setup and Usage

Hover help for all installed libhover libraries is enabled by default, and it can be disabled per project. To disable or enable hover help for a particular project, right-click the project name and click Properties. On the menu that appears, navigate to C/C++ General > Documentation. Check or uncheck a library in the Help books section to enable or disable hover help for that particular library.
Enabling/Disabling Hover Help

Figure 1.22. Enabling/Disabling Hover Help


Disabling hover help from a particular library may be preferable, particularly if multiple libhover libraries overlap in functionality. For example, if a libhover plug-in for a C library were manually installed, such as the newlib C library (note that newlib C library plug-in is not provided in Red Hat Enterprise Linux 6). The hover help would contain C functions whos names overlap with those in the GNU C library (provided by default). A user would not want both of these hover helps active at once, so disabling one would be practical.
When multiple libhover libraries are enabled and there exists a functional overlap between libraries, the Help content for the function from the first listed library in the Help books section will appear in hover help (that is, in Figure 1.22, "Enabling/Disabling Hover Help", glibc). For code completion, libhover will offer all possible alternatives from all enabled libhover libraries.
To use hover help, hover the mouse over a function name or member function name in the C/C++ Editor. After a short time, no more than a few seconds, libhover will display library documentation on the selected C function or C++ member function.
Using Hover Help

Figure 1.23. Using Hover Help


1.4. Editing Java Source Code in Eclipse

Red Hat Enterprise Linux 6 provides Eclipse plug-ins for Java (Java SE) development with the JDT. Specialized editors for Java source code as well as for ant build.xml files are included. Functionality is also available for running and debugging programs.
Eclipse provides a fully-featured interactive development environment for Java developers.
New Project Wizard
Eclipse's New Project Wizard performs most of the boilerplate setup required to start a Java project. This allows the user to select and customize various options, such as which Java Runtime Environment to use, or the preferred project file tree layout.
Follow the same procedure to export an existing project, and when prompted for a location, enter the existing project's location instead.
For more information regarding setting up a new Java project, refer to Help > Help Contents > Java Development > Getting Started > Basic Tutorial > Creating Your First Java Project.
Content Assistance
The Eclipse Java Development Environment (JDT) increases productivity and reduces errors by providing a rich set of content assistance features, usually invoked by pressing Ctrl + Space. This includes completion for method names in your code or in libraries, inserting parameter names in Javadoc, and filling in parameters when calling a method. This is fully customizable, allowing the options of suppressing certain suggestions or adding custom code templates to be filled in while writing code.
For an overview of these features, refer to Help > Help Contents > Java Development User Guide > Tips and Tricks.
Code Formatting
Code formatting, accessed by pressing Ctrl + Shift + F, is another useful feature present in the JDT. The formatting settings can be changed by navigating to Window > Preferences > Java > Code Styler > Formatter where there is the option of using a set of installed formatting profiles, or creating a new one to fit the style of the project.
Debugging Features
The JDT also comes with several debugging features. Create breakpoints by double-clicking on the left hand margin at the desired line of code. When the debugger is run, the program will stop at that line of code which is useful in detecting the location of errors.
The Debug Perspective, configured the first time the debugger is run, is a different layout that makes views related to debugging more prominent. For example, the Expressions view allows evaluation of Java expressions in the context of the current frame.
The views that make up the Debug Perspective, like all views, are accessed through Window > Show View and you do not have to be debugging to access these views.
While debugging, hover over variables to view their values or use the Variables view. Using the Debug view, it is possible to control the execution of programs and explore the various frames on the stack.
For more information on debugging in the JDT, refer to Help > Help Contents > Java Development > Getting Started > Basic Tutorial > Debugging Your Programs.
JDT Features
The JDT is highly customizable and comes with an extensive feature list which can be viewed through the settings in Window > Preferences > Java, and through the Java settings in Project > Properties. For detailed documentation of the JDT and its features, refer to the Java Development User Guide found in Help > Help Contents > Java Development User Guide.

1.5. Eclipse RPM Building

The Specfile Editor Plug-in for Eclipse provides useful features to help developers manage .spec files. This plug-in allows users to leverage several Eclipse GUI features in editing .spec files, such as auto-completion, highlighting, file hyperlinks, and folding.
In addition, the Specfile Editor Plug-in also integrates the rpmlint tool into the Eclipse interface. rpmlint is a command line tool that helps developers detect common RPM package errors. The richer visualization offered by the Eclipse interface helps developers quickly detect, view, and correct mistakes reported by rpmlint.
The Eclipse .spec file editor plug-in also supports building RPM files from RPM projects. This feature can be used by employing an export wizard (ImportRPMSource/Binary RPM) allowing the selection of whether a source RPM (src.rpm), binary RPM, or both, are required.
Build output is in the Eclipse Console view. For a limited number of build failures, there is hyperlinking support. That is, certain parts of the build failure are changed to be a hyperlink (Ctrl+Click) in the Eclipse Console view, which then points the user to the actual line in the .spec file that is causing the problem.
Also of note is the wizard for importing source RPM (.src.rpm) files, found in ImportRPMSource RPM). This allows the user to easily start with no configuration required, in case a source RPM has already been created. This project is then ready for editing the spec file and building (exporting) to source/binary RPMs.
For further details, refer to the Specfile Editor User GuideImport src.rpm and export rpm and src.rpm section in the Specfile Editor User Guide in Help Contents.

1.6. Eclipse Documentation

Eclipse features a comprehensive internal help library that covers nearly every facet of the Integrated Development Environment (IDE). Every Eclipse documentation plug-in installs its content to this library, where it is indexed. To access this library, use the Help menu.
Help

Figure 1.24. Help


To open the main Help menu, navigate to Help > Help Contents. The Help menu displays all the available content provided by installed documentation plug-ins in the Contents field.
Help Menu

Figure 1.25. Help Menu


The tabs at the bottom of the Contents field provides different options for accessing Eclipse documentation. You can navigate through each "book" by section/header or by searching via the Search field. You can also bookmark sections in each book and access them through the Bookmarks tab.
The Workbench User Guide documents all facets of the Eclipse user interface extensively. It contains very low-level information on the Eclipse workbench, perspectives, and different concepts useful in understanding how Eclipse works. The Workbench User Guide is an ideal resource for users with little to intermediate experience with Eclipse or IDEs in general. This documentation plug-in is installed by default.
The Eclipse help system also includes a dynamic help feature. This feature opens a new window in the workbench that displays documentation relating to a selected interface element. To activate dynamic help, navigate to Help > Dynamic Help.
Dynamic Help

Figure 1.26. Dynamic Help


The rightmost window in Figure 1.26, "Dynamic Help" displays help topics related to the Outline view, which is the selected user interface element.
(Sebelumnya) 29 : High Availability Add-On ...30 : Chapter 2. Collaborating ... (Berikutnya)