C++Introduction to C++Language FeatureLearn C++

This Is How to Debug C++ Builder Mobile And Desktop Projects

This Is How to Debug C++ Builder Projects

What is Debugging? What is a bug? How can I debug in C++ Builder? In this article, we’ll walk you through Debugging, how an integrated debugger works, the difference between debug and release mode, how to debug your programs in C++ IDE Windows, and many more.

What is Debugging?

Debugging is the process of finding and resolving bugs – unwanted or unplanned behavior – in your software applications or hardware systems. Bugs are defined as defects or problems that prevent the correct or intended operation in a running system or application.

Many programming languages and software development tools also offer programs to aid in debugging, known as debuggers. Many different Integrated Development Editors (IDEs) in C++ provide very professional methods to debug applications. Debugging involves interactive debugging, control flow analysis, unit testing, integration testing, log file analysis, monitoring at the application or system level, memory dumps, and profiling.

RAD Studio, C++ Builder provides an integrated debugging environment that enables you to debug multi-device applications as well as native Win32 applications. In addition, you can use the debugger to debug an application running on a remote machine that does not have RAD Studio installed.

RAD Studio, C++ Builder includes integrated debuggers for every supported target platform. The IDE automatically uses the appropriate debugger based on the active project type. Debugging is supported for multi-device applications within a project and, where possible, the debuggers share a common user interface.

What does an integrated debugger do?

The integrated debuggers let you find and fix both run-time errors and logic errors in your RAD Studio C++ or Delphi application. Using the debuggers, you can step through code, set breakpoints and watches, and inspect and modify program values. As you debug your application, the debug windows are available to help you manage the debug session and provide information about the state of your application. There is a very detailed debugging methods are officially released here.

What is the difference between debug and release mode?

When applications that you develop can be compiled in two different types, Release and Debug mode. Debug mode is used when we develop application. Release mode is generally used only when we release and deploy the final executable application. A professional programmer mostly develops in debug mode although, for some big changes they will often swap to test the final application in release mode. Debug mode adds extra code and data to allow the debugger to do its work and map parts of the executable application’s internal runtime compiled output to lines of your program. It also includes in extra checks and balances to help detect difficult to find bugs such as ‘stack overflow’ errors and similar. Debug mode programs are optimized to help make the debugging process as powerful and useful as possible. Release mode doesn’t include the extra data to make the debugger work and is optimized for size and pure execution speed to ensure the final release of your programs is as fast and efficient as possible.

All this means that a program compiled in Debug should not normally be the version you finally send to your users except under quite narrow sets of circumstances such as trying to get the customer to reproduce a bug or crash which will then display additional helpful information from the extra debug release’s information.

How can I debug my programs in C++ Builder?

To debug your application first be sure that your application is set Build Configuration in Projects Window to Debug mode. This will allow you debug your application in details.

Now, we can use debug configuration, we should just run with debugging mode by pressing this Run with Debugging button or press F9 key.

Note that your projects options changes in Release and Debug configurations. Generally most options are same in Release and Debug configurations, although the two sets of project options – release and debug – can be completely different if you want them to be. Be sure that your project options are suitable to your debugging setup.

What is the Debug Inspector?

The Debug Inspector enables you to examine various data types such as arrays, classes, constants, functions, pointers, scalar variables, and interfaces. To use the Debug Inspector, select Run > Inspect.

This video demo of the debugger is a helpful overview.

  • Stepping – Step by Step Debugging Through Code
  • Evaluate/Modify – Investigate Expressions
  • Breakpoints – Pause and Check
  • Watches – Tracking Values
  • Exceptions – Displaying the stack trace

What are the RAD Studio Debug Windows and how can I use them?

Each window provides one or more right-click context menus. The F1 Help for each window provides detailed information about the window and the context menus.

