-
Language:
English
-
Language:
English
Red Hat Training
A Red Hat training course is available for Red Hat Developer Toolset
User Guide
Installing and Using Red Hat Developer Toolset
Jaromír Hradílek
Matt Newsome
Abstract
Part I. Introduction
Chapter 1. Red Hat Developer Toolset
1.1. About Red Hat Developer Toolset
What Is New in Red Hat Developer Toolset 4.1
Table 1.1. Red Hat Developer Toolset Components
Name | Version | Description |
---|---|---|
Eclipse | 4.5.2 | An integrated development environment with a graphical user interface.[a] |
GCC | 5.3.1 | A portable compiler suite with support for C, C++, and Fortran. |
binutils | 2.25.1 | A collection of binary tools and other utilities to inspect and manipulate object files and binaries. |
elfutils | 0.166 | A collection of binary tools and other utilities to inspect and manipulate ELF files. |
dwz | 0.12 | A tool to optimize DWARF debugging information contained in ELF shared libraries and ELF executables for size. |
GDB | 7.11 | A command line debugger for programs written in C, C++, and Fortran. |
ltrace | 0.7.91 | A debugging tool to display calls to dynamic libraries that a program makes. It can also monitor system calls executed by programs. |
strace | 4.10 | A debugging tool to monitor system calls that a program uses and signals it receives. |
memstomp | 0.1.5 | A debugging tool to identify calls to library functions with overlapping memory regions that are not allowed by various standards. |
SystemTap | 2.9 | A tracing and probing tool to monitor the activities of the entire system without the need to instrument, recompile, install, and reboot. |
Valgrind | 3.11.0 | An instrumentation framework and a number of tools to profile applications in order to detect memory errors, identify memory management problems, and report any use of improper arguments in system calls. |
OProfile | 1.1.0 | A system-wide profiler that uses the performance monitoring hardware on the processor to retrieve information about the kernel and executables on the system. |
Dyninst | 9.1.0 | A library for instrumenting and working with user-space executables during their execution. |
[a]
If you intend to develop applications for Red Hat JBoss Middleware or require support for OpenShift Tools, it is recommended that you use Red Hat JBoss Developer Studio.
|
- Red Hat Developer Toolset can be used on multiple major and minor releases of Red Hat Enterprise Linux, as detailed in Section 1.3, “Compatibility”.
Important
/opt/
directory and is explicitly enabled by the user on demand using the scl
utility.
1.2. Main Features
- Support for per-inferior thread numbers has been added.
- GDB now allows users to specify explicit locations, bypassing the linespec parser. This feature is also available to GDB/MI clients.
- GDB now has support for fork and exec events on remote-mode Linux targets. This enables
follow-fork-mode
,detach-on-fork
, andfollow-exec-mode
modes and fork and exec catchpoints.
- Improved security achieved through more intensive checking of the integrity of the binary files examined by the binutils tools. Therefore, it is much harder to make these tools crash or to attempt to read memory that does not belong to them.
1.3. Compatibility
Figure 1.1. Red Hat Developer Toolset 4.1 Compatibility Matrix
1.4. Getting Access to Red Hat Developer Toolset
1.4.1. Using Red Hat Subscription Management
- Determine the pool ID of a subscription that provides Red Hat Software Collections (and thus also Red Hat Developer Toolset). To do so, type the following at a shell prompt as
root
to display a list of all subscriptions that are available for your system:subscription-manager list --available
For each available subscription, this command displays its name, unique identifier, expiration date, and other details related to your subscription. The pool ID is listed on a line beginning withPool ID
.For a complete list of subscriptions that provide access to Red Hat Developer Toolset, see https://access.redhat.com/solutions/472793. - Attach the appropriate subscription to your system by running the following command as
root
:subscription-manager attach --pool=pool_id
Replace pool_id with the pool ID you determined in the previous step. To verify the list of subscriptions your system has currently attached, at any time, run asroot
:subscription-manager list --consumed
- Determine the exact name of the Red Hat Software Collections repository. To do so, type the following at a shell prompt as
root
to retrieve repository metadata and to display a list of available Yum repositories:subscription-manager repos --list
The repository names depend on the specific version of Red Hat Enterprise Linux you are using and are in the following format:rhel-variant-rhscl-version-rpms rhel-variant-rhscl-version-debug-rpms rhel-variant-rhscl-version-source-rpms
In addition, certain packages, such as devtoolset-4-gcc-plugin-devel, depend on packages that are only available in the Optional channel. The repository names with these packages use the following format:rhel-version-variant-optional-rpms rhel-version-variant-optional-debug-rpms rhel-version-variant-optional-source-rpms
For both the regular repositories and optional repositories, replace variant with the Red Hat Enterprise Linux system variant (server
orworkstation
), and version with the Red Hat Enterprise Linux system version (6-eus
,6
, or7
). - Enable the repositories from step no. 3 by running the following command as
root
:subscription-manager repos --enable repository
Replace repository with the name of the repository to enable.
1.4.2. Using RHN Classic
- Determine the exact name of the Red Hat Software Collections channel. To do so, type the following at a shell prompt as
root
to display a list of all channels that are available to you:rhn-channel --available-channels
The name of the channel depends on the specific version of Red Hat Enterprise Linux you are using and is in the following format:rhel-x86_64-variant-version-rhscl-1
In addition, certain packages, such as devtoolset-4-gcc-plugin-devel, depend on packages that are only available in the Optional channel. The name of this channel uses the following format:rhel-x86_64-variant-optional-6
Replace variant with the Red Hat Enterprise Linux system variant (server
orworkstation
). - Subscribe the system to the channels from step no. 1 by running the following command as
root
:rhn-channel --add --channel=channel_name
Replace channel_name with the name of the channel to enable. - To verify the list of channels you are subscribed to, at any time, run as
root
:rhn-channel --list
1.5. Installing Red Hat Developer Toolset
Important
1.5.1. Installing All Available Components
root
:
yum install devtoolset-4
Note
scl
utility was installed along with the Red Hat Developer Toolset software collection.
1.5.2. Installing Individual Package Groups
Table 1.2. Red Hat Developer Toolset Meta Packages
Package Name | Description | Installed Components |
---|---|---|
devtoolset-4-ide | Integrated Development Environment | Eclipse |
devtoolset-4-perftools | Performance monitoring tools | SystemTap, Valgrind, OProfile, Dyninst |
devtoolset-4-toolchain | Development and debugging tools | GCC, GDB, binutils, elfutils, dwz, memstomp, strace, ltrace |
root
:
yum install package_name
root
:
~]# yum install devtoolset-4-ide
1.5.3. Installing Optional Packages
yum list available devtoolset-4-\*
root
:
yum install package_name
~]# yum install devtoolset-4-gdb-gdbserver devtoolset-4-gdb-doc
1.5.4. Installing Debugging Information
root
:
debuginfo-install package_name
~]# debuginfo-install devtoolset-4-dwz
rhel-variant-rhscl-version-debug-rpms
repository as described in Section 1.4.1, “Using Red Hat Subscription Management”. If your system is registered with RHN Classic, subscribe the system to the rhel-x86_64-variant-version-debuginfo
channel as described in Section 1.4.2, “Using RHN Classic”. For more information on how to get access to debuginfo packages, see https://access.redhat.com/site/solutions/9907.
Note
1.6. Updating Red Hat Developer Toolset
1.6.1. Updating to a Minor Version
root
to update your Red Hat Enterprise Linux installation:
yum update
Important
1.6.2. Updating to a Major Version
1.7. Uninstalling Red Hat Developer Toolset
root
:
yum remove devtoolset-4\* libasan libatomic libcilkrts libitm liblsan libtsan libubsan
Note
libatomic
and libitm
libraries, which the above command attempts to remove, because they are not required for a proper function of Red Hat Developer Toolset components on that system. Nevertheless, the above command works as expected even on Red Hat Enterprise Linux 7.
1.8. Using Red Hat Developer Toolset Container Images
Note
1.8.1. Using Pre-Built Container Images
registry.access.redhat.com
:
- rhscl/devtoolset-4-toolchain-rhel7The image contains the following Red Hat Developer Toolset components:
- devtoolset-4-gcc
- devtoolset-4-gcc-c++
- devtoolset-4-gcc-fortran
- devtoolset-4-gdb
- rhscl/devtoolset-4-perftools-rhel7The image contains all Red Hat Developer Toolset components included in the devtoolset-4-perftools metapackage:
- devtoolset-4-oprofile
- devtoolset-4-systemtap
- devtoolset-4-valgrind
- devtoolset-4-dyninst
1.8.1.1. Pulling Pre-Built Container Images from the Registry
root
:
docker pull image_name
root
:
~]#
docker pull rhscl/devtoolset-4-toolchain-rhel7
1.8.1.2. Running Red Hat Developer Toolset Tools from Pre-Built Container Images
root
:
docker run image_name usage
root
:
docker run -ti image_name /bin/bash -l
root
:
~]#
docker run -ti rhscl/devtoolset-4-toolchain-rhel7 /bin/bash -l
Example 1.1. Using GCC in the Pre-Built Red Hat Developer Toolset Toolchain Image
gcc
compiler within that image.
- Make sure you have a Docker environment set up properly on your system by following instructions at Getting Docker in RHEL 7.
- Pull the pre-built toolchain Red Hat Developer Toolset container image from the official Red Hat Container Registry:
~]#
docker pull rhscl/devtoolset-4-toolchain-rhel7
- To launch the container image with an interactive shell, issue the following command:
~]#
docker run -ti rhscl/devtoolset-4-toolchain-rhel7 /bin/bash -l
- To launch the container as a regular (non-root) user, use the
sudo
command. To map a directory from the host system to the container file system, include the-v
(or--volume
) option in thedocker
command:~]$
sudo docker run -v ~/Source:/src -ti rhscl/devtoolset-4-toolchain-rhel7 /bin/bash -l
In the above command, the host's~/Source/
directory is mounted as the/src/
directory within the container. - Once you are in the container's interactive shell, you can run Red Hat Developer Toolset tools as expected. For example, to verify the version of the
gcc
compiler, run:bash-4.2$
gcc -v
[...] gcc version 5.2.1 20150716 (Red Hat 5.2.1-1) (GCC)
1.8.2. Using Container Images Built from Dockerfiles
- devtoolset-4-dyninst
- devtoolset-4-elfutils
- devtoolset-4-oprofile
- devtoolset-4-systemtap
- devtoolset-4-toolchain
- devtoolset-4-valgrind
- devtoolset-4
1.8.2.1. Obtaining Dockerfiles
~]#
yum install devtoolset-4-dockerfiles
1.8.2.2. Building Container Images
root
:
docker build -t image_name
Example 1.2. Building a Container Image with a Red Hat Developer Toolset Component
- Make sure you have a Docker environment set up properly on your system by following instructions at Getting Docker in RHEL 7.
- Install the package containing the Red Hat Developer Toolset Dockerfiles:
~]#
yum install devtoolset-4-dockerfiles
- Determine where the Dockerfile for the required component is located:
~]#
rpm -ql devtoolset-4-dockerfiles | grep "elfutils/Dockerfile"
/opt/rh/devtoolset-4/root/usr/share/devtoolset-4-dockerfiles/rhel7/devtoolset-4-elfutils/Dockerfile - Change to the directory where the required Dockerfile is installed:
~]#
cd /opt/rh/devtoolset-4/root/usr/share/devtoolset-4-dockerfiles/rhel7/devtoolset-4-elfutils/
- Build the container image:
~]#
docker build -t devtoolset-4-elfutils-7 .
Replace devtoolset-4-elfutils-7 with the name you wish to assign to your resulting container image.
1.8.2.3. Running Red Hat Developer Toolset Tools from Custom-Built Container Images
root
:
docker run image_name container-usage
root
:
docker run -ti image_name /bin/bash -l
Example 1.3. Using elfutils in a Custom-Built Red Hat Developer Toolset Image
eu-size
tool within that image.
- To launch the container image with an interactive shell, issue the following command:
~]#
docker run -ti devtoolset-4-elfutils-7 /bin/bash -l
- To launch the container as a regular (non-root) user, use the
sudo
command. To map a directory from the host system to the container file system, include the-v
(or--volume
) option in thedocker
command:~]$
sudo docker run -v ~/Source:/src -ti devtoolset-4-elfutils-7 /bin/bash -l
In the above command, the host's~/Source/
directory is mounted as the/src/
directory within the container. - Once you are in the container's interactive shell, you can run Red Hat Developer Toolset tools as expected. For example, to verify the version of the
eu-size
tool, run:bash-4.2$
eu-size -V
size (elfutils) 0.163 [...]
Using the SystemTap Tool from Container Images
- The image needs to be run with super-user privileges. To do this, run the image using the following command:
~]$
docker run --ti --privileged --ipc=host --net=host --pid=host devtoolset-4-systemtap /bin/bash -l
The above command assumes that you named the image devtoolset-4-systemtap when you built it from the Dockerfile (/opt/rh/devtoolset-4/root/usr/share/devtoolset-4-dockerfiles/rhel7/devtoolset-4-systemtap/Dockerfile
).To use the perftools image, substitute the image name for devtoolset-4-perftools-rhel7 in the above command. - The following kernel packages need to be installed in the container:
kernel kernel-devel kernel-debuginfo The version and release numbers of the above packages must match the version and release numbers of the kernel running on the host system. Run the following command to determine the version and release numbers of the hosts system's kernel:~]$
uname -r
3.10.0-229.14.1.el7.x86_64Note that the kernel-debuginfo package is only available from the Debug channel. Enable therhel-7-server-debug-rpms
repository as described in Section 1.4.1, “Using Red Hat Subscription Management”. For more information on how to get access to debuginfo packages, see https://access.redhat.com/site/solutions/9907.To install the required packages with the correct version, use the yum package manager and the output of theuname
command. For example, to install the correct version of the kernel package, run the following command asroot
:~]#
yum install -y kernel-$(uname -r)
- Save the container to a reusable image by executing the
docker commit
command. For example, to save the custom-built SystemTap container:~]$
docker commit devtoolset-4-systemtap-$(uname -r)
1.9. Additional Resources
Online Documentation
- Red Hat Subscription Management collection of guides — The Red Hat Subscription Management collection of guides provides detailed information on how to manage subscriptions on Red Hat Enterprise Linux.
- Red Hat Developer Toolset 4.1 Release Notes — The Release Notes for Red Hat Developer Toolset 4.1 contain more information.
- Red Hat Enterprise Linux 6 Developer Guide and Red Hat Enterprise Linux 7 Developer Guide — The Developer Guides for Red Hat Enterprise Linux 6 and 7 provide more information on the Eclipse IDE, libraries and runtime support, compiling and building, debugging, and profiling on these systems.
- Red Hat Enterprise Linux 6 Installation Guide and Red Hat Enterprise Linux 7 Installation Guide — The Installation Guides for Red Hat Enterprise Linux 6 an 7 explain how to obtain, install, and update the system.
- Red Hat Enterprise Linux 6 Deployment Guide — The Deployment Guide for Red Hat Enterprise Linux 6 documents relevant information regarding the deployment, configuration, and administration of Red Hat Enterprise Linux 6.
- Red Hat Enterprise Linux 7 System Administrator's Guide — The System Administrator's Guide for Red Hat Enterprise Linux 7 documents relevant information regarding the deployment, configuration, and administration of Red Hat Enterprise Linux 7.
- Get Started with Docker Formatted Container Images on Red Hat Systems — The guide contains a comprehensive overview of information about building and using docker-formatted container images on Red Hat Enterprise Linux 7 and Red Hat Enterprise Linux Atomic.
See Also
- Appendix B, Changes in Version 4.1 provides a list of changes and improvements over the version of the GNU Compiler Collection and GNU Debugger in the previous version of Red Hat Developer Toolset.
Part II. Integrated Development Environments
Chapter 2. Eclipse
Figure 2.1. Sample Eclipse Session
gcc
or gdb
) and Eclipse offer two distinct approaches to programming.
Table 2.1. Eclipse Components Included in Red Hat Developer Toolset
Package | Description |
---|---|
devtoolset-4-eclipse-cdt | The C/C++ Development Tooling (CDT), which provides features and plug-ins for development in C and C++. |
devtoolset-4-eclipse-emf | The Eclipse Modeling Framework (EMF), which allows you to build applications based on a structured data model. |
devtoolset-4-eclipse-gef | The Graphical Editing Framework (GEF), which allows you to create a rich graphical editor from an existing application model. |
devtoolset-4-eclipse-rse | The Remote System Explorer (RSE) framework, which allows you to work with remote systems from Eclipse. |
devtoolset-4-eclipse-jgit | JGit, a Java implementation of the Git revision control system. |
devtoolset-4-eclipse-egit | EGit, a team provider for Eclipse that provides features and plug-ins for interaction with Git repositories. |
devtoolset-4-eclipse-mylyn | Mylyn, a task management system for Eclipse. |
devtoolset-4-eclipse-pydev | A full featured Python IDE for Eclipse. |
devtoolset-4-eclipse-ptp | A subset of the PTP project providing support for synchronized projects. |
devtoolset-4-eclipse-pde | The Plugin Development Environment for developing Eclipse plugins. |
devtoolset-4-eclipse-tests | Eclipse tests. |
devtoolset-4-eclipse-linuxtools | A meta package for Linux-specific Eclipse plug-ins. |
devtoolset-4-eclipse-remote | The Remote Services plug-in, which provides an extensible remote-services framework. |
devtoolset-4-eclipse-changelog[a] | The ChangeLog plug-in, which allows you to create and maintain changelog files. |
devtoolset-4-eclipse-gcov[a] | The GCov plug-in, which integrates the GCov test coverage program with Eclipse. |
devtoolset-4-eclipse-gprof[a] | The Gprof plug-in, which integrates the Gprof performance analysis utility with Eclipse. |
devtoolset-4-eclipse-manpage[a] | The Man Page plug-in, which allows you to view manual pages in Eclipse. |
devtoolset-4-eclipse-oprofile[a] | The OProfile plug-in, which integrates OProfile with Eclipse. |
devtoolset-4-eclipse-perf[a] | The Perf plug-in, which integrates the perf tool with Eclipse. |
devtoolset-4-eclipse-rpm-editor[a] | The Eclipse Spec File Editor, which allows you to maintain RPM spec files. |
devtoolset-4-eclipse-systemtap[a] | The SystemTap plug-in, which integrates SystemTap with Eclipse. |
devtoolset-4-eclipse-valgrind[a] | The Valgrind plug-in, which integrates Valgrind with Eclipse. |
[a]
This package is installed as a dependency of devtoolset-4-eclipse-linuxtools.
|
2.1. Installing Eclipse
Note
2.2. Using Eclipse
scl enable devtoolset-4 'eclipse'
~/workspace/
, which is the default option, or click the Browse button to browse your file system and select a custom directory. Additionally, you can select the Use this as the default and do not ask again check box to prevent Eclipse from displaying this dialog box the next time you run this development environment. When you are done, click the OK button to confirm the selection and proceed with the startup.
2.2.1. Using the Red Hat Developer Toolset Toolchain
Important
2.2.2. Using the Red Hat Enterprise Linux Toolchain
gcc
, g++
, and as
.
- In the C/C++ perspective, choose Project → Properties from the main menu bar to open the project properties.
- In the menu on the left-hand side of the dialog box, click C/C++ Build → Settings.
- Select the Tool Settings tab.
- If you are working on a C project:
- select GCC C Compiler or Cross GCC Compiler and change the value of the Command field to:
/usr/bin/gcc
- select GCC C Linker or Cross GCC Linker and change the value of the Command field to:
/usr/bin/gcc
- select GCC Assembler or Cross GCC Assembler and change the value of the Command field to:
/usr/bin/as
If you are working on a C++ project:- select GCC C++ Compiler or Cross G++ Compiler and change the value of the Command field to:
/usr/bin/g++
- select GCC C Compiler or Cross GCC Compiler and change the value of the Command field to:
/usr/bin/gcc
- select GCC C++ Linker or Cross G++ Linker and change the value of the Command field to:
/usr/bin/g++
- select GCC Assembler or Cross GCC Assembler and change the value of the Command field to:
/usr/bin/as
- Click the OK button to save the configuration changes.
2.3. Additional Resources
Installed Documentation
- Eclipse includes a built-in Help system, which 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 use of this Help section is detailed in the Red Hat Enterprise Linux Developer Guide linked below.
See Also
- Section B.1, “Changes in Eclipse” provides a comprehensive list of features and improvements over the Eclipse development environment included in the previous release of Red Hat Developer Toolset.
- Chapter 1, Red Hat Developer Toolset provides an overview of Red Hat Developer Toolset and more information on how to install it on your system.
- Chapter 3, GNU Compiler Collection (GCC) provides information on how to compile programs written in C, C++, and Fortran on the command line.
Part III. Development Tools
Chapter 3. GNU Compiler Collection (GCC)
3.1. GNU C Compiler
3.1.1. Installing the C Compiler
3.1.2. Using the C Compiler
gcc
compiler as follows:
scl enable devtoolset-4 'gcc -o output_file source_file...'
-o
option is omitted, the compiler creates a file named a.out
by default.
scl enable devtoolset-4 'gcc -o object_file -c source_file'
-o
option is omitted, the compiler creates a file named after the source file with the .o
file extension. To link object files together and create a binary file, run:
scl enable devtoolset-4 'gcc -o output_file object_file...'
scl
utility, causing it to be run with the Red Hat Developer Toolset binaries used in preference to the Red Hat Enterprise Linux system equivalent. This allows you to run a shell session with Red Hat Developer Toolset gcc
as default:
scl enable devtoolset-4 'bash'
Note
gcc
you are using at any point, type the following at a shell prompt:
which gcc
gcc
executable path will begin with /opt
. Alternatively, you can use the following command to confirm that the version number matches that for Red Hat Developer Toolset gcc
:
gcc -v
Important
Note
-fcilkplus
option. A runtime library, libcilkrts
, is included in this release to support Cilk+. The libcilkrts
library has been a part of Red Hat Enterprise Linux since version 7.2, but the package is not included in all supported Red Hat Enterprise Linux releases. To enable dynamic linkage of binaries and libraries built with Red Hat Developer Toolset 4.1 GCC using Cilk+ features on supported Red Hat Enterprise Linux releases that do not contain libcilkrts
, install the libcilkrts.so
shared library from Red Hat Developer Toolset 4.1 with such binaries or libraries.
Example 3.1. Compiling a C Program on the Command Line
hello.c
with the following contents:
#include <stdio.h> int main(int argc, char *argv[]) { printf("Hello, World!\n"); return 0; }
gcc
compiler from Red Hat Developer Toolset, type:
~]$ scl enable devtoolset-4 'gcc -o hello hello.c'
hello
in the current working directory.
3.1.3. Running a C Program
gcc
compiles a program, it creates an executable binary file. To run this program on the command line, change to the directory with the executable file and type:
./file_name
Example 3.2. Running a C Program on the Command Line
hello
binary file as shown in Example 3.1, “Compiling a C Program on the Command Line”, you can run it by typing the following at a shell prompt:
~]$ ./hello
Hello, World!
3.2. GNU C++ Compiler
3.2.1. Installing the C++ Compiler
3.2.2. Using the C++ Compiler
g++
compiler as follows:
scl enable devtoolset-4 'g++ -o output_file source_file...'
-o
option is omitted, the g++
compiler creates a file named a.out
by default.
scl enable devtoolset-4 'g++ -o object_file -c source_file'
-o
option is omitted, the g++
compiler creates a file named after the source file with the .o
file extension. To link object files together and create a binary file, run:
scl enable devtoolset-4 'g++ -o output_file object_file...'
scl
utility, causing it to be run with the Red Hat Developer Toolset binaries used in preference to the Red Hat Enterprise Linux system equivalent. This allows you to run a shell session with Red Hat Developer Toolset g++
as default:
scl enable devtoolset-4 'bash'
Note
g++
you are using at any point, type the following at a shell prompt:
which g++
g++
executable path will begin with /opt. Alternatively, you can use the following command to confirm that the version number matches that for Red Hat Developer Toolset g++
:
g++ -v
Important
Example 3.3. Compiling a C++ Program on the Command Line
hello.cpp
with the following contents:
#include <iostream> using namespace std; int main(int argc, char *argv[]) { cout << "Hello, World!" << endl; return 0; }
g++
compiler from Red Hat Developer Toolset, type:
~]$ scl enable devtoolset-4 'g++ -o hello hello.cpp'
hello
in the current working directory.
3.2.3. Running a C++ Program
g++
compiles a program, it creates an executable binary file. To run this program on the command line, change to the directory with the executable file and type:
./file_name
Example 3.4. Running a C++ Program on the Command Line
hello
binary file as shown in Example 3.3, “Compiling a C++ Program on the Command Line”, you can run it by typing the following at a shell prompt:
~]$ ./hello
Hello, World!
3.2.4. C++ Compatibility
-std
mode are compatible with any other of those compilers in C++98 mode. A compiler in C++11 or C++14 mode is only guaranteed to be compatible with another compiler in C++11 or C++14 mode if they are from the same release series (for example from Red Hat Developer Toolset 4.x).
3.2.4.1. C++ ABI
-std=c++11
option is supported in Red Hat Developer Toolset 3.x only when all C++ objects compiled with that flag have been built using the same major version of Red Hat Developer Toolset. The mixing of objects, binaries and libraries, built by the Red Hat Enterprise Linux 6 or 7 system toolchain GCC using the -std=c++0x
or -std=gnu++0x
flags, with those built with the -std=c++11
or -std=gnu++11
flags using the GCC in Red Hat Developer Toolset is explicitly not supported.
-std=c++11
or -std=gnu++11
options cannot be guaranteed, and so is not supported.
-std=c++98
) can be freely mixed with binaries and shared libraries built by the Red Hat Enterprise Linux 6 or 7 system toolchain GCC. Red Hat recommends use of this default -std=c++98
mode for production software development.
Important
.o
/.a
files), the Red Hat Developer Toolset toolchain should be used for any linkage. This ensures any newer library features provided only by Red Hat Developer Toolset are resolved at link-time.
-Wabi
will now display a warning about code that uses the old mangling.
3.3. GNU Fortran Compiler
3.3.1. Installing the Fortran Compiler
3.3.2. Using the Fortran Compiler
gfortran
compiler as follows:
scl enable devtoolset-4 'gfortran -o output_file source_file...'
-o
option is omitted, the compiler creates a file named a.out
by default.
scl enable devtoolset-4 'gfortran -o object_file -c source_file'
-o
option is omitted, the compiler creates a file named after the source file with the .o
file extension. To link object files together and create a binary file, run:
scl enable devtoolset-4 'gfortran -o output_file object_file...'
scl
utility, causing it to be run with the Red Hat Developer Toolset binaries used in preference to the Red Hat Enterprise Linux system equivalent. This allows you to run a shell session with Red Hat Developer Toolset gfortran
as default:
scl enable devtoolset-4 'bash'
Note
gfortran
you are using at any point, type the following at a shell prompt:
which gfortran
gfortran
executable path will begin with /opt
. Alternatively, you can use the following command to confirm that the version number matches that for Red Hat Developer Toolset gfortran
:
gfortran -v
Important
Example 3.5. Compiling a Fortran Program on the Command Line
hello.f
with the following contents:
program hello print *, "Hello, World!" end program hello
gfortran
compiler from Red Hat Developer Toolset, type:
~]$ scl enable devtoolset-4 'gfortran -o hello hello.f'
hello
in the current working directory.
3.3.3. Running a Fortran Program
gfortran
compiles a program, it creates an executable binary file. To run this program on the command line, change to the directory with the executable file and type:
./file_name
Example 3.6. Running a Fortran Program on the Command Line
hello
binary file as shown in Example 3.5, “Compiling a Fortran Program on the Command Line”, you can run it by typing the following at a shell prompt:
~]$ ./hello
Hello, World!
3.4. Additional Resources
Installed Documentation
- gcc(1) — The manual page for the
gcc
compiler provides detailed information on its usage; with few exceptions,g++
accepts the same command line options asgcc
. To display the manual page for the version included in Red Hat Developer Toolset, type:scl enable devtoolset-4 'man gcc'
- gfortran(1) — The manual page for the
gfortran
compiler provides detailed information on its usage. To display the manual page for the version included in Red Hat Developer Toolset, type:scl enable devtoolset-4 'man gfortran'
- C++ Standard Library Documentation — Documentation on the C++ standard library can be optionally installed by typing the following at a shell prompt as
root
:yum install devtoolset-4-libstdc++-docs
Once installed, HTML documentation is available at/opt/rh/devtoolset-4/root/usr/share/doc/devtoolset-4-libstdc++-docs-5.3.1/html/index.html
.
Online Documentation
- Red Hat Enterprise Linux 6 Developer Guide and Red Hat Enterprise Linux 7 Developer Guide — The Developer Guides for Red Hat Enterprise Linux 6 and 7 provide in-depth information about GCC.
- Using the GNU Compiler Collection — The official GCC manual provides an in-depth description of the GNU compilers and their usage.
- The GNU C++ Library — The GNU C++ library documentation provides detailed information about the GNU implementation of the standard C++ library.
- The GNU Fortran Compiler — The GNU Fortran compiler documentation provides detailed information on
gfortran
's usage.
See Also
- Chapter 1, Red Hat Developer Toolset provides an overview of Red Hat Developer Toolset and more information on how to install it on your system.
- Chapter 2, Eclipse provides a general introduction to the Eclipse development environment, and describes how to use it with the tools from Red Hat Developer Toolset.
- Chapter 4, binutils explains how to use the binutils, a collection of binary tools to inspect and manipulate object files and binaries.
- Chapter 5, elfutils explains how to use elfutils, a collection of binary tools to inspect and manipulate ELF files.
- Chapter 6, dwz explains how to use dwz to optimize DWARF debugging information contained in ELF shared libraries and ELF executables for size.
- Chapter 7, GNU Debugger (GDB) provides information on how to debug programs written in C, C++, and Fortran.
Chapter 4. binutils
Table 4.1. Tools Included in binutils for Red Hat Developer Toolset
4.1. Installing binutils
4.2. Using the GNU Assembler
as
tool as follows:
scl enable devtoolset-4 'as [option...] -o object_file source_file'
scl
utility, causing it to be run with the Red Hat Developer Toolset binaries used in preference to the Red Hat Enterprise Linux system equivalent. This allows you to run a shell session with Red Hat Developer Toolset as
as default:
scl enable devtoolset-4 'bash'
Note
as
you are using at any point, type the following at a shell prompt:
which as
as
executable path will begin with /opt
. Alternatively, you can use the following command to confirm that the version number matches that for Red Hat Developer Toolset as
:
as -v
4.3. Using the GNU Linker
ld
tool as follows:
scl enable devtoolset-4 'ld [option...] -o output_file object_file...'
-o
option is omitted, the compiler creates a file named a.out
by default.
scl
utility, causing it to be run with the Red Hat Developer Toolset binaries used in preference to the Red Hat Enterprise Linux system equivalent. This allows you to run a shell session with Red Hat Developer Toolset ld
as default:
scl enable devtoolset-4 'bash'
Note
ld
you are using at any point, type the following at a shell prompt:
which ld
ld
executable path will begin with /opt
. Alternatively, you can use the following command to confirm that the version number matches that for Red Hat Developer Toolset ld
:
ld -v
4.4. Using Other Binary Tools
scl enable devtoolset-4 'tool [option...] file_name'
objdump
tool to inspect an object file, type:
scl enable devtoolset-4 'objdump [option...] object_file'
scl
utility, causing it to be run with the Red Hat Developer Toolset binaries used in preference to the Red Hat Enterprise Linux system equivalent. This allows you to run a shell session with Red Hat Developer Toolset binary tools as default:
scl enable devtoolset-4 'bash'
Note
which objdump
objdump
executable path will begin with /opt
. Alternatively, you can use the following command to confirm that the version number matches that for Red Hat Developer Toolset objdump
:
objdump -v
4.5. Additional Resources
Installed Documentation
- as(1), ld(1), addr2line(1), ar(1), c++filt(1), dwp(1), elfedit(1), gprof(1), nm(1), objcopy(1), objdump(1), ranlib(1), readelf(1), size(1), strings(1), strip(1), — Manual pages for various binutils tools provide more information about their respective usage. To display a manual page for the version included in Red Hat Developer Toolset, type:
scl enable devtoolset-4 'man tool'
Online Documentation
- Documentation for binutils — The binutils documentation provides an in-depth description of the binary tools and their usage.
See Also
- Section B.2, “Changes in binutils” provides a comprehensive list of features and improvements over the Red Hat Enterprise Linux 6.8 version of binutils and the version distributed in the 4.0 release of Red Hat Developer Toolset.
- Chapter 1, Red Hat Developer Toolset provides an overview of Red Hat Developer Toolset and more information on how to install it on your system.
- Chapter 5, elfutils explains how to use elfutils, a collection of binary tools to inspect and manipulate ELF files.
- Chapter 3, GNU Compiler Collection (GCC) provides information on how to compile programs written in C, C++, and Fortran.
Chapter 5. elfutils
eu-objdump
, eu-readelf
, and other utilities that allow you to inspect and manipulate ELF files. See Table 5.1, “Tools Included in elfutils for Red Hat Developer Toolset” for a complete list of binary tools that are distributed with the Red Hat Developer Toolset version of elfutils.
Table 5.1. Tools Included in elfutils for Red Hat Developer Toolset
5.1. Installing elfutils
5.2. Using elfutils
scl enable devtoolset-4 'tool [option...] file_name'
eu-objdump
tool to inspect an object file, type:
scl enable devtoolset-4 'eu-objdump [option...] object_file'
scl
utility, causing it to be run with the Red Hat Developer Toolset binaries used in preference to the Red Hat Enterprise Linux system equivalent. This allows you to run a shell session with Red Hat Developer Toolset binary tools as default:
scl enable devtoolset-4 'bash'
Note
which eu-objdump
eu-objdump
executable path will begin with /opt
. Alternatively, you can use the following command to confirm that the version number matches that for Red Hat Developer Toolset eu-objdump
:
eu-objdump -V
5.3. Additional Resources
See Also
- Section B.3, “Changes in elfutils” provides a comprehensive list of features and improvements over the version distributed in the previous release of Red Hat Developer Toolset.
- Chapter 1, Red Hat Developer Toolset provides an overview of Red Hat Developer Toolset and more information on how to install it on your system.
- Chapter 3, GNU Compiler Collection (GCC) provides information on how to compile programs written in C, C++, and Fortran.
- Chapter 4, binutils explains how to use the binutils, a collection of binary tools to inspect and manipulate object files and binaries.
- Chapter 6, dwz explains how to use dwz to optimize DWARF debugging information contained in ELF shared libraries and ELF executables for size.
Chapter 6. dwz
dwz
replaces DWARF information representation with equivalent smaller representation where possible and reduces the amount of duplication by using techniques from Appendix E of the DWARF Standard.
6.1. Installing dwz
dwz
utility is provided by the devtoolset-4-dwz package and is automatically installed with devtoolset-4-toolchain as described in Section 1.5, “Installing Red Hat Developer Toolset”.
6.2. Using dwz
dwz
tool as follows:
scl enable devtoolset-4 'dwz [option...] file_name'
scl
utility, causing it to be run with the Red Hat Developer Toolset binaries used in preference to the Red Hat Enterprise Linux system equivalent. This allows you to run a shell session with Red Hat Developer Toolset dwz
as default:
scl enable devtoolset-4 'bash'
Note
dwz
you are using at any point, type the following at a shell prompt:
which dwz
dwz
executable path will begin with /opt
. Alternatively, you can use the following command to confirm that the version number matches that for Red Hat Developer Toolset dwz
:
dwz -v
6.3. Additional Resources
Installed Documentation
- dwz(1) — The manual page for the
dwz
utility provides detailed information on its usage. To display the manual page for the version included in Red Hat Developer Toolset, type:scl enable devtoolset-4 'man dwz'
See Also
- Chapter 1, Red Hat Developer Toolset provides an overview of Red Hat Developer Toolset and more information on how to install it on your system.
- Chapter 3, GNU Compiler Collection (GCC) provides information on how to compile programs written in C, C++, and Fortran.
- Chapter 4, binutils explains how to use the binutils, a collection of binary tools to inspect and manipulate object files and binaries.
- Chapter 5, elfutils explains how to use elfutils, a collection of binary tools to inspect and manipulate ELF files.
Part IV. Debugging Tools
Chapter 7. GNU Debugger (GDB)
7.1. Installing the GNU Debugger
7.2. Preparing a Program for Debugging
Compiling Programs with Debugging Information
gcc
compiler is run with the -g
option. To do so on the command line, use a command in the following form:
scl enable devtoolset-4 'gcc -g -o output_file input_file...'
scl enable devtoolset-4 'g++ -g -o output_file input_file...'
Example 7.1. Compiling a C Program With Debugging Information
fibonacci.c
that has the following contents:
#include <stdio.h> #include <limits.h> int main (int argc, char *argv[]) { unsigned long int a = 0; unsigned long int b = 1; unsigned long int sum; while (b < LONG_MAX) { printf("%ld ", b); sum = a + b; a = b; b = sum; } return 0; }
~]$ scl enable devtoolset-4 'gcc -g -o fibonacci fibonacci.c'
fibonacci
in the current working directory.
Installing Debugging Information for Existing Packages
root
:
debuginfo-install
package_name
debuginfo-install
utility to be available on your system.
Example 7.2. Installing Debugging Information for the glibc Package
~]# debuginfo-install glibc
Loaded plugins: product-id, refresh-packagekit, subscription-manager
--> Running transaction check
---> Package glibc-debuginfo.x86_64 0:2.17-105.el7 will be installed
...
7.3. Running the GNU Debugger
scl enable devtoolset-4 'gdb file_name'
gdb
debugger in interactive mode and displays the default prompt, (gdb)
. To quit the debugging session and return to the shell prompt, run the following command at any time:
quit
scl
utility, causing it to be run with the Red Hat Developer Toolset binaries used in preference to the Red Hat Enterprise Linux system equivalent. This allows you to run a shell session with Red Hat Developer Toolset gdb
as default:
scl enable devtoolset-4 'bash'
Note
gdb
you are using at any point, type the following at a shell prompt:
which gdb
gdb
executable path will begin with /opt
. Alternatively, you can use the following command to confirm that the version number matches that for Red Hat Developer Toolset gdb
:
gdb -v
Example 7.3. Running the gdb Utility on the fibonacci Binary File
fibonacci
binary file as shown in Example 7.1, “Compiling a C Program With Debugging Information”, you can start debugging it with gdb
by typing the following at a shell prompt:
~]$ scl enable devtoolset-4 'gdb fibonacci'
GNU gdb (GDB) Red Hat Enterprise Linux (7.10-20.el7)
Copyright (C) 2015 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law. Type "show copying"
and "show warranty" for details.
This GDB was configured as "x86_64-redhat-linux-gnu".
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>.
Find the GDB manual and other documentation resources online at:
<http://www.gnu.org/software/gdb/documentation/>.
For help, type "help".
Type "apropos word" to search for commands related to "word".
(gdb)
7.4. Listing Source Code
list
gdb
displays the first ten lines of the source code, and any subsequent use of this command lists another ten lines. Once you start the execution, gdb
displays the lines that are surrounding the line on which the execution stops, typically when you set a breakpoint.
list
[file_name:]line_number
list
[file_name:]function_name
list
command displays by running the following command:
set
listsize
number
Example 7.4. Listing the Source Code of the fibonacci Binary File
fibonacci.c
file listed in Example 7.1, “Compiling a C Program With Debugging Information” has exactly 17 lines. Assuming that you have compiled it with debugging information and you want the gdb
utility to be capable of listing the entire source code, you can run the following command to change the number of listed lines to 20:
(gdb) set listsize 20
list
command with no additional arguments:
(gdb) list
1 #include <stdio.h>
2 #include <limits.h>
3
4 int main (int argc, char *argv[]) {
5 unsigned long int a = 0;
6 unsigned long int b = 1;
7 unsigned long int sum;
8
9 while (b < LONG_MAX) {
10 printf("%ld ", b);
11 sum = a + b;
12 a = b;
13 b = sum;
14 }
15
16 return 0;
17 }
7.5. Setting Breakpoints
Setting a New Breakpoint
break
[file_name:]line_number
break
[file_name:]function_name
Example 7.5. Setting a New Breakpoint
fibonacci.c
file listed in Example 7.1, “Compiling a C Program With Debugging Information” with debugging information, you can set a new breakpoint at line 10 by running the following command:
(gdb) break 10
Breakpoint 1 at 0x4004e5: file fibonacci.c, line 10.
Listing Breakpoints
info
breakpoints
Example 7.6. Listing Breakpoints
(gdb) info breakpoints
Num Type Disp Enb Address What
1 breakpoint keep y 0x00000000004004e5 in main at fibonacci.c:10
Deleting Existing Breakpoints
clear
line_number
clear
function_name
Example 7.7. Deleting an Existing Breakpoint
fibonacci.c
file listed in Example 7.1, “Compiling a C Program With Debugging Information” with debugging information, you can set a new breakpoint at line 7 by running the following command:
(gdb) break 7
Breakpoint 2 at 0x4004e3: file fibonacci.c, line 7.
(gdb) clear 7
Deleted breakpoint 2
7.6. Starting Execution
run
run
command:
run
argument…
Example 7.8. Executing the fibonacci Binary File
fibonacci
binary file by running the following command:
(gdb) run
Starting program: /home/john/fibonacci
Breakpoint 1, main (argc=1, argv=0x7fffffffe4d8) at fibonacci.c:10
10 printf("%ld ", b);
7.7. Displaying Current Values
gdb
utility allows you to display the value of almost anything that is relevant to the program, from a variable of any complexity to a valid expression or even a library function. However, the most common task is to display the value of a variable.
print
variable_name
Example 7.9. Displaying the Current Values of Variables
fibonacci
binary stopped after reaching the breakpoint at line 10, you can display the current values of variables a
and b
as follows:
(gdb)print a
$1 = 0 (gdb)print b
$2 = 1
7.8. Continuing Execution
continue
continue
command in the following form:
continue
number
gdb
utility also allows you to stop the execution after executing a single line of code. To do so, run:
step
step
command in the following form:
step
number
Example 7.10. Continuing the Execution of the fibonacci Binary File
fibonacci
binary stopped after reaching the breakpoint at line 10, you can resume the execution by running the following command:
(gdb) continue
Continuing.
Breakpoint 1, main (argc=1, argv=0x7fffffffe4d8) at fibonacci.c:10
10 printf("%ld ", b);
(gdb) step 3
13 b = sum;
sum
variable before it is assigned to b
:
(gdb) print sum
$3 = 2
7.9. Additional Resources
Online Documentation
- Red Hat Enterprise Linux 6 Developer Guide and Red Hat Enterprise Linux 7 Developer Guide — The Developer Guides for Red Hat Enterprise Linux 6 and 7 provide more information on the GNU Debugger and debugging.
- GDB Documentation — The official GDB documentation includes the GDB User Manual and other reference material.
See Also
- Section A.6, “Changes in GDB” provides a comprehensive list of features and improvements over the Red Hat Enterprise Linux system version of the GNU Debugger and the version distributed in the previous release of Red Hat Developer Toolset.
- Chapter 1, Red Hat Developer Toolset provides an overview of Red Hat Developer Toolset and more information on how to install it on your system.
- Chapter 2, Eclipse provides a general introduction to the Eclipse development environment, and describes how to use it with the tools from Red Hat Developer Toolset.
- Chapter 3, GNU Compiler Collection (GCC) provides further information on how to compile programs written in C, C++, and Fortran.
- Chapter 8, strace documents how to use the strace utility to monitor system calls that a program uses and signals it receives.
- Chapter 10, memstomp documents how to use the memstomp utility to identify calls to library functions with overlapping memory regions that are not allowed by various standards.
Chapter 8. strace
8.1. Installing strace
strace
utility is provided by the devtoolset-4-strace package and is automatically installed with devtoolset-4-toolchain as described in Section 1.5, “Installing Red Hat Developer Toolset”.
8.2. Using strace
strace
utility on a program you want to analyze, type the following at a shell prompt:
scl enable devtoolset-4 'strace program [argument...]'
-p
command line option followed by the process ID:
scl enable devtoolset-4 'strace -p process_id'
scl
utility, causing it to be run with the Red Hat Developer Toolset binaries used in preference to the Red Hat Enterprise Linux system equivalent. This allows you to run a shell session with Red Hat Developer Toolset strace
as default:
scl enable devtoolset-4 'bash'
Note
strace
you are using at any point, type the following at a shell prompt:
which strace
strace
executable path will begin with /opt
. Alternatively, you can use the following command to confirm that the version number matches that for Red Hat Developer Toolset strace
:
strace -V
8.2.1. Redirecting Output to a File
strace
prints the name of each system call, its arguments and the return value to standard error output. To redirect this output to a file, use the -o
command line option followed by the file name:
scl enable devtoolset-4 'strace -o file_name program [argument...]'
Example 8.1. Redirecting Output to a File
fibonacci
file from Example 7.1, “Compiling a C Program With Debugging Information”. This executable file displays the Fibonacci sequence and optionally allows you to specify how many members of this sequence to list. To run the strace
utility on this file and redirect the trace output to fibonacci.log
, type:
~]$ scl enable devtoolset-4 'strace -o fibonacci.log ./fibonacci 20'
1 1 2 3 5 8 13 21 34 55 89 144 233 377 610 987 1597 2584 4181 6765
fibonacci.log
in the current working directory.
8.2.2. Tracing Selected System Calls
strace
utility with the -e
command line option:
scl enable devtoolset-4 'strace -e expression program [argument...]'
Table 8.1. Commonly Used Values of the -e Option
Value | Description |
---|---|
file | System calls that accept a file name as an argument. |
process | System calls that are related to process management. |
network | System calls that are related to networking. |
signal | System calls that are related to signal management. |
ipc | System calls that are related to inter-process communication (IPC). |
desc | System calls that are related to file descriptors. |
Example 8.2. Tracing Selected System Calls
employee
file from Example 10.1, “Using memstomp”. To run the strace
utility on this executable file and trace only the mmap
and munmap
system calls, type:
~]$ scl enable devtoolset-4 'strace -e mmap,munmap ./employee'
mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7f896c744000
mmap(NULL, 61239, PROT_READ, MAP_PRIVATE, 3, 0) = 0x7f896c735000
mmap(0x3146a00000, 3745960, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 0x3146a00000
mmap(0x3146d89000, 20480, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_DENYWRITE, 3, 0x189000) = 0x3146d89000
mmap(0x3146d8e000, 18600, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|MAP_ANONYMOUS, -1, 0) = 0x3146d8e000
mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7f896c734000
mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7f896c733000
mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7f896c732000
munmap(0x7f896c735000, 61239) = 0
mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7f896c743000
John,john@example.comDoe,
+++ exited with 0 +++
8.2.3. Displaying Time Stamps
strace
utility with the -t
command line option:
scl enable devtoolset-4 'strace -t program [argument...]'
-t
option twice:
scl enable devtoolset-4 'strace -tt program [argument...]'
-r
command line option:
scl enable devtoolset-4 'strace -r program [argument...]'
Example 8.3. Displaying Time Stamps
pwd
. To run the strace
utility on this file and include time stamps in the output, type:
~]$ scl enable devtoolset-4 'strace -tt pwd'
19:43:28.011815 execve("./pwd", ["./pwd"], [/* 36 vars */]) = 0
19:43:28.012128 brk(0) = 0xcd3000
19:43:28.012174 mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7fc869cb0000
19:43:28.012427 open("/etc/ld.so.cache", O_RDONLY) = 3
19:43:28.012446 fstat(3, {st_mode=S_IFREG|0644, st_size=61239, ...}) = 0
19:43:28.012464 mmap(NULL, 61239, PROT_READ, MAP_PRIVATE, 3, 0) = 0x7fc869ca1000
19:43:28.012483 close(3) = 0
...
19:43:28.013410 +++ exited with 0 +++
8.2.4. Displaying a Summary
strace
utility with the -c
command line option:
scl enable devtoolset-4 'strace -c program [argument...]'
Example 8.4. Displaying a Summary
lsblk
. To run the strace
utility on this file and display a trace summary, type:
~]$ scl enable devtoolset-4 'strace -c lsblk > /dev/null'
% time seconds usecs/call calls errors syscall
------ ----------- ----------- --------- --------- ----------------
80.88 0.000055 1 106 16 open
19.12 0.000013 0 140 munmap
0.00 0.000000 0 148 read
0.00 0.000000 0 1 write
0.00 0.000000 0 258 close
0.00 0.000000 0 37 2 stat
...
------ ----------- ----------- --------- --------- ----------------
100.00 0.000068 1790 35 total
8.3. Additional Resources
Installed Documentation
- strace(1) — The manual page for the
strace
utility provides detailed information about its usage. To display the manual page for the version included in Red Hat Developer Toolset, type:scl enable devtoolset-4 'man strace'
See Also
- Chapter 1, Red Hat Developer Toolset provides an overview of Red Hat Developer Toolset and more information on how to install it on your system.
- Chapter 9, ltrace provides information on how to trace program library calls using the ltrace tool.
- Chapter 7, GNU Debugger (GDB) provides information on how to debug programs written in C, C++, and Fortran.
- Chapter 10, memstomp documents how to use the memstomp utility to identify calls to library functions with overlapping memory regions that are not allowed by various standards.
Chapter 9. ltrace
9.1. Installing ltrace
ltrace
utility is provided by the devtoolset-4-ltrace package and is automatically installed with devtoolset-4-toolchain as described in Section 1.5, “Installing Red Hat Developer Toolset”.
9.2. Using ltrace
ltrace
utility on a program you want to analyze, type the following at a shell prompt:
scl enable devtoolset-4 'ltrace program [argument...]'
-p
command line option followed by the process ID:
scl enable devtoolset-4 'ltrace -p process_id'
scl
utility, causing it to be run with the Red Hat Developer Toolset binaries used in preference to the Red Hat Enterprise Linux system equivalent. This allows you to run a shell session with Red Hat Developer Toolset ltrace
as default:
scl enable devtoolset-4 'bash'
Note
ltrace
you are using at any point, type the following at a shell prompt:
which ltrace
ltrace
executable path will begin with /opt
. Alternatively, you can use the following command to confirm that the version number matches that for Red Hat Developer Toolset ltrace
:
ltrace -V
9.2.1. Redirecting Output to a File
ltrace
prints the name of each system call, its arguments and the return value to standard error output. To redirect this output to a file, use the -o
command line option followed by the file name:
scl enable devtoolset-4 'ltrace -o file_name program [argument...]'
Example 9.1. Redirecting Output to a File
fibonacci
file from Example 7.1, “Compiling a C Program With Debugging Information”. This executable file displays the Fibonacci sequence and optionally allows you to specify how many members of this sequence to list. To run the ltrace
utility on this file and redirect the trace output to fibonacci.log
, type:
~]$ scl enable devtoolset-4 'ltrace -o fibonacci.log ./fibonacci 20'
1 1 2 3 5 8 13 21 34 55 89 144 233 377 610 987 1597 2584 4181 6765
fibonacci.log
in the current working directory.
9.2.2. Tracing Selected Library Calls
ltrace
utility with the -e
command line option:
scl enable devtoolset-4 'ltrace -e expression program [argument...]'
malloc
or free
) and patterns that identify library SONAMEs (such as libc.so
). For example, to trace call to the malloc
and free
function but to omit those that are done by the libc
library, use:
scl enable devtoolset-4 'ltrace -e malloc+free-@libc.so* program
'
Example 9.2. Tracing Selected Library Calls
ls
command. To run the ltrace
utility on this program and trace only the opendir
, readdir
, and closedir
function calls, type:
~]$ scl enable devtoolset-4 'ltrace -e opendir+readdir+closedir ls'
ls->opendir(".") = { 3 }
ls->readdir({ 3 }) = { 61533, "." }
ls->readdir({ 3 }) = { 131, ".." }
ls->readdir({ 3 }) = { 67185100, "BUILDROOT" }
ls->readdir({ 3 }) = { 202390772, "SOURCES" }
ls->readdir({ 3 }) = { 60249, "SPECS" }
ls->readdir({ 3 }) = { 67130110, "BUILD" }
ls->readdir({ 3 }) = { 136599168, "RPMS" }
ls->readdir({ 3 }) = { 202383274, "SRPMS" }
ls->readdir({ 3 }) = nil
ls->closedir({ 3 }) = 0
BUILD BUILDROOT RPMS SOURCES SPECS SRPMS
+++ exited (status 0) +++
9.2.3. Displaying Time Stamps
ltrace
utility with the -t
command line option:
scl enable devtoolset-4 'ltrace -t program [argument...]'
-t
option twice:
scl enable devtoolset-4 'ltrace -tt program [argument...]'
-r
command line option:
scl enable devtoolset-4 'ltrace -r program [argument...]'
Example 9.3. Displaying Time Stamps
pwd
command. To run the ltrace
utility on this program and include time stamps in the output, type:
~]$ scl enable devtoolset-4 'ltrace -tt pwd'
13:27:19.631371 __libc_start_main([ "pwd" ] <unfinished ...>
13:27:19.632240 getenv("POSIXLY_CORRECT") = nil
13:27:19.632520 strrchr("pwd", '/') = nil
13:27:19.632786 setlocale(LC_ALL, "") = "en_US.UTF-8"
13:27:19.633220 bindtextdomain("coreutils", "/usr/share/locale") = "/usr/share/locale"
13:27:19.633471 textdomain("coreutils") = "coreutils"
...
13:27:19.637110 +++ exited (status 0) +++
9.2.4. Displaying a Summary
ltrace
utility with the -c
command line option:
scl enable devtoolset-4 'ltrace -c program [argument...]'
Example 9.4. Displaying a Summary
lsblk
command. To run the ltrace
utility on this program and display a trace summary, type:
~]$ scl enable devtoolset-4 'ltrace -c lsblk > /dev/null'
% time seconds usecs/call calls function
------ ----------- ----------- --------- --------------------
53.60 0.261644 261644 1 __libc_start_main
4.48 0.021848 58 374 mbrtowc
4.41 0.021524 57 374 wcwidth
4.39 0.021409 57 374 __ctype_get_mb_cur_max
4.38 0.021359 57 374 iswprint
4.06 0.019838 74 266 readdir64
3.21 0.015652 69 224 strlen
...
------ ----------- ----------- --------- --------------------
100.00 0.488135 3482 total
9.3. Additional Resources
Installed Documentation
- ltrace(1) — The manual page for the
ltrace
utility provides detailed information about its usage. To display the manual page for the version included in Red Hat Developer Toolset, type:scl enable devtoolset-4 'man ltrace'
Online Documentation
- ltrace for RHEL 6 and 7 — This article on the Red Hat Developer Blog offers additional in-depth information (including practical examples) on how to use ltrace for application debugging.
See Also
- Chapter 1, Red Hat Developer Toolset provides an overview of Red Hat Developer Toolset and more information on how to install it on your system.
- Chapter 8, strace provides information on how to trace program system calls using the strace tool.
- Chapter 7, GNU Debugger (GDB) provides information on how to debug programs written in C, C++, and Fortran.
- Chapter 10, memstomp documents how to use the memstomp utility to identify calls to library functions with overlapping memory regions that are not allowed by various standards.
Chapter 10. memstomp
memstomp
utility inspects applications without the need to recompile them. However, it is much faster than this tool and therefore serves as a convenient alternative to it.
Table 10.1. Function Calls Inspected by memstomp
Function | Description |
---|---|
memcpy | Copies n bytes from one memory area to another and returns a pointer to the second memory area. |
memccpy | Copies a maximum of n bytes from one memory area to another and stops when a certain character is found. It either returns a pointer to the byte following the last written byte, or NULL if the given character is not found. |
mempcpy | Copies n bytes from one memory area to another and returns a pointer to the byte following the last written byte. |
strcpy | Copies a string from one memory area to another and returns a pointer to the second string. |
stpcpy | Copies a string from one memory area to another and returns a pointer to the terminating null byte of the second string. |
strncpy | Copies a maximum of n characters from one string to another and returns a pointer to the second string. |
stpncpy | Copies a maximum of n characters from one string to another. It either returns a pointer to the terminating null byte of the second string, or if the string is not null-terminated, a pointer to the byte following the last written byte. |
strcat | Appends one string to another while overwriting the terminating null byte of the second string and adding a new one at its end. It returns a pointer to the new string. |
strncat | Appends a maximum of n characters from one string to another while overwriting the terminating null byte of the second string and adding a new one at its end. It returns a pointer to the new string. |
wmemcpy | The wide-character equivalent of the memcpy () function that copies n wide characters from one array to another and returns a pointer to the second array. |
wmempcpy | The wide-character equivalent of the mempcpy () function that copies n wide characters from one array to another and returns a pointer to the byte following the last written wide character. |
wcscpy | The wide-character equivalent of the strcpy () function that copies a wide-character string from one array to another and returns a pointer to the second array. |
wcsncpy | The wide-character equivalent of the strncpy () function that copies a maximum of n wide characters from one array to another and returns a pointer to the second string. |
wcscat | The wide-character equivalent of the strcat () function that appends one wide-character string to another while overwriting the terminating null byte of the second string and adding a new one at its end. It returns a pointer to the new string. |
wcsncat | The wide-character equivalent of the strncat () function that appends a maximum of n wide characters from one array to another while overwriting the terminating null byte of the second wide-character string and adding a new one at its end. It returns a pointer to the new string. |
10.1. Installing memstomp
memstomp
utility is provided by the devtoolset-4-memstomp package and is automatically installed with devtoolset-4-toolchain as described in Section 1.5, “Installing Red Hat Developer Toolset”.
10.2. Using memstomp
memstomp
utility on a program you want to analyze, type the following at a shell prompt:
scl enable devtoolset-4 'memstomp program [argument...]'
--kill
(or -k
for short) command line option:
scl enable devtoolset-4 'memstomp --kill program [argument...]'
--kill
option is especially recommended if you are analyzing a multi-threaded program; the internal implementation of backtraces is not thread-safe and running the memstomp
utility on a multi-threaded program without this command line option can therefore produce unreliable results.
--debug-info
(or -d
) command line option to produce a more detailed backtrace:
scl enable devtoolset-4 'memstomp --debug-info program [argument...]'
scl
utility, causing it to be run with the Red Hat Developer Toolset binaries used in preference to the Red Hat Enterprise Linux system equivalent. This allows you to run a shell session with Red Hat Developer Toolset memstomp
as default:
scl enable devtoolset-4 'bash'
Example 10.1. Using memstomp
employee.c
with the following contents:
#include <stdio.h> #include <string.h> #define BUFSIZE 80 int main(int argc, char *argv[]) { char employee[BUFSIZE] = "John,Doe,john@example.com"; char name[BUFSIZE] = {0}; char surname[BUFSIZE] = {0}; char *email; size_t length; /* Extract the information: */ memccpy(name, employee, ',', BUFSIZE); length = strlen(name); memccpy(surname, employee + length, ',', BUFSIZE); length += strlen(surname); email = employee + length; /* Compose the new entry: */ strcat(employee, surname); strcpy(employee, name); strcat(employee, email); /* Print the result: */ puts(employee); return 0; }
employee
by using the following command:
~]$ scl enable devtoolset-4 'gcc -rdynamic -g -o employee employee.c'
~]$ scl enable devtoolset-4 'memstomp --debug-info ./employee'
memstomp: 0.1.4 successfully initialized for process employee (pid 14887).
strcat(dest=0x7fff13afc265, src=0x7fff13afc269, bytes=21) overlap for employee(14887)
??:0 strcpy()
??:0 strcpy()
??:0 _Exit()
??:0 strcat()
employee.c:26 main()
??:0 __libc_start_main()
??:0 _start()
John,john@example.comDoe,
10.3. Additional Resources
memstomp
and its features is beyond the scope of this book. For more information, see the resources listed below.
Installed Documentation
- memstomp(1) — The manual page for the
memstomp
utility provides detailed information about its usage. To display the manual page for the version included in Red Hat Developer Toolset, type:scl enable devtoolset-4 'man memstomp'
See Also
- Chapter 1, Red Hat Developer Toolset provides an overview of Red Hat Developer Toolset and more information on how to install it on your system.
- Chapter 7, GNU Debugger (GDB) provides information on how to debug programs written in C, C++, and Fortran.
- Chapter 8, strace documents how to use the strace utility to monitor system calls that a program uses and signals it receives.
- Chapter 12, Valgrind explains how to use Valgrind to profile applications and detect memory errors and memory management problems, such as the use of uninitialized memory, improper allocation and freeing of memory, and the use of improper arguments in system calls.
Part V. Performance Monitoring Tools
Chapter 11. SystemTap
netstat
, ps
, top
, and iostat
, others include pretty-printed function callgraph traces or tools for working around security bugs.
Table 11.1. Tools Distributed with SystemTap for Red Hat Developer Toolset
11.1. Installing SystemTap
SystemTap
is provided by the devtoolset-4-systemtap package and is automatically installed with devtoolset-4-perftools as described in Section 1.5, “Installing Red Hat Developer Toolset”.
Note
stap-prep
utility as follows:
scl enable devtoolset-4 'stap-prep'
root
user, the utility automatically offers the packages for installation. For more information on how to install these packages on your system, see the Red Hat Enterprise Linux 6 SystemTap Beginners Guide or the Red Hat Enterprise Linux 7 SystemTap Beginners Guide.
11.2. Using SystemTap
scl enable devtoolset-4 'tool [option...]'
stap
tool to build an instrumentation module, type:
scl enable devtoolset-4 'stap [option...] argument...'
scl
utility, causing it to be run with the Red Hat Developer Toolset binaries used in preference to the Red Hat Enterprise Linux system equivalent. This allows you to run a shell session with Red Hat Developer Toolset SystemTap as default:
scl enable devtoolset-4 'bash'
Note
which stap
stap
executable path will begin with /opt
. Alternatively, you can use the following command to confirm that the version number matches that for Red Hat Developer Toolset SystemTap:
stap -V
11.3. Additional Resources
Installed Documentation
- stap(1) — The manual page for the
stap
command provides detailed information on its usage, as well as references to other related manual pages. To display the manual page for the version included in Red Hat Developer Toolset, type:scl enable devtoolset-4 'man stap'
- staprun(8) — The manual page for the
staprun
command provides detailed information on its usage. To display the manual page for the version included in Red Hat Developer Toolset, type:scl enable devtoolset-4 'man staprun'
- SystemTap Tapset Reference Manual — HTML documentation on the most common tapset definitions is located at
/opt/rh/devtoolset-4/root/usr/share/doc/devtoolset-4-systemtap-client-2.8/index.html
.
Online Documentation
- Red Hat Enterprise Linux 6 SystemTap Beginners Guide and Red Hat Enterprise Linux 7 SystemTap Beginners Guide — The SystemTap Beginners Guides for Red Hat Enterprise Linux 6 and 7 provide an introduction to SystemTap and its usage.
- Red Hat Enterprise Linux 6 SystemTap Tapset Reference and Red Hat Enterprise Linux 7 SystemTap Tapset Reference — The SystemTap Tapset Reference for Red Hat Enterprise Linux 6 and 7 provides further details about SystemTap.
- The SystemTap Documentation — The official SystemTap documentation provides further documentation on SystemTap, as well as numerous examples of SystemTap scripts.
See Also
- Section B.5, “Changes in SystemTap” provides a comprehensive list of features and improvements over the version of SystemTap distributed in the previous release of Red Hat Developer Toolset.
- Chapter 1, Red Hat Developer Toolset provides an overview of Red Hat Developer Toolset and more information on how to install it on your system.
- Chapter 12, Valgrind explains how to use Valgrind to profile applications and detect memory errors and memory management problems, such as the use of uninitialized memory, improper allocation and freeing of memory, and the use of improper arguments in system calls.
- Chapter 13, OProfile explains how to use OProfile to determine which sections of code consume the greatest amount of CPU time and why.
- Chapter 14, Dyninst documents how to use the Dyninst library to instrument a user-space executable.
Chapter 12. Valgrind
Table 12.1. Tools Distributed with Valgrind for Red Hat Developer Toolset
12.1. Installing Valgrind
root
:
yum install devtoolset-4-valgrind-openmpi
Note
12.2. Using Valgrind
scl enable devtoolset-4 'valgrind [--tool=tool] program [argument...]'
--tool
command line option must be specified in lower case, and if this option is omitted, Valgrind uses Memcheck by default. For example, to run Cachegrind on a program to identify the sources of cache misses, type:
scl enable devtoolset-4 'valgrind --tool=cachegrind program [argument...]'
scl
utility, causing it to be run with the Red Hat Developer Toolset binaries used in preference to the Red Hat Enterprise Linux system equivalent. This allows you to run a shell session with Red Hat Developer Toolset Valgrind as default:
scl enable devtoolset-4 'bash'
Important
Note
which valgrind
valgrind
executable path will begin with /opt
. Alternatively, you can use the following command to confirm that the version number matches that for Red Hat Developer Toolset Valgrind:
valgrind --version
12.3. Rebuilding Valgrind
devtoolset-4-valgrind.src.rpm
) requires the openmpi-devel package version 1.3.3 or later. On Red Hat Enterprise Linux 6.8, running the yum -y install openmpi-devel
command results in installing the openmpi-1.10-devel package, and thus the requirement is unsatisfied. As a consequence, devtoolset-4-valgrind.src.rpm
cannot be rebuilt on Red Hat Enterprise Linux 6.8. Note that this problem does not occur in earlier releases of Red Hat Enterprise Linux 6.
12.4. Additional Resources
Installed Documentation
- valgrind(1) — The manual page for the
valgrind
utility provides detailed information on how to use Valgrind. To display the manual page for the version included in Red Hat Developer Toolset, type:scl enable devtoolset-4 'man valgrind'
- Valgrind Documentation — HTML documentation for Valgrind is located at
/opt/rh/devtoolset-4/root/usr/share/doc/devtoolset-4-valgrind-3.9.0/html/index.html
.
Online Documentation
- Red Hat Enterprise Linux 6 Developer Guide and Red Hat Enterprise Linux 7 Developer Guide — The Developer Guides for Red Hat Enterprise Linux 6 and 7 provide more information about Valgrind and its Eclipse plug-in.
- Red Hat Enterprise Linux 6 Performance Tuning Guide Red Hat Enterprise Linux 7 Performance Tuning Guide — The Performance Tuning Guides for Red Hat Enterprise Linux 6 and 7 provide more detailed information about using Valgrind to profile applications.
See Also
- Section B.7, “Changes in Valgrind” provides a comprehensive list of features and improvements over the version of Valgrind distributed in the previous release of Red Hat Developer Toolset.
- Chapter 1, Red Hat Developer Toolset provides an overview of Red Hat Developer Toolset and more information on how to install it on your system.
- Chapter 10, memstomp documents how to use the memstomp utility to identify calls to library functions with overlapping memory regions that are not allowed by various standards.
- Chapter 11, SystemTap provides an introduction to SystemTap and explains how to use it to monitor the activities of a running system.
- Chapter 13, OProfile explains how to use OProfile to determine which sections of code consume the greatest amount of CPU time and why.
- Chapter 14, Dyninst documents how to use the Dyninst library to instrument a user-space executable.
Chapter 13. OProfile
root
privileges to run.
Table 13.1. Tools Distributed with OProfile for Red Hat Developer Toolset
13.1. Installing OProfile
13.2. Using OProfile
root
:
scl enable devtoolset-4 'tool [option
...]'
ophelp
command to list available events in the XML format, type:
scl enable devtoolset-4 'ophelp -X'
scl
utility, causing it to be run with the Red Hat Developer Toolset binaries used in preference to the Red Hat Enterprise Linux system equivalent. This allows you to run a shell session with Red Hat Developer Toolset OProfile as default:
scl enable devtoolset-4 'bash'
Note
which operf
operf
executable path will begin with /opt
. Alternatively, you can use the following command to confirm that the version number matches that for Red Hat Developer Toolset OProfile:
operf --version
13.3. Additional Resources
Installed Documentation
- oprofile(1) — The manual page named oprofile provides an overview of OProfile and available tools. To display the manual page for the version included in Red Hat Developer Toolset, type:
scl enable devtoolset-4 'man oprofile'
- opannotate(1), oparchive(1), operf(1), opgprof(1), ophelp(1), opimport(1), opreport(1) — Manual pages for various tools distributed with OProfile provide more information on their respective usage. To display the manual page for the version included in Red Hat Developer Toolset, type:
scl enable devtoolset-4 'man tool'
Online Documentation
- Red Hat Enterprise Linux 6 Developer Guide and Red Hat Enterprise Linux 7 Developer Guide — The Developer Guides for Red Hat Enterprise Linux 6 and 7 provide more information on OProfile.
- Red Hat Enterprise Linux 6 Deployment Guide — The Deployment Guide for Red Hat Enterprise Linux 6 describes in detail how to install, configure, and start using OProfile on this system.
- Red Hat Enterprise Linux 7 System Administrator's Guide — The System Administrator's Guide for Red Hat Enterprise Linux 7 documents how to use the
operf
tool.
See Also
- Chapter 1, Red Hat Developer Toolset provides an overview of Red Hat Developer Toolset and more information on how to install it on your system.
- Chapter 11, SystemTap provides an introduction to SystemTap and explains how to use it to monitor the activities of a running system.
- Chapter 12, Valgrind explains how to use Valgrind to profile applications and detect memory errors and memory management problems, such as the use of uninitialized memory, improper allocation and freeing of memory, and the use of improper arguments in system calls.
- Chapter 14, Dyninst documents how to use the Dyninst library to instrument a user-space executable.
Chapter 14. Dyninst
root
users to instrument user-space executables.
14.1. Installing Dyninst
root
:
yum install devtoolset-4-dyninst-devel
root
:
yum install devtoolset-4-dyninst-doc
14.2. Using Dyninst
14.2.1. Using Dyninst with SystemTap
root
users to instrument user-space executables, run the stap
command with the --dyninst
(or --runtime=dyninst
) command line option. This tells stap
to translate a SystemTap script into C code that uses the Dyninst library, compile this C code into a shared library, and then load the shared library and run the script. Note that when executed like this, the stap
command also requires the -c
or -x
command line option to be specified.
scl enable devtoolset-4 "stap --dyninst
-c
'command' [option...] [argument...]"
scl enable devtoolset-4 "stap --dyninst
-x
process_id [option...] [argument...]"
Example 14.1. Using Dyninst with SystemTap
exercise.C
that has the following contents:
#include <stdio.h> void print_iteration(int value) { printf("Iteration number %d\n", value); } int main(int argc, char **argv) { int i; printf("Enter the starting number: "); scanf("%d", &i); for(; i>0; --i) print_iteration(i); return 0; }
print_iteration()
function for each iteration in order to print the number to the standard output. To compile this program on the command line using the g++
compiler from Red Hat Developer Toolset, type the following at a shell prompt:
~]$ scl enable devtoolset-4 'g++ -g -o exercise exercise.C'
count.stp
with the following contents:
#!/usr/bin/stap global count = 0 probe process.function("print_iteration") { count++ } probe end { printf("Function executed %d times.\n", count) }
print_iteration()
function was called during the execution of a process. To run this script on the exercise
binary file, type:
~]$scl enable devtoolset-4 "stap --dyninst -c './exercise' count.stp"
Enter the starting number:5
Iteration number 5 Iteration number 4 Iteration number 3 Iteration number 2 Iteration number 1 Function executed 5 times.
14.2.2. Using Dyninst as a Stand-alone Application
DYNINSTAPI_RT_LIB
environment variable to the path to the runtime library file. You can do so by typing the following at a shell prompt:
export DYNINSTAPI_RT_LIB=/opt/rh/devtoolset-4/root/usr/lib64/dyninst/libdyninstAPI_RT.so
DYNINSTAPI_RT_LIB
environment variable in the current shell session.
Example 14.2. Using Dyninst as a Stand-alone Application
exercise.C
source file from Example 14.1, “Using Dyninst with SystemTap”: this program prompts the user to enter a starting number and then counts down to 1, calling the print_iteration()
function for each iteration in order to print the number to standard output.
count.C
with the following contents:
#include <stdio.h> #include <fcntl.h> #include "BPatch.h" #include "BPatch_process.h" #include "BPatch_function.h" #include "BPatch_Vector.h" #include "BPatch_thread.h" #include "BPatch_point.h" void usage() { fprintf(stderr, "Usage: count <process_id> <function>\n"); } // Global information for counter BPatch_variableExpr *counter = NULL; void createCounter(BPatch_process *app, BPatch_image *appImage) { int zero = 0; counter = app->malloc(*appImage->findType("int")); counter->writeValue(&zero); } bool interceptfunc(BPatch_process *app, BPatch_image *appImage, char *funcName) { BPatch_Vector<BPatch_function *> func; appImage->findFunction(funcName, func); if(func.size() == 0) { fprintf(stderr, "Unable to find function to instrument()\n"); exit (-1); } BPatch_Vector<BPatch_snippet *> incCount; BPatch_Vector<BPatch_point *> *points; points = func[0]->findPoint(BPatch_entry); if ((*points).size() == 0) { exit (-1); } BPatch_arithExpr counterPlusOne(BPatch_plus, *counter, BPatch_constExpr(1)); BPatch_arithExpr addCounter(BPatch_assign, *counter, counterPlusOne); return app->insertSnippet(addCounter, *points); } void printCount(BPatch_thread *thread, BPatch_exitType) { int val = 0; counter->readValue(&val, sizeof(int)); fprintf(stderr, "Function executed %d times.\n", val); } int main(int argc, char *argv[]) { int pid; BPatch bpatch; if (argc != 3) { usage(); exit(1); } pid = atoi(argv[1]); BPatch_process *app = bpatch.processAttach(NULL, pid); if (!app) exit (-1); BPatch_image *appImage = app->getImage(); createCounter(app, appImage); fprintf(stderr, "Finding function %s(): ", argv[2]); BPatch_Vector<BPatch_function*> countFuncs; fprintf(stderr, "OK\nInstrumenting function %s(): ", argv[2]); interceptfunc(app, appImage, argv[2]); bpatch.registerExitCallback(printCount); fprintf(stderr, "OK\nWaiting for process %d to exit...\n", pid); app->continueExecution(); while (!app->isTerminated()) bpatch.waitForStatusChange(); return 0; }
Bpatch
objects before any of the Dyninst library destructors are called. Otherwise the mutator might terminate unexpectedly with a segmentation fault. To work around this problem, set the BPatch
object of the mutator as a local variable in the main()
function. Or, if you need to use BPatch
as a global variable, manually detach all the mutatee processes before the mutator exits.
Makefile
to build these two files:
DTS = /opt/rh/devtoolset-4/root CXXFLAGS = -g -I$(DTS)/usr/include/dyninst LBITS := $(shell getconf LONG_BIT) ifeq ($(LBITS),64) DYNINSTLIBS = $(DTS)/usr/lib64/dyninst else DYNINSTLIBS = $(DTS)/usr/lib/dyninst endif .PHONY: all all: count exercise count: count.C g++ $(CXXFLAGS) count.C -I /usr/include/dyninst -c g++ $(CXXFLAGS) count.o -L $(DYNINSTLIBS) -ldyninstAPI -o count exercise: exercise.C g++ $(CXXFLAGS) exercise.C -o exercise .PHONY: clean clean: rm -rf *~ *.o count exercise
g++
compiler from Red Hat Developer Toolset, run the make
utility as follows:
~]$ scl enable devtoolset-4 make
g++ -g -I/opt/rh/devtoolset-4/root/usr/include/dyninst count.C -c
g++ -g -I/opt/rh/devtoolset-4/root/usr/include/dyninst count.o -L /opt/rh/devtoolset-4/root/usr/lib64/dyninst -ldyninstAPI -o count
g++ -g -I/opt/rh/devtoolset-4/root/usr/include/dyninst exercise.C -o exercise
exercise
and count
in the current working directory.
exercise
binary file as follows and wait for it to prompt you to enter the starting number:
~]$ ./exercise
Enter the starting number:
DYNINSTAPI_RT_LIB
environment variable and execute the count
binary file:
~]$export DYNINSTAPI_RT_LIB=/opt/rh/devtoolset-4/root/usr/lib64/dyninst/libdyninstAPI_RT.so
~]$./count `pidof exercise` print_iteration
Finding function print_iteration(): OK Instrumenting function print_iteration(): OK Waiting for process 8607 to exit...
exercise
program. For example:
Enter the starting number: 5
Iteration number 5
Iteration number 4
Iteration number 3
Iteration number 2
Iteration number 1
exercise
program terminates, the count
program displays the number of times the print_iteration()
function was executed:
Function executed 5 times.
14.3. Additional Resources
Installed Documentation
/opt/rh/devtoolset-4/root/usr/share/doc/devtoolset-4-dyninst-doc-8.2.1/
directory:
- Dyninst Programmer's Guide — A detailed description of the Dyninst API is stored in the
DyninstAPI.pdf
file. - DynC API Programmer's Guide — An introduction to DynC API is stored in the
dynC_API.pdf
file. - ParseAPI Programmer's Guide — An introduction to the ParseAPI is stored in the
ParseAPI.pdf
file. - PatchAPI Programmer's Guide — An introduction to PatchAPI is stored in the
PatchAPI.pdf
file. - ProcControlAPI Programmer's Guide — A detailed description of ProcControlAPI is stored in the
ProcControlAPI.pdf
file. - StackwalkerAPI Programmer's Guide — A detailed description of StackwalkerAPI is stored in the
stackwalker.pdf
file. - SymtabAPI Programmer's Guide — An introduction to SymtabAPI is stored in the
SymtabAPI.pdf
file. - InstructionAPI Reference Manual — A detailed description of the InstructionAPI is stored in the
InstructionAPI.pdf
file.
Online Documentation
- Dyninst Home Page — The project home page provides links to additional documentation and related publications.
- Red Hat Enterprise Linux 6 SystemTap Beginners Guide — The SystemTap Beginners Guide for Red Hat Enterprise Linux 6 provides an introduction to SystemTap and its usage.
- Red Hat Enterprise Linux 7 SystemTap Beginners Guide — The SystemTap Beginners Guide for Red Hat Enterprise Linux 7 provides an introduction to SystemTap and its usage.
- Red Hat Enterprise Linux 6 SystemTap Tapset Reference — The SystemTap Tapset Reference for Red Hat Enterprise Linux 6 provides further details about SystemTap.
- Red Hat Enterprise Linux 7 SystemTap Tapset Reference — The SystemTap Tapset Reference for Red Hat Enterprise Linux 7 provides further details about SystemTap.
See Also
- Chapter 1, Red Hat Developer Toolset provides an overview of Red Hat Developer Toolset and more information on how to install it on your system.
- Chapter 11, SystemTap provides an introduction to SystemTap and explains how to use it to monitor the activities of a running system.
- Chapter 12, Valgrind explains how to use Valgrind to profile applications and detect memory errors and memory management problems, such as the use of uninitialized memory, improper allocation and freeing of memory, and the use of improper arguments in system calls.
- Chapter 13, OProfile explains how to use OProfile to determine which sections of code consume the greatest amount of CPU time and why.
Part VI. Getting Help
Chapter 15. Accessing Red Hat Product Documentation
Red Hat Developer Toolset
- Red Hat Developer Toolset 4.1 Release Notes — The Release Notes for Red Hat Developer Toolset 4.1 contain more information.
- Red Hat Software Collections Packaging Guide — The Software Collections Packaging Guide explains the concept of Software Collections and documents how to create, build, and extend them.
Red Hat Enterprise Linux
- Red Hat Enterprise Linux 6 Developer Guide and Red Hat Enterprise Linux 7 Developer Guide — The Developer Guides for Red Hat Enterprise Linux 6 and 7 provide more information about libraries and runtime support, compiling and building, debugging, and profiling.
- Red Hat Enterprise Linux 6 Installation Guide — The Installation Guide for Red Hat Enterprise Linux 6 explains how to obtain, install, and update the system.
- Red Hat Enterprise Linux 6 Installation Guide and Red Hat Enterprise Linux 7 Installation Guide — The Installation Guides for Red Hat Enterprise Linux 6 an 7 explain how to obtain, install, and update the system.
- Red Hat Enterprise Linux 6 Deployment Guide — The Deployment Guide for Red Hat Enterprise Linux 6 documents relevant information regarding the deployment, configuration, and administration of Red Hat Enterprise Linux 6.
- Red Hat Enterprise Linux 7 System Administrator's Guide — The System Administrator's Guide for Red Hat Enterprise Linux 7 documents relevant information regarding the deployment, configuration, and administration of Red Hat Enterprise Linux 7.
Chapter 16. Contacting Global Support Services
16.1. Gathering Required Information
Background Information
- Hardware type, make, and model on which the product runs
- Software version
- Latest upgrades
- Any recent changes to the system
- An explanation of the problem and the symptoms
- Any messages or significant information about the issue
Note
Diagnostics
root
:
yum
install
sos
root
:
sosreport
Account and Contact Information
- Red Hat customer number or Red Hat Network (RHN) login name
- Company name
- Contact name
- Preferred method of contact (phone or email) and contact information (phone number or email address)
Issue Severity
- Severity 1 (urgent)
- A problem that severely impacts your use of the software for production purposes. It halts your business operations and has no procedural workaround.
- Severity 2 (high)
- A problem where the software is functioning, but production is severely reduced. It causes a high impact to business operations, and no workaround exists.
- Severity 3 (medium)
- A problem that involves partial, non-critical loss of the use of the software. There is a medium to low impact on your business, and business continues to function by utilizing a workaround.
- Severity 4 (low)
- A general usage question, report of a documentation error, or a recommendation for a future product improvement.
16.2. Escalating an Issue
- Technical escalation
- If an issue is not being resolved appropriately or if you need a more senior resource to attend to it.
- Management escalation
- If the issue has become more severe or you believe it requires a higher priority.
16.3. Re-opening a Service Request
Important
16.4. Additional Resources
Online Documentation
- Getting Started — The Getting Started page serves as a starting point for people who purchased a Red Hat subscription and offers the Red Hat Welcome Kit and the Quick Guide to Red Hat Support for download.
- How can a RHEL Self-Support subscription be used? — A Knowledgebase article for customers with a Self-Support subscription.
- Red Hat Global Support Services and public mailing lists — A Knowledgebase article that answers frequent questions about public Red Hat mailing lists.
Appendix A. Changes in Version 4.0
A.1. Changes in Eclipse
A.1.1. Changes Since Red Hat Developer Toolset 3.1
- A new component, Eclipse Pydev, has been added. A full-featured Python IDE with features including code completion, type hinting, code analysis, refactoring, debugging, interactive console, unit test and code coverage integration, and many more.
- A new component, Eclipse PTP, has been added. It is a subset of the Eclipse PTP project (http://www.eclipse.org/ptp/) providing support for synchronized projects. Synchronized projects consist of files that are mirrored on the local system as well as on one or more remote systems. Editing occurs locally, and each file is synchronized with the currently active remote system when it is changed, created, or deleted. This enables faster interaction with the files and the editor, more CDT editor features because the files are local, and continued interaction for editing and other functions if the network connection is lost.
- The Eclipse Platform has been updated from version 4.4.1 to 4.5.0. As this is a feature release it contains a number of new features, bug fixes and optimizations including, among others, the following:
- The SWT GTK+3 back end (used by default on Red Hat Enterprise Linux 7) has been significantly enhanced. It is now the default whenever GTK+ 3.x is installed on the system.
- SWT now supports transparency.
- User experience on Hi-DPI monitors has been improved.
- The internal Jetty server has been updated to Jetty 9.x which implements the Servlet 3.1 specification.
- The Dark theme has been improved and graduated to a supported version (it was a technology preview in the previous version of Red Hat Developer Toolset). It can be accessed on the General → Appearance preference page.
- Search speed has been improved. Searching is now up to three to four times faster in case of full workspace searches on multi-core machines.
- Editor tabs can now be managed. For example, focus can be set to left or right of a closed tab, etc.
- Hierarchical project view has been added for easier navigation.
- Search functionality has been added to or enhanced in a number of dialogs, such as Open with..., Open Resource, and Plug-in Selection.
- The Console view has been improved. It now supports the Terminate All command, as well as output wrapping, scroll lock, and output limit.
- Refactorings have been added for better code by using lambdas.
- The speed of the Java compiler (ecj) has been improved significantly on generics-heavy code.
- Support for Java annotation has been enhanced: support for external annotations has been added, as well as the Annotate command for adding nullable information in the source. Annotations can now be rendered in the Javadoc view.
- Eclipse CDT (C and C++ Development Tooling) has been updated from version 8.6 to 8.7. This release includes a number of enhancements, including the following:
- Support for docker-formatted container images has been added. The new subcomponent provides a new, optional feature in CDT, which allows for running and debugging C and C++ applications in docker-formatted container images. To use this feature, select the Run as C/C++ Container Application or Debug as C/C++ Container Application menu items.
- Support for project-less execution has been added. Any C or C++ program can be run using the Run Configurations dialog window without being a part of a project.
- A wizard has been added for importing existing Autotools projects.
- The Mylyn task-management subsystem has been updated from version 3.14 to version 3.16. This new release includes the following changes:
- The Bugzilla connector has been improved to support for Bugzilla versions and fields.
- Support for saving and restoring breakpoints in task context has been added.
- The Eclipse Linux Tools plug-in collection has been updated from version 3.2 to 4.0. This major release includes significant changes, such as:
- Docker tooling has been added for managing and running docker-formatted container images from inside Eclipse.
- EGit, a Git integration plug-in for Eclipse, and JGit, a Java library implementing Git, have been updated from version 3.6.1 to 4.0.1. This update includes:
- Support has been added for honoring the
.gitattributes
configuration file. - Support has been added for pre-commit hooks.
- Support has been added for the Git-Flow workflow.
- Usability has been improved significantly. There are better and more numerous tooltips, busy indicators, etc.
- The Staging view now supports submodule repositories.
A.2. Changes in GCC
A.2.1. Changes Since Red Hat Developer Toolset 3.1
- Various inter-procedural optimization improvements, including:
- A new Identical Code Folding feature has been added, which tries to merge identical functions in order to save space.
- Devirtualization optimization has been significantly improved.
- Better optimization of dead code for C++ inline functions and virtual tables.
- Better optimization of write-only variables.
- Various link-time optimization improvements, including:
- GCC now utilizes One Definition Rule-based merging of C++ types, which allows better devirtualization and alias analysis.
- GCC now features lesser memory usage and faster linking speed.
- Various register-allocation improvements, including:
- A new control-flow sensitive global register rematerialization optimization has been added, which improves performance.
- The generation of PIC (Position-Independent Code) has been improved by reusing the PIC hard register.
- A new inter-procedural register allocator has been added, which brings better performance.
- The
Undefined Behavior Sanitizer
(ubsan) gained a few new sanitization options. It is now able to, for instance, detect out-of-bounds accesses and detect various misaligned objects. It is also capable of virtual-pointer checking for C++ code. - Offloading features of the OpenMP 4.0 specification are now supported by the C, C++, and Fortran compilers.
- Several new warnings options have been added, including:
-Wswitch-bool
, which warns whenever a switch statement has an index of a boolean type.-Wlogical-not-parentheses
, which warns about logical not used on the left-hand side operand of a comparison.-Wsizeof-array-argument
, which warns when thesizeof
operator is applied to a parameter that has been declared as an array in a function definition.-Wbool-compare
, which warns about boolean expressions compared with an integer value different from true or false.
- The preprocessor gained support for the
__has_include
and__has_include_next
macros, which can be used to test the availability of headers, as well as the__has_attribute
macro used to determine whether a specified attribute exists. - A new set of built-in functions for arithmetics with overflow checking has been added:
__builtin_add_overflow
,__builtin_sub_overflow
, and__builtin_mul_overflow
. - The default mode for C is now
-std=gnu11
instead of-std=gnu89
. - The C++ compiler now supports many C++14 features, for instance: variable templates, aggregates with non-static data member initializers, the extended
constexpr
specifier, sized deallocation functions, and others. The C++ compiler also supports several new warnings, for example, to help developers annotate programs withfinal
specifiers. - The Runtime Library (
libstdc++
) has been greatly improved. Note that unlike the upstream GCC 5.x, the Red Hat Developer Toolset 4.1 version of GCC does not use the new ABI.libstdc++
now has full support for the C++11 standard with the exception of the new implementations of thestd::string
andstd::list
classes because the Red Hat Developer Toolset 4.1 version of GCC uses the old ABI.Other notable features include, for example, movable and swappableiostream
classes, support for thestd::align
function and thestd::aligned_union
class template, locale facets for Unicode conversion, and atomic operations for thestd::shared_ptr
class template.libstdc++
now has full experimental support for the C++14 standard. This includes, for example, thestd::is_final
type trait.- The experimental support for the TS Library Fundamentals has been improved.
- GCC now contains the
libgccjit
library, which allows users to build GCC as a shared library for embedding in other processes, suitable for Just-In-Time (JIT) compilation to machine code. - GCC now contains support for new ISA (Instruction Set Architecture) extensions, including AVX512-VL (Vector Length Extensions), AVX512-BW (Byte and Word Instructions), and AVX512-DQ (Doubleword and Quadword Instructions) extensions on top of the already existing AVX-512 extensions.
Pointer Bounds Checker
has been added to GCC, which serves as a bounds violation detector. This tool only works on 32-bit a 64-bit Intel Linux targets with the new ISA extension Intel MPX support.- The Intel Memory Protection Extensions (MPX) support has been added to GCC in Red Hat Developer Toolset 4.0 for use with future releases of Red Hat Enterprise Linux 7 (beyond Red Hat Enterprise Linux 7.2) when the kernel enablement is complete. This feature will provide a set of extensions to the x86 Instruction Set Architecture (ISA), which can be used for bounds checking when performing pointer accesses. Note that this feature will not be supported on Red Hat Enterprise Linux 6.
A.3. Changes in binutils
A.3.1. Changes Since Red Hat Enterprise Linux 6.7
as
), GNU linker (ld
), and other binary tools that are part of binutils are now released under the GNU General Public License, version 3.
A.3.1.1. GNU Linker
gold
, is now available in addition to ld
, the existing GNU linker. gold
is intended to be a drop-in replacement for ld
, so ld
's documentation is intended to be the reference documentation. gold
supports most of ld
's features, except notable ones such as MRI-compatible linker scripts, cross-reference reports (--cref
), and various other minor options. It also provides significantly improved link time with very large C++ applications.
gold
linker is not enabled by default. Users can explicitly switch between ld
and gold
by using the alternatives
mechanism.
A.3.1.1.1. New Features
- A new
INPUT_SECTION_FLAGS
keyword has been added to the linker script language. This keyword can be used to select input sections by section header flags. - A new
SORT_BY_INIT_PRIORITY
keyword has been added to the linker script language. This keyword can be used to sort sections by numerical value of the GCCinit_priority
attribute encoded in the section name. - A new
SORT_NONE
keyword has been added to the linker script language. This keyword can be used to disable section sorting. - A new linker-provided symbol,
__ehdr_start
, has been added. When producing ELF output, this symbol points to the ELF file header (and nearby program headers) in the program's memory image.
A.3.1.1.2. Compatibility Changes
- The
--copy-dt-needed-entries
command line option is no longer enabled by default. Instead,--no-copy-dt-needed-entries
is now the default option. - Evaluation of linker script expressions has been significantly improved. Note that this can negatively affect scripts that rely on undocumented behavior of the old expression evaluation.
A.3.1.2. GNU Assembler
A.3.1.2.1. New Features
- The GNU Assembler no longer requires double ampersands in macros.
- A new
--compress-debug-sections
command line option has been added to enable compression of DWARF debug information sections in the relocatable output file. Compressed debug sections are currently supported by thereadelf
,objdump
, andgold
tools, but not byld
. - Support for
.bundle_align_mode
,.bundle_lock
, and.bundle_unlock
directives for x86 targets has been added.. - On x86 architectures, the GNU Assembler now allows
rep bsf
,rep bsr
, andrep ret
syntax.
A.3.1.3. Other Binary Tools
A.3.1.3.1. New Features
- Support for
dwz -m
optimized debug information has been added. - The devtoolset-2-binutils-devel package now provides the
demangle.h
header file.
A.3.2. Changes Since Red Hat Enterprise Linux 7.2
- The detection of uncompressed
.debug_str
sections has been fixed. - The decoding of abbreviations using the
DW_FORM_ref_addr
attribute has been fixed. - The objcopy utility now supports wildcards for section names in command line options.
- The BFD linker script language now supports the
ALIGN_WITH_INPUT
directive for output sections. The directive directs the linker to compute the maximum alignment of the associated input sections and use that alignment for the output section. - The AVX-512 (512-bit Advanced Vector Extensions) are now supported.
A.3.3. Changes Since Red Hat Developer Toolset 3.1
A.3.3.1. GNU Linker
- Binaries in the COFF/PE format now once again contain real timestamps by default. This was done so that the binaries will be compatible with tools from other vendors. However, including timestamps in binaries means that two identical builds made at different times will not compare as identical. The timestamps can be disabled using a command-line option,
--no-insert-timestamp
. - Binaries in the COFF/PE format can now have a build-id added to them using the
--build-id
command line option. This behaves in the same way as the--build-id
option does for binaries in the ELF format. - Support has been added for the AVR Tiny microcontrollers and the Andes NDS32 architecture.
- Support for the Openrisc and OR32 architectures has been replaced with support for the OR1K architecture.
A.3.3.2. GNU Assembler
- The ARM assembler now accepts output from the CodeComposer Studio tool. This is enabled using a new command line option,
-mccs
. - Support has been added for the AVR Tiny microcontrollers and the Andes NDS32 architecture.
- Support for the Openrisc and OR32 architectures has been replaced with support for the OR1K architecture.
A.3.3.3. Other Binary Tools
- The default behaviour of the
strings
program has changed. Instead of displaying strings only found in data sections of a program, it will now search all of the program, including the code sections. The old behaviour can be restored using a new command-line option,--data
.The change was made as a security enhancement because scanning the entire program for strings does not require any analysis of the program itself. The analysis code might contain bugs, which could be triggered by specially crafted bogus programs, thus exposing the system itself to attack. - The
strings
utility also has a new command-line option,--include-all-whitespace
. This stopsstrings
from splitting its output when it encounters a carriage return or the line feed character. - The
objcopy
utility has a new command-line option,--dump-section
. This allows individually named sections to be extracted from a program and copied into another file.
A.4. Changes in elfutils
A.4.1. Changes Since Red Hat Developer Toolset 3.1
- The following changes have been introduced in the libdw library:
- A new header file,
elfutils/known-dwarf.h
, has neen added. - The preliminary DWARF5 constants (
DW_TAG_atomic_type
,DW_LANG_Fortran03
, andDW_LANG_Fortran08
) have been added to theelfutils/dwarf.h
header file. - The
dwarf_peel_type ()
function now also handles theDW_TAG_atomic_type
constant.
- The following changes and improvements have been introduced in the eu-addr2line tool:
- Input addresses are now always interpreted as hexadecimal numbers, never as octal or decimal numbers.
- A new option,
-a
or--addresses
, has been added for printing addresses before each entry. - A new option,
-C
or--demangle
, has been added for showing demangled symbols. - A new option,
--pretty-print
, has been added for printing all information on one line.
A.5. Changes in dwz
A.5.1. Changes Since Red Hat Developer Toolset 3.1 and Red Hat Enterprise Linux 7.2
- The bug which resulted in the possibility of dwz producing binaries or shared libraries with unaligned non-allocated ELF sections has been fixed.
A.6. Changes in GDB
A.6.1. Changes Since Red Hat Developer Toolset 3.1
New Features
- GDB now honors the content of the
/proc/
file (PID
/coredump_filterPID
is the process ID). This file can be used to specify the types of memory mappings that will be included in a corefile. For more information, please see the core(5) manual page.GDB also has a new command:set use-coredump-filter on|off
. It allows to set whether GDB reads the content of the/proc/
file when generating a corefile.PID
/coredump_filter - The
info os
command can now be used to display information about CPUs. Runinfo os cpus
to list all CPUs and cores on the system. - The
info source
command can now be used to display the producer string (if it was included in the debugging information). The string usually contains the compiler version and command-line arguments. - Directory names supplied to the
set sysroot
commands may be prefixed withtarget:
to instruct GDB to access shared libraries from the target system, regardless of whether it is local or remote. This replaces theremote:
prefix. The default system root has been changed from "" (empty) totarget:
. For backward compatibility,remote:
is automatically converted totarget:
. - The system root specified by the
set sysroot
command is prepended to the filename of the main executable (if reported to GDB as absolute by the operating system) when starting processes remotely and when attaching to already-running local or remote processes. - GDB now supports automatic location and retrieval of executable files from remote targets. Remote debugging can now be initiated using only the
target remote
ortarget extended-remote
commands (noset sysroot
orfile
commands are required). See also the section called “New Remote Packets” below. - Support for the Verilog hexadecimal format has been added to the
dump
command. - GDB and gdbserver are now able to access executable and shared library files without the
set sysroot
command when attaching to processes running in different mount namespaces from the debugger. This makes it possible to attach to processes in containers as simply asgdb -p PID
orgdbserver --attach PID
. See also the section called “New Remote Packets” below. - Support for completion for all of the available register groups, including target-specific groups, has been added to the
tui reg
command. - The size of GDB's command history is no longer determined by reading the
HISTSIZE
environment variable. Instead, the dedicatedGDBHISTSIZE
environment variable is now used. To disable truncation of command history, setGDBHISTSIZE
to-1
or leave it empty. Non-numeric values are ignored. - Support for fork events on extended-remote Linux targets has been added. This makes it possible to use the
follow-fork-mode
anddetach-on-fork
options on targets with Linux kernels 2.5.60 and higher for both thefork
andvfork
calls, as well asfork
andvfork
catchpoints. - Using new
gdbfeatures
(fork-events
andvfork-events
), theqSupported
packet allows GDB to request support forfork
andvfork
events, and theqSupported
response can contain the correspondingstubfeatures
. Standardset
andshow
commands can be used to set and display whether these features are enabled. - The
info record
command now displays the format of the recording and when the btrace record target is used, it also shows the branch-tracing configuration for the current thread. In case of the BTS format, the command displays the ring buffer size. - Support for DTrace USDT (Userland Static Defined Tracing) probes has been added.
- GDB now supports the compilation and injection of source code into the inferior. GDB will use GCC 5.0 or higher built with
libcc1.so
to compile the source code to object code, and if successful, inject and execute that code within the current context of the inferior. Currently, the C language is supported. The commands used for interfacing with this new feature are:compile code [-raw|-r] [--] [source code]
compile file [-raw|-r] filename
- The
dll-symbols
command and its two aliases (add-shared-symbol-files
andassf
) have been removed. Use thesharedlibrary
command or its aliasshare
instead. - On resume, GDB now always passes the signal the program had stopped for to the thread the signal was sent to, even if the user changed threads before resuming. Previously, GDB would often (but not always) deliver the signal to the thread that happened to be current at resume time.
- Conversely, the
signal
command now consistently delivers the requested signal to the current thread. GDB now asks for confirmation if the program had stopped for a signal, and the user switched threads meanwhile. - The
off
andauto
states of thebreakpoint always-inserted
mode have been merged into one. Now, when thebreakpoint always-inserted
mode is set tooff
, GDB does not remove breakpoints from the target until all threads stop, even in non-stop mode. Theauto
mode has been removed, andoff
is now the default mode. - The
--xdb
command-line option (HP-UX XDB compatibility mode) has been removed.
New Remote Packets
Table A.1. New Remote Packets
Remote Packet | Description |
---|---|
qXfer:btrace-conf:read | Return the branch-trace configuration for the current thread. |
Qbtrace-conf:bts:size | Set the requested ring-buffer size for branch tracing in the BTS format. |
swbreak stop reason | Indicates a memory breakpoint instruction was executed, irrespective of whether it was GDB that planted the breakpoint or the breakpoint was hardcoded in the program. This is required for correct non-stop mode operation. |
hwbreak stop reason | Indicates the target stopped for a hardware breakpoint. This is required for correct non-stop mode operation. |
vFile:fstat: | Return information about files on the remote system. |
qXfer:exec-file:read | Return the full absolute name of the file that was executed to create a process running on the remote system. |
vFile:setfs: | Select the file system on which vFile: operations with file name arguments will operate. This is required for GDB to be able to access files on remote targets where the remote stub does not share a common file system with the inferior(s). |
fork stop reason | Indicates that a fork system call was executed. |
vfork stop reason | Indicates that a vfork system call was executed. |
vforkdone stop reason | Indicates that a vfork child of the specified process has executed an exec or exit function, allowing the vfork parent to resume execution. |
Python Scripting Support
- Objects of the
gdb.Objfile
class have a new attribute,username
, which is the user-specified name of the objfile. - Support for writing frame unwinders in Python has been added.
- A new method,
optimized_out
, has been added togdb.Type
objects. It is used for returning the optimized outgdb.Value
instance of this type. - New methods,
reference_value
andconst_value
, have been added togdb.Value
objects. They are used to return a reference to the value and theconst
version of the value, respectively. - Auto-loading of Python scripts contained in the
.debug_gdb_scripts
special section is now supported. Xmethods
can now specify the type of the result.- You can now access frame registers from Python scripts.
- The
producer
attribute forgdb.Symtab
objects has been added. - The
progspace
attribute forgdb.Objfile
objects has been added. It is thegdb.Progspace
object of the containing program space. - The
owner
attribute forgdb.Objfile
objects has been added. - The
build_id
attribute forgdb.Objfile
objects has been added. It is the build ID generated when the file was built. - The
add_separate_debug_file
method has been added togdb.Objfile
objects. - A new event,
gdb.clear_objfiles
, has been added. It is triggered when a new file for debugging is selected. - You can now add attributes to
gdb.Objfile
andgdb.Progspace
objects. - A new function,
gdb.lookup_objfile
, has been added.
- gdb.events.inferior_call_pre
- Function call is about to be made.
- gdb.events.inferior_call_post
- Function call has just been made.
- gdb.events.memory_changed
- A memory location has been altered.
- gdb.events.register_changed
- A register has been altered.
$_caller_is(name [, number_of_frames])
$_caller_matches(regexp [, number_of_frames])
$_any_caller_is(name [, number_of_frames])
$_any_caller_matches(regexp [, number_of_frames])
New Commands
set serial parity odd|even|none
,show serial parity
- Set or show parity for remote serial I/O.
maint print symbol-cache
- Print the contents of the symbol cache.
maint print symbol-cache-statistics
- Print statistics of symbol cache usage.
maint flush-symbol-cache
- Flush the contents of the symbol cache.
record btrace bts
,record bts
- Begin branch-trace recording using the Branch Trace Store (BTS) format.
tui enable
,tui disable
- Enable or and disable the TUI (Text User Interface) mode.
set mpx bound
,show mpx bound
- Investigate bound tables in Intel(R) MPX-enabled applications.
maint info btrace
- Display information about branch-tracing internals.
maint btrace packet-history
- Display raw branch-tracing data.
maint btrace clear-packet-history
- Discard stored raw branch-tracing data.
maint btrace clear
- Discard all branch-tracing data. The next invocation of the
record
command will fetch and process it again. demangle [-l language] [--] name
- Demangle name in the specified language or the current language if the parameter is omitted. This command replaces the renamed
maint demangle
command. The old command name is kept as a no-op command to avoidmaint demangle
being interpreted asmaint demangler-warning
. queue-signal signal-name-or-number
- Queue a signal to be delivered to the thread when it is resumed.
maint print user-registers
- Display all currently available user registers.
compile code [-r|-raw] [--] [source code]
- Compile, inject, and execute in the inferior the executable object code produced by compiling the provided source code.
compile [file -r|-raw] filename
- Compile and inject into the inferior the executable object code produced by compiling the source code stored in the filename provided.
compile print
- Evaluate an expression using the compiler and display the result.
New Options
set debug dwarf-die
,show debug dwarf-die
- Renamed from
set debug dwarf2-die
andshow debug dwarf2-die
respectively. set debug dwarf-read
,show debug dwarf-read
- Renamed from
set debug dwarf2-read
andshow debug dwarf2-read
respectively. maint set dwarf always-disassemble
,maint show dwarf always-disassemble
- Renamed from
maint set dwarf2 always-disassemble
andmaint show dwarf2 always-disassemble
respectively. maint set dwarf max-cache-age
,maint show dwarf max-cache-age
- Renamed from
maint set dwarf2 max-cache-age
andmaint show dwarf2 max-cache-age
respectively. set debug dwarf-line
,show debug dwarf-line
- Control display of debugging info regarding DWARF line processing.
set max-completions
,show max-completions
- Set the maximum number of candidates to be considered during completion. The default value is
200
. This limit allows GDB to avoid generating large completion lists, the computation of which can cause the debugger to become temporarily unresponsive. set history remove-duplicates
,show history remove-duplicates
- Control the removal of duplicate history entries.
maint set symbol-cache-size
,maint show symbol-cache-size
- Control the size of the symbol cache.
set record btrace bts buffer-size
,show record btrace bts buffer-size
- Set and show the size of the ring buffer used for branch tracing in the BTS format. The obtained size may differ from the requested size. To see the obtained buffer size, use the
info record
command. set debug linux-namespaces
,show debug linux-namespaces
- Control display of debugging info regarding Linux namespaces.
set debug symbol-lookup
,show debug symbol-lookup
- Control display of debugging info regarding symbol lookup.
thread apply all
command now supports a new option, -ascending
, for calling its specified command for all threads in an ascending order.
Change in the Machine Interface Interpreter (GDB/MI)
- The
-list-thread-groups
command outputs an exit-code field for inferiors that have exited.
A.7. Changes in strace
A.7.1. Changes Since Red Hat Developer Toolset 3.1 and Red Hat Enterprise Linux 6.7 and 7.2
- An experimental option,
-k
, has been added, which prints the execution stack trace of traced processes after each system call. - A new option,
-w
, has been added, which produces statistics on the differences between the start and end of every system call. - A new option,
-yy
, has been added to print protocol and address information associated with socket file descriptors. - The
-e read=set
and-e write=set
options have been extended to cover the following system calls:sendmsg
,recvmsg
,sendmmsg
, andrecvmmsg
. - Full decoding of 64-bit capability sets has been implemented.
- Support for the Bionic and musl standard C libraries has been improved.
- Tracing of x86 personality processes has been improved.
- The decoding of the following system calls has been implemented:
add_key
,getrandom
,ioprio_get
,ioprio_set
,kexec_load
,keyctl
,renameat2
,request_key
, andseccomp
. - The decoding of the
select
,pselect
, andio_submit
system calls has been made more robust. - The decoding of the following system calls has been improved:
delete_module
,fanotify_init
,fanotify_mark
,fcntl
,getsockopt
,setdomainname
,sethostname
,setns
,setsockopt
,sync_file_range
, andsysinfo
. - The socket decoder has been enhanced to support Bluetooth sockets.
- The decoding of the following has been implemented:
- all prctl commands
- parametrized ioctl commands
- evdev ioctl commands
- v4l ioctl commands
SG_IO
v4 ioctl commandsFIFREEZE
,FITHAW
,FITRIM
ioctl commandsFALLOC_FL_*
fallocate flagsrt_sigreturn
signal mask
- The decoding of the following has been improved:
- signal bitmasks
- file descriptors
- the
siginfo_t
data structure - the
PF_NETLINK
preprocessor macro - unlisted ioctl commands
- the
cmsghdr
struct - the wait status
- The
CAP_*
,CLOCK_*
,PR_*
,PTRACE_*
,SCHED_*
,SO_*
,SOL_*
,SWAP_FLAG_*
, andTFD_*
constants have been updated. - New system call entries have been added to match Linux 3.19.
- Lists of signal constants, errno constants, and ioctl commands have been updated from Linux 3.19.
- The test that required a Red Hat Enterprise Linux 7 kernel has been disabled.
A.8. Changes in ltrace
A.8.1. Changes Since Red Hat Developer Toolset 3.1 and Red Hat Enterprise Linux 7.2
- In configuration files, the user may now put a space between an indentifier and a following open parenthesis.
- The ltrace test suite now works correctly regardless of any installed
ltrace.conf
configuration file or other environmental effects.
A.9. Changes in SystemTap
A.9.1. Changes Since Red Hat Developer Toolset 3.1
- Documentation has been improved, including manual pages and cross references.
- Diagnostics have been improved. The output is now colorized.
- Namespace-aware identifier lookup functions have been added to the
tapset
library. - Golang support has been improved.
- String passing has been optimized.
- Functions in the
tapset
library now support address-to-file:line mapping. - System-call probes in the
tapset
have been improved, especially the non-DWARFnd_syscall
variants.
Note
--compatible version
, where version is the version of SystemTap for which the script was written.
A.10. Changes in OProfile
A.10.1. Changes Since Red Hat Developer Toolset 3.1
- The deprecated
opcontrol
andoprof_start
commands have been removed from OProfile 1.1.0. Theoperf
command should be used in their place. Theopreport
command is still used to analyze data stored in theoprofile_data/
directory byoperf
. - Support for new Intel processors, such as 6th Generation Intel Core Processors, Intel Xeon Processor D, and Airmont, has been added.
- Fixes have been included to avoid dropping samples from Java programs using Just-In-Time (JIT) translation due to use of anonymous hugepages and changes in the anonymous page mappings.
Appendix B. Changes in Version 4.1
B.1. Changes in Eclipse
B.1.1. Changes Since Red Hat Developer Toolset 4.0
- A new component, Eclipse TM Terminal, has been added. It is a small, re-usable component for terminal emulation and remote access.
- A new component, Eclipse Dynamic Languages Toolkit, has been added. It is a comprehensive Ruby, TCL, and Shell script IDE with features including code running and debugging, auto-completion, outlining, support for executing unit tests and graphically presenting the results, and others.
- The Eclipse Platform has been updated from version 4.5.0 to 4.5.2. As this is a bugfix release, it does not contains new features, only bug fixes and optimizations, including the following:
- The SWT GTK+3 back end (used by default on Red Hat Enterprise Linux 7) has been optimized for performance.
- SWT has gained better compatibility with GTK+ 3.14 (Red Hat Enterprise Linux 7.2) and features drawing fixes and other improvements.
- The Java formatter has been significantly improved.
- The stability and behavior of Drag'n'Drop operations has been improved.
- Eclipse CDT (C and C++ Development Tooling) has been updated from version 8.7 to 8.8.1. This release includes a number of enhancements, including the following:
- Memory views have been improved, including support for Find/Replace and Add Watchpoint.
- The readability of the Dissassembly view has been improved.
- Support for user-defined literals has added.
- The Mylyn task-management subsystem has been updated from version 3.16 to 3.18. This new release includes the following changes:
- The Task list view has been improved.
- The saving and restoring of breakpoints in the task context is now supported.
- The Eclipse Linux Tools plug-in collection has been updated from version 3.2 to 4.0. This major release includes significant changes, such as:
- A new subcomponent, the Vagrant plugin, has been added. The plugin supports interaction with Vagrant boxes and virtual machines.
- The Docker plugin gained support for searching the Docker registry for images and for running images directly. The plugin now also includes a full-featured interactive shell support.
- The OProfile plugin has gained support for the
ocount
tool. - The RPM plugin has gained support for weak dependencies (
Suggests
andRecommends
). - Manual pages are browsable and searchable through the Eclipse Help system.
- EGit, a Git integration plug-in for Eclipse, and JGit, a Java library implementing Git, have been updated from version 4.0.1 to 4.2.0. This update includes:
- Basic support for push certificates has been added.
- Performance has been improved by making use of the Java NIO (Non-blocking I/O).
- Support for the Remote [Add|List|Remove] Command has been added to the JGit API.
- Support for the gitflow model has been improved.
- The Staging view now supports submodule repositories.
- The Eclipse PyDev development environment for Python has been updated from version 4.1.0 to 4.5.4. This release includes a number of changes, such as:
- The debugger has been improved significantly.
- The PyDev Package Explorer has been improved to provide more information when all elements are filtered.
- Code completion has been improved.
- A new Python search page has been added, and the search backend is now backed by the Lucene engine.
- The Eclipse PTP (Parallel Tools Platform) has been updated from version 4.1.0 to 4.5.4.
B.2. Changes in binutils
B.2.1. Changes Since Red Hat Enterprise Linux 6.8
as
), GNU linker (ld
), and other binary tools that are part of binutils are now released under the GNU General Public License, version 3.
B.2.1.1. GNU Linker
gold
, is now available in addition to ld
, the existing GNU linker. gold
is intended to be a drop-in replacement for ld
, so ld
's documentation is intended to be the reference documentation. gold
supports most of ld
's features, except notable ones such as MRI-compatible linker scripts, cross-reference reports (--cref
), and various other minor options. It also provides significantly improved link time with very large C++ applications.
gold
linker is not enabled by default. Users can explicitly switch between ld
and gold
by using the alternatives
mechanism.
B.2.1.1.1. New Features
- A new
INPUT_SECTION_FLAGS
keyword has been added to the linker script language. This keyword can be used to select input sections by section header flags. - A new
SORT_BY_INIT_PRIORITY
keyword has been added to the linker script language. This keyword can be used to sort sections by numerical value of the GCCinit_priority
attribute encoded in the section name. - A new
SORT_NONE
keyword has been added to the linker script language. This keyword can be used to disable section sorting. - A new linker-provided symbol,
__ehdr_start
, has been added. When producing ELF output, this symbol points to the ELF file header (and nearby program headers) in the program's memory image.
B.2.1.1.2. Compatibility Changes
- The
--copy-dt-needed-entries
command line option is no longer enabled by default. Instead,--no-copy-dt-needed-entries
is now the default option. - Evaluation of linker script expressions has been significantly improved. Note that this can negatively affect scripts that rely on undocumented behavior of the old expression evaluation.
B.2.1.2. GNU Assembler
B.2.1.2.1. New Features
- The GNU Assembler no longer requires double ampersands in macros.
- A new
--compress-debug-sections
command line option has been added to enable compression of DWARF debug information sections in the relocatable output file. Compressed debug sections are currently supported by thereadelf
,objdump
, andgold
tools, but not byld
. - Support for
.bundle_align_mode
,.bundle_lock
, and.bundle_unlock
directives for x86 targets has been added.. - On x86 architectures, the GNU Assembler now allows
rep bsf
,rep bsr
, andrep ret
syntax.
B.2.1.3. Other Binary Tools
B.2.1.3.1. New Features
- Support for
dwz -m
optimized debug information has been added. - The devtoolset-2-binutils-devel package now provides the
demangle.h
header file.
B.2.2. Changes Since Red Hat Developer Toolset 4.0
- Improved security achieved through more intensive checking of the integrity of the binary files examined by the binutils tools. Therefore, it is much harder to make these tools crash or to attempt to read memory that does not belong to them.
B.3. Changes in elfutils
B.3.1. Changes Since Red Hat Developer Toolset 4.0
- Support for compressed ELF sections has been added.
- A new utility,
eu-elfcompress
, is used to compress or decompress ELF sections. Theeu-readelf
utility now has a new option,-z
or--decompress
, to show compressed headers and data. - The
libelf
library now supports various new functions, includingelf_compress
,elf_compress_gnu
,elf32_getchdr
,elf64_getchdr
, andgelf_getchdr
. - The
libdw
library now supports a new function,dwelf_scn_gnu_compressed_size
.
- pkg-config files for the
libelf
andlibdw
libraries are now available. - The
eu-strip
andeu-unstrip
tools are now capable of handling ELF files with mergedstrtab
andshstrtab
tables and handling missingSHF_INFO_LINK
section flags. - The
dwfl_standard_find_debuginfo
function now searches subdirectories of the binary path under the debuginfo root when the separate debug file cannot be found by build-id. - The
dwfl_linux_proc_attach
function can now be called before anyDwfl_Modules
have been reported.
B.4. Changes in GDB
B.4.1. Changes Since Red Hat Developer Toolset 4.0
New Features
- Thread numbers are now per-inferior instead of global. When debugging multiple inferiors, GDB now displays thread IDs using a qualified
INF_NUM.THR_NUM
form. For example:(gdb) info threads Id Target Id Frame 1.1 Thread 0x7ffff7fc2740 (LWP 8155) (running) 1.2 Thread 0x7ffff7fc1700 (LWP 8168) (running) * 2.1 Thread 0x7ffff7fc2740 (LWP 8157) (running) 2.2 Thread 0x7ffff7fc1700 (LWP 8190) (running)
As consequence, thread numbers visible in the$_thread
convenience variable and in Python'sInferiorThread.num
attribute are no longer unique between inferiors.GDB now maintains a second thread ID per thread, referred to as the global thread ID, which is the new equivalent of thread numbers in previous releases. See below for$_gthread
.For backwards compatibility, thread IDs of the Machine Interpreter (MI) always refer to global IDs. - Commands that accept thread IDs now accept the qualified
INF_NUM.THR_NUM
form as well. For example:(gdb) thread 2.1 [Switching to thread 2.1 (Thread 0x7ffff7fc2740 (LWP 8157))] (running) (gdb)
- In commands that accept a list of thread IDs, it is now possible to refer to all threads of an inferior using a star wildcard. GDB accepts
INF_NUM.*
, to refer to all threads of inferiorINF_NUM
, and*
to refer to all threads of the current inferior. For example,info threads 2.*
. - You can use the
info threads -gid
command to display the global thread ID of all threads. - The new
$_gthread
convenience variable holds the global number of the current thread. - The new
$_inferior
convenience variable holds the number of the current inferior. - For multi-threaded programs, GDB now displays the ID and the name of the thread that hit a breakpoint or received a signal. For example:
Thread 3 "bar" hit Breakpoint 1 at 0x40087a: file program.c, line 20. Thread 1 "main" received signal SIGINT, Interrupt.
- GDB now allows users to specify explicit locations, bypassing the linespec parser. This feature is also available to GDB/MI clients.
- The following commands now list corresponding items in ascending ID order to maintain consistency with all other
info
commands:info threads
,info inferiors
,info display
,info checkpoints
, andmaint info program-spaces
. - In the Ada programming language, the overloads selection menu has been enhanced to display the parameter types and the return types for the matching overloaded subprograms.
- Support has been added for thread names in the remote protocol. The reply to
qXfer:threads:read
may now include a name attribute for each thread. - GDB now has support for fork and exec events on remote-mode Linux targets. This enables
follow-fork-mode
,detach-on-fork
, andfollow-exec-mode
modes and fork and exec catchpoints.
New Commands
maint set target-non-stop [on|off|auto]
,maint show target-non-stop
- Controls whether GDB targets always operate in non-stop mode even if
set non-stop
is set tooff
. The default isauto
, which means non-stop mode is enabled if it is supported by the target. maint set bfd-sharing
,maint show bfd-sharing
- Controls whether
bfd
objects can be used more than once. set debug bfd-cache
,show debug bfd-cache
- Controls whether debugging information regarding
bfd
caching is displayed. set remote multiprocess-extensions-packet
,show remote multiprocess-extensions-packet
- Controls the use of remote protocol multiprocess extensions.
set remote thread-events
,show remote thread-events
- Controls the use of thread create and exit events.
set ada print-signatures on|off
,show ada print-signatures
- Controls the display of parameter types and return types in overloads selection menus. By default, this option is active (
on
). set max-value-size
,show max-value-size
- Controls the maximum number of bytes of memory that GDB is allowed to allocate for value contents. The option prevents GDB from allocating overly large buffers by accessing inconsistent data of a debugged program. The default amount is 64 kB.
set remote exec-event-feature-packet
,show remote exec-event-feature-packet
- GDB now has support for exec events on extended-remote Linux targets. This enables
follow-exec-mode
mode and exec catchpoints. The commands control the use of the remote exec event feature. set remote catch-syscall-packet
,show remote catch-syscall-packet
- GDB now has support for catching system calls on remote Linux targets. The commands control the use of the feature.
- The
disassemble
command now accepts a new modifier:/s
. When the modifier is used, the command prints mixed source code and disassembly similarly to the/m
modifier. There are two differences: disassembled instructions are now printed in program order, and source for all relevant files is now printed. The/m
option is now considered deprecated because its "source-centric" output has not proven useful in practice. - The
record instruction-history
command now accepts a new modifier:/s
. The option behaves exactly like the/m
modifier and prints mixed source code and disassembly. - The
set scheduler-locking
command now supports a new option,replay
. Whenset scheduler-locking replay
is used, it behaves likeoff
in record mode and likeon
in replay mode.
New Remote Packets
Table B.1. New Remote Packets
Remote Packet | Description |
---|---|
exec stop reason | Serves as an indicator that an exec system call was executed. |
exec-events feature in qSupported | Using the qSupported packet, support for exec events can be requested by GDB using the new gdbfeature exec event. The qSupported response can contain the corresponding stubfeature . Use appropriate set and show commands to enable these features and display the current setting. |
vCtrlC | An equivalent to interrupting with the ^C character, but it works in non-stop mode. |
thread created stop reason | Indicates that the thread has just been created and is stopped at entry. |
thread exit stop reply | Indicates that the thread has terminated. |
QThreadEvents | Enables or disables thread create and exit event reporting. For example, this is used in non-stop mode when GDB stops a set of threads and synchronously waits for the their corresponding stop replies. Without exit events, if one of the threads exits, GDB would wait forever not knowing that it should no longer expect a stop for that same thread. |
N stop reply | Indicates that there are no resumed threads left in the target (all threads are stopped). The remote stub reports support for this stop reply to the qSupported query by GDB. |
QCatchSyscalls | Enables or disables catching system calls from the inferior process. The remote stub reports support for this packet to the qSupported query of GDB. |
syscall_entry stop reason | Indicates that a system call was just called. |
syscall_return stop reason | Indicates that a system call just returned. |
Python Scripting Support
gdb.InferiorThread
objects now have a new attribute,global_num
, which refers to the global thread ID. The existingnum
attribute now refers to the per-inferior number of the thread. See per-inferior thread numbers: the section called “New Features”.gdb.InferiorThread
objects now have a new attribute,inferior
, which is theInferior
object the thread belongs to.
Change in the Machine Interface Interpreter (GDB/MI)
- The
-var-set-format
command has been enhanced to support input in zero-hexadecimal format. The output of the command is in the hexadecimal format with zero-padding on the left.
B.5. Changes in SystemTap
B.5.1. Changes Since Red Hat Developer Toolset 4.0
- The manual pages have been improved and are now more complete.
- The support for kernel backtraces without debuginfo has been improved.
- Debuginfo-related diagnostics have been improved.
- The amount of memory used by the translator has been reduced.
- Code generated by the tool now performs better.
Note
--compatible version
, where version is the version of SystemTap for which the script was written.
B.6. Changes in dyninst
B.6.1. Changes Since Red Hat Developer Toolset 4.0
- The new
StackMod
class now modifies the stack frame of theBPatch_function
function. - Dyninst now has a defensive mode for analyzing malware patterns.
- Gap parsing now uses machine learning to find function boundaries in a compiler-agnostic way.
SymtabAPI
library now provides information about inline functions.- The
ParseAPI
,PatchAPI
, andBPatch
now represent loops. - The
ProcControl
andSymtabAPI
libraries now support thread-local storage (TLS). BPatch_object
andBPatch_module
are now used consistently for whole binaries and compilation units, respectively. Previously, a shared library was represented asBPatch_object
and one monolithicBPatch_module
.- The
BPatch
library callbacks now provideBPatch_object
.
B.7. Changes in Valgrind
B.7.1. Changes Since Red Hat Developer Toolset 4.0
- The register allocator of the JIT (just-in-time) compiler is now significantly faster, making the JIT as a whole faster. so JIT-intensive activities, for example, program start, are faster by approximately 5%.
- Support for the Intel AVX2 extensions is now more complete (on 64-bit targets only). On AVX2-capable hosts, the simulated CPUID now indicates AVX2 support.
- The default value for the
--smc-check
option has been changed fromstack
toall-non-file
on targets that provide automatic D-I cache coherence (AMD64 and IBM S/390). The result is to provide, by default, transparent support for JIT-generated and self-modifying code on all targets. - Valgrind now tries to automatically intercept user-defined alternate
malloc
andnew
allocator functions as if the program used the normal system (glibc
) allocator. This makes it possible to use memory-tracing tools, such as Memcheck, on such programs out of the box. To only interceptmalloc
andnew
-related functions in system libraries, use the--soname-synonyms=somalloc=nouserintercepts
option (where nouserintercepts can be any non-existing library name). - The following enhancements have been added to the Memcheck component of Valgrind:
- The default value for the
--leak-check-heuristics
option has been changed fromnone
toall
. This helps to reduce the number of possibly lost blocks, in particular for C++ applications. - The default value for the
--keep-stacktraces
has been changed frommalloc-then-free
tomalloc-and-free
. This has a small cost in memory (one word per malloc-ed block), but it allows Memcheck to show the three stacktraces of a dangling reference: where the block was allocated, where it was freed, and where it is acccessed after being freed. - The default value for
--partial-loads-ok
option has been changed fromno
toyes
, so as to avoid false positive errors resulting from some kinds of vectorised loops. - A new monitor command,
xb addr len
, shows the validity bits of len bytes at addr. Thexb
monitor command is easier to use thanget_vbits
when you need to associate byte data value with their corresponding validity bits. - The
block_list
monitor command has been enhanced:- It can now print a range of loss records.
- It now accepts an optional argument,
limited max_blocks
to control the number of blocks printed. - If a block has been found using a heuristic, then
block_list
now shows the heuristic after the block size. - The loss records or blocks to be printed can be limited to the blocks found via specified heuristics.
- A new command line option,
--expensive-definedness-checks=
, has been added. This is useful for avoiding occasional invalid uninitialized-value errors in optimised code. Runtime degradation can be an issue because it can amount up to 25%. The slowdown is application-specific. The default setting isyes
|no
no
.
Appendix C. Revision History
Revision History | |||
---|---|---|---|
Revision 0.0-37 | Tue 24 May 2016 | Robert Krátký | |
| |||
Revision 0.0-33 | Fri 13 Nov 2015 | Robert Krátký | |
| |||
Revision 0.0-29 | Wed 4 Nov 2015 | Robert Krátký | |
| |||
Revision 0.0-28 | Wed 14 Oct 2015 | Robert Krátký | |
| |||
Revision 0.0-25 | Thu 4 June 2015 | Robert Krátký | |
| |||
Revision 0.0-23 | Thu 23 Apr 2015 | Robert Krátký | |
| |||
Revision 0.0-17 | Tue 10 Mar 2015 | Robert Krátký | |
| |||
Revision 0.0-16 | Thu 13 Nov 2014 | Robert Krátký | |
| |||
Revision 0.0-14 | Thu 30 Oct 2014 | Robert Krátký | |
| |||
Revision 0.0-10 | Tue 07 Oct 2014 | Robert Krátký | |
| |||
Revision 0.0-8 | Tue Sep 09 2014 | Robert Krátký | |
|
Index
A
- addr2line
- features, New Features, New Features
- overview, binutils
- usage, Using Other Binary Tools
- ar
- overview, binutils
- usage, Using Other Binary Tools
- as (see GNU assembler)
- assembling (see GNU assembler)
B
- binutils
- documentation, Additional Resources
- features, Main Features
- installation, Installing binutils
- overview, binutils
- usage, Using the GNU Assembler, Using the GNU Linker, Using Other Binary Tools
- version, About Red Hat Developer Toolset, binutils
C
- C programming language
- compiling, Using the C Compiler, Preparing a Program for Debugging
- running, Running a C Program
- support, GNU C Compiler
- C++ programming language
- compatibility, C++ Compatibility
- compiling, Using the C++ Compiler, Preparing a Program for Debugging
- running, Running a C++ Program
- support, GNU C++ Compiler
- c++filt
- overview, binutils
- usage, Using Other Binary Tools
- Cachegrind
- overview, Valgrind
- usage, Using Valgrind
- Callgrind
- overview, Valgrind
- usage, Using Valgrind
- compatibility
- Red Hat Developer Toolset, Compatibility
- compiling (see GNU Compiler Collection)
D
- debugging (see GNU Debugger)
- Developer Toolset (see Red Hat Developer Toolset)
- documentation
- Red Hat Product Documentation, Accessing Red Hat Product Documentation
- DRD
- overview, Valgrind
- usage, Using Valgrind
- dwp
- overview, binutils
- usage, Using Other Binary Tools
- dwz
- documentation, Additional Resources
- installation, Installing dwz
- overview, dwz
- usage, Using dwz
- version, About Red Hat Developer Toolset, dwz
- Dyninst
- documentation, Additional Resources
- installation, Installing Dyninst
- overview, Dyninst
- usage, Using Dyninst
- version, About Red Hat Developer Toolset, Dyninst
E
- Eclipse
- configuration, Using the Red Hat Enterprise Linux Toolchain
- documentation, Additional Resources
- installation, Installing Eclipse
- overview, Eclipse
- usage, Using Eclipse
- version, About Red Hat Developer Toolset, Eclipse
- elfedit
- features, New Features, New Features
- overview, binutils
- usage, Using Other Binary Tools
- elfutils
- documentation, Additional Resources
- installation, Installing elfutils
- overview, elfutils
- usage, Using elfutils
- version, About Red Hat Developer Toolset, elfutils
- eu-addr2line
- overview, elfutils
- usage, Using elfutils
- eu-ar
- overview, elfutils
- usage, Using elfutils
- eu-elfcmp
- overview, elfutils
- usage, Using elfutils
- eu-elflint
- overview, elfutils
- usage, Using elfutils
- eu-findtextrel
- overview, elfutils
- usage, Using elfutils
- eu-make-debug-archive
- overview, elfutils
- usage, Using elfutils
- eu-nm
- overview, elfutils
- usage, Using elfutils
- eu-objdump
- overview, elfutils
- usage, Using elfutils
- eu-ranlib
- overview, elfutils
- usage, Using elfutils
- eu-readelf
- overview, elfutils
- usage, Using elfutils
- eu-size
- overview, elfutils
- usage, Using elfutils
- eu-stack
- overview, elfutils
- eu-strings
- overview, elfutils
- usage, Using elfutils
- eu-strip
- overview, elfutils
- usage, Using elfutils
- eu-unstrip
- overview, elfutils
- usage, Using elfutils
F
- Fortran programming language
- compiling, Using the Fortran Compiler
- running, Running a Fortran Program
- support, GNU Fortran Compiler
G
- g++ (see GNU Compiler Collection)
- GAS (see GNU assembler)
- GCC (see GNU Compiler Collection)
- gcc (see GNU Compiler Collection)
- GDB (see GNU Debugger)
- gfortran (see GNU Compiler Collection)
- Global Support Services
- contacting, Contacting Global Support Services
- GNU assembler
- documentation, Additional Resources
- installation, Installing binutils
- overview, binutils
- usage, Using the GNU Assembler
- GNU Binutils (see binutils)
- GNU Compiler Collection
- C support, GNU C Compiler
- C++ support, GNU C++ Compiler
- documentation, Additional Resources
- features, Main Features
- Fortran support, GNU Fortran Compiler
- installation, Installing the C Compiler, Installing the C++ Compiler, Installing the Fortran Compiler
- overview, GNU Compiler Collection (GCC)
- usage, Using the C Compiler, Using the C++ Compiler, Using the Fortran Compiler, Preparing a Program for Debugging
- version, About Red Hat Developer Toolset, GNU Compiler Collection (GCC)
- GNU Debugger
- documentation, Additional Resources
- features, Main Features
- installation, Installing the GNU Debugger
- overview, GNU Debugger (GDB)
- preparation, Preparing a Program for Debugging
- usage, Running the GNU Debugger, Listing Source Code, Setting Breakpoints, Starting Execution, Displaying Current Values, Continuing Execution
- version, About Red Hat Developer Toolset, GNU Debugger (GDB)
- GNU linker
- documentation, Additional Resources
- installation, Installing binutils
- overview, binutils
- usage, Using the GNU Linker
- gprof
- overview, binutils
- usage, Using Other Binary Tools
- GSS (see Global Support Services)
H
- Helgrind
- overview, Valgrind
- usage, Using Valgrind
- help
- Global Support Services, Contacting Global Support Services
- Red Hat Product Documentation, Accessing Red Hat Product Documentation
L
- ld (see GNU linker)
- linking (see GNU linker)
- ltrace
- documentation, Additional Resources
- installation, Installing ltrace
- overview, ltrace
- usage, Using ltrace
- version, About Red Hat Developer Toolset, ltrace
M
- Massif
- overview, Valgrind
- usage, Using Valgrind
- Memcheck
- overview, Valgrind
- usage, Using Valgrind
- memstomp
- documentation, Additional Resources
- installation, Installing memstomp
- overview, memstomp
- usage, Using memstomp
- version, About Red Hat Developer Toolset
N
- nm
- overview, binutils
- usage, Using Other Binary Tools
O
- objcopy
- features, New Features, New Features
- overview, binutils
- usage, Using Other Binary Tools
- objdump
- features, New Features, New Features
- overview, binutils
- usage, Using Other Binary Tools
- ocount
- overview, OProfile
- opannotate
- overview, OProfile
- usage, Using OProfile
- oparchive
- overview, OProfile
- usage, Using OProfile
- operf
- overview, OProfile
- usage, Using OProfile
- opgprof
- overview, OProfile
- usage, Using OProfile
- ophelp
- overview, OProfile
- usage, Using OProfile
- opimport
- overview, OProfile
- usage, Using OProfile
- opjitconv
- overview, OProfile
- usage, Using OProfile
- opreport
- overview, OProfile
- usage, Using OProfile
- OProfile
- documentation, Additional Resources
- installation, Installing OProfile
- overview, OProfile
- usage, Using OProfile
- version, About Red Hat Developer Toolset, OProfile
- oprofiled
- overview, OProfile
R
- ranlib
- overview, binutils
- usage, Using Other Binary Tools
- readelf
- features, New Features, New Features
- overview, binutils
- usage, Using Other Binary Tools
- Red Hat Developer Toolset
- compatibility, Compatibility
- Container Images, Using Red Hat Developer Toolset Container Images
- Docker, Using Red Hat Developer Toolset Container Images
- Docker-formatted container images, Using Red Hat Developer Toolset Container Images
- Dockerfiles, Using Red Hat Developer Toolset Container Images
- documentation, Additional Resources, Accessing Red Hat Product Documentation
- features, Main Features
- installation, Installing Red Hat Developer Toolset
- overview, About Red Hat Developer Toolset
- subscription, Getting Access to Red Hat Developer Toolset
- support, About Red Hat Developer Toolset
- uninstallation, Uninstalling Red Hat Developer Toolset
- update, Updating Red Hat Developer Toolset
- Red Hat Enterprise Linux
- documentation, Additional Resources, Accessing Red Hat Product Documentation
- supported versions, Compatibility
- Red Hat Subscription Management
- subscription, Using Red Hat Subscription Management
- RHN Classic
- subscription, Using RHN Classic
S
- scl (see Software Collections)
- size
- overview, binutils
- usage, Using Other Binary Tools
- Software Collections
- documentation, Additional Resources, Accessing Red Hat Product Documentation
- overview, About Red Hat Developer Toolset
- stap
- overview, SystemTap
- usage, Using SystemTap, Using Dyninst with SystemTap
- stap-merge
- overview, SystemTap
- usage, Using SystemTap
- stap-prep
- overview, SystemTap
- usage, Installing SystemTap
- stap-report
- overview, SystemTap
- usage, Using SystemTap
- stap-server
- overview, SystemTap
- stapdyn
- overview, SystemTap
- staprun
- overview, SystemTap
- usage, Using SystemTap
- stapsh
- overview, SystemTap
- usage, Using SystemTap
- strace
- documentation, Additional Resources
- installation, Installing strace
- overview, strace
- usage, Using strace
- version, About Red Hat Developer Toolset, strace
- strings
- overview, binutils
- usage, Using Other Binary Tools
- strip
- overview, binutils
- usage, Using Other Binary Tools
- support
- Red Hat Developer Toolset, About Red Hat Developer Toolset
- SystemTap
- documentation, Additional Resources
- installation, Installing SystemTap
- overview, SystemTap
- usage, Using SystemTap, Using Dyninst with SystemTap
- version, About Red Hat Developer Toolset, SystemTap
V
- Valgrind
- building, Rebuilding Valgrind
- documentation, Additional Resources
- installation, Installing Valgrind
- overview, Valgrind
- usage, Using Valgrind
- version, About Red Hat Developer Toolset, Valgrind
- version
- version, memstomp