What are the "debugging symbols"?

  • Thread starter Thread starter ORF
  • Start date Start date
  • Tags Tags
    Symbols
AI Thread Summary
Debugging symbols are essential components in software development that provide critical information about the source code during program execution. They allow developers to track the execution flow, inspect variable states, and identify issues within the code. In a debug build, compiler optimizations are often disabled, enabling developers to step through the code line by line. Debugging symbols include names of variables and their memory locations, which help debuggers correlate the binary code with the original source code. To include debugging symbols in a binary, developers can use specific compiler flags, such as the -g flag in gcc and g++. While these symbols enhance debugging capabilities, they also increase the binary size. Tools are available to strip debugging information from binaries, which can hinder debugging processes. Understanding and utilizing debugging symbols effectively is crucial for efficient software debugging and development.
ORF
Messages
169
Reaction score
18
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 ORF
  • Like
Likes 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 ORF
Thread 'Is this public key encryption?'
I've tried to intuit public key encryption but never quite managed. But this seems to wrap it up in a bow. This seems to be a very elegant way of transmitting a message publicly that only the sender and receiver can decipher. Is this how PKE works? No, it cant be. In the above case, the requester knows the target's "secret" key - because they have his ID, and therefore knows his birthdate.
I tried a web search "the loss of programming ", and found an article saying that all aspects of writing, developing, and testing software programs will one day all be handled through artificial intelligence. One must wonder then, who is responsible. WHO is responsible for any problems, bugs, deficiencies, or whatever malfunctions which the programs make their users endure? Things may work wrong however the "wrong" happens. AI needs to fix the problems for the users. Any way to...
Back
Top