Debug WindowDescription
Breakpoint ListDisplays all of the breakpoints currently set in the Code Editor or CPU window.
Call StackDisplays the current sequence of function calls.
Watch ListDisplays the current value of watch expressions based on the scope of the execution point.
Local VariablesDisplays the current function’s local variables, enabling you to monitor how your program updates the values of variables as the program runs.
ModulesDisplays processes under control of the debugger and the modules currently loaded by each process. It also provides a hierarchical view of the namespaces, classes, and methods used in the application.
Thread StatusDisplays the status of all processes and threads of execution that are executing in each application being debugged. This is helpful when debugging multi-threaded applications. For Windows Vista, the Threads Status includes a Wait Chain column that lists thread blockages and deadlocks.
Event LogDisplays messages that pertain to process control, breakpoints, output, threads, and module.
CPU Windows IndexDisplays the low-level state of your program, including the assembly instructions for each line of source code and the contents of certain registers.
FPUDisplays the contents of the Floating-point Unit and SSE registers in the CPU.

What is the Debug Desktop?

The Debug Desktop is the layout that the IDE uses when you are running your application in Debug mode (by pressing F9 in the default key mapping). There is a default Debug Desktop, but you can alternatively select any of the saved desktops to be the Debug Desktop.

To set the Debug desktop:

  1. Choose either of the following:
  2. In the Set Debug Desktop dialog box, click the down-arrow and select the layout you want to be the Debug Desktop.
  3. Click OK.

What is remote debugging?

Remote debugging lets you debug an application running on a remote computer – a different one to the computer on which you are running RAD Studio. Your computer must be connected to the remote computer through a TCP/IP network connection.

Two remote debugging solutions are now available:

  • The new remote debugging solution is also used for multi-device debugging.
  • The old-style remote debugging solution required that you install a remote debugger on the remote machine. After you create and copy the required application files to the remote computer, you can connect to the remote computer and begin debugging.

Note: The old-style debugging solution does not apply to multi-device applications.

What is Multi-Device debugging?

Multi-device debugging involves the use of a target platform that is not the native 32-bit Windows. Your interaction with the debugger is virtually the same with multi-device debugging as it is with Windows debugging.

How do I debug macOS, iOS and Android mobile apps?

  • For the macOS and iOS platforms, you must install and run the Platform Assistant on the target machine and create a working connection profile on the development system.
  • For Android applications, you do not use the Platform Assistant or a connection profile, but you must download the USB driver for your Android device, enable USB debugging, and add an Android SDK to RAD Studio.

C++ Builder is the easiest and fastest C and C++ IDE for building simple or professional applications on the Windows, MacOS, iOS & Android operating systems. It is also easy for beginners to learn with its wide range of samples, tutorials, help files, and LSP support for code. RAD Studio’s C++ Builder version comes with the award-winning VCL framework for high-performance native Windows apps and the powerful FireMonkey (FMX) framework for cross-platform UIs.

There is a free C++ Builder Community Edition for students, beginners, and startups; it can be downloaded from here. For professional developers, there are Professional, Architect, or Enterprise versions of C++ Builder and there is a trial version you can download from here.

Oh hi there 👋
It’s nice to meet you.

Sign up to receive awesome C++ content in your inbox, every day.

We don’t spam! Read our privacy policy for more info.


Reduce development time and get to market faster with RAD Studio, Delphi, or C++Builder.
Design. Code. Compile. Deploy.
Start Free Trial

Free C++Builder Community Edition

About author

Dr. Yilmaz Yoru has 35+ years of coding with more than 30+ programming languages, mostly C++ on Windows, Android, Mac-OS, iOS, Linux, and some other operating systems. He graduated and received his MSc and PhD degrees from the Department of Mechanical Engineering of Eskisehir Osmangazi University. He is the founder and CEO of ESENJA LLC Company. His interests are Programming, Thermodynamics, Fluid Mechanics, Artificial Intelligence, 2D & 3D Designs, and high-end innovations.
Related posts
C++C++11C++14C++17C++20

What Is The Stack (std::stack) In Modern C++?

C++C++11C++14C++17C++20Learn C++

What Is The Queue (std::queue) In Modern C++?

C++C++11C++14C++17Learn C++SyntaxTemplates

What Are The Logical Operation Metafunctions In Modern C++?

C++C++14C++17C++20Learn C++

What Are The Deprecated C++14 Features In C++17?