What are the "debugging symbols"?

  • Context:
  • Thread starter Thread starter ORF
  • Start date Start date
  • Tags Tags
    Symbols
Click For Summary

Discussion Overview

The discussion centers around the concept of "debugging symbols" in programming, particularly in the context of C programming and the use of development environments like Microsoft Visual Studio. Participants explore the role of debugging symbols in tracking program execution and their implications for debugging processes.

Discussion Character

  • Technical explanation
  • Conceptual clarification
  • Debate/contested

Main Points Raised

  • One participant describes debugging symbols as flags that help track program execution, though they express uncertainty about their exact nature.
  • Another participant explains that in a "Debug" build, compiler optimizations are often turned off, allowing for step-by-step execution and easier tracking of variable changes.
  • A participant mentions that debug symbols are a compiler-generated list of variable names and statement indices that assist debuggers in linking source code to binary code.
  • It is noted that Microsoft compilers use program database (PDB) files to store debug information, which helps associate addresses with variables or functions.
  • Another participant states that debugging symbols can significantly increase the size of the binary and that tools exist to strip this information, which would hinder debugging capabilities.
  • A suggestion is made regarding the use of debug traps like "assert" to aid in debugging.

Areas of Agreement / Disagreement

Participants express varying levels of understanding and definitions of debugging symbols, indicating that there is no consensus on a singular definition or understanding of the concept. Some participants provide examples and explanations that may not align perfectly with others' views.

Contextual Notes

Some participants express uncertainty about specific terms and their implications, and there are references to different development environments and their handling of debugging symbols, which may not be universally applicable.

Who May Find This Useful

Individuals interested in programming, particularly in debugging practices within C programming and the use of development environments, may find this discussion relevant.

ORF
Messages
169
Reaction score
19
Hello

What are the "debugging symbols" ?

I have a naive idea about what the debugging symbols are, but based only in my short experience: for me, they are a kind of flags that can be read during the execution of the program, so you can track the execution.

I have also discovered that if you remove this symbols (I'm not sure if they are the same "symbols" as the debugging ones, or they are different) from a shared library can not be integrated dynamically in you program.

A reference to a web where this stuff is explained could be enough.

Thank you for your time.

Regards,
ORF
 
Technology news on Phys.org
I am not certain what you mean by "debugging symbol", but I'll take some guesses. My examples will be for C programming using the Microsoft Visual Studio.
While developing code, you can use a "Release" build or a "Debug" build. The "Debug" build gives you several advantages in tracking down problems in the code:
1) Often, some or call compiler optimization are turned off. This will allow you to step through the code executing one line of source at a time and seeing the resulting changes in variable as they occur.
2) "Debug" libraries will be used.
3) The symbol "_DEBUG" will be defined. Otherwise the symbol "NDEBUG" is defined.
4) In older versions of the Microsoft development environments and in some other development environments, local symbols are not available in the Release build. And so debugging that code is more difficult because, as it executes, it cannot be linked to the source code.

Item 3 above allows code such as this:
#if defined(_DEBUG)
{
double debug_r;
debug_r = sqrt(x*x+y*y);
printf("Debug: Radius is now %f\n");
}
#endif /* _DEBUG */

That code will only be compiled for a debug build. It presumable provides assistance in tracking what is happening in the code and assists in locating bugs.

There is another term "debug symbols" (similar to your "debugging symbols"). They are the compiler-generated and builder maintained list of variables names and statement indices that allow a debugger to show you the source code and variable names that are being worked with as you debug.

For example:
int a;
a = b+1;

At debug time, the debugger will have access to symbols telling it where in memory it will find the code for "a = b+1;" and where that same code can be found in the source files. It will also have information about the context of variables "a" and "b" are where they are stored - an absolute memory location, or a location relative to the stack or frame pointer.
 
Last edited:
  • Like
Likes   Reactions: ORF
Debugging symbols are extra information compiled into the binary that allows a debugger to identify things about the source code. This allows the debugger to give useful information when you are stepping through the code one instruction at a time. The information can include the names of variables and even the source code of the program associated with the binary executable code that it generates.

In some cases, the information is added to the binary by adding a compiler flag during compilation. For gcc and g++, the -g flag adds debugging symbols into the binary. This does significantly increase the size of the binary, and tools are provided for stripping out that information. After stripping, debugging no longer provide information about the source code from which the program came.

There may be other schemes for storing the symbols separately from the binary, but I am not familiar with those methods.
 
  • Like
Likes   Reactions: ORF

Similar threads

  • · Replies 11 ·
Replies
11
Views
2K
Replies
11
Views
3K
  • · Replies 2 ·
Replies
2
Views
4K
  • · Replies 5 ·
Replies
5
Views
4K
Replies
1
Views
4K
  • · Replies 2 ·
Replies
2
Views
3K
Replies
6
Views
3K
Replies
5
Views
4K
  • · Replies 19 ·
Replies
19
Views
4K
  • · Replies 4 ·
Replies
4
Views
4K