What are symbols in the . NET Framework?

Asked

Viewed 156 times

8

How do symbols work in the . NET Framework (and other platforms)? How do they make it possible to debug application even without having the source code on the machine? What is your relationship with the files .pdb?

  • 1

    If you understand English, it may help: https://blogs.msdn.microsoft.com/visualstudioalm/2015/01/05/understanding-symbol-files-and-visual-studios-symbol-settings/

1 answer

4


Symbols

Symbols are names. In fact this is for any application, it is not exclusive to NET. They are linked to some address, but not necessarily a physical or fixed address, it can be a relative indicator of a relative position in the stack that will be absolute only at the time of execution. Symbols are code identifiers (variables, function names, etc.), but we call them that when we deal with a slightly lower level. Although there is a 1:1 relationship between the identifiers and the symbols we only consider the symbols that survive the compilation.

Usually everything public needs a symbol to map the object (in a broad sense of the word). So functions, types, global variables need to have their symbols available always for other components to refer to them without knowing their address. This is especially necessary in linkage dynamics. Theoretically a static linkage could eliminate all symbols, at least in most situations.

What is private or local does not need to make those symbols available because the code can solve everything right there. But to debug you need a mapping of binary code to the source. This is where the additional information entered in the executable or in a separate file.

Symbol archive

A symbol file usually has much more information than symbols. Only pure mapping would be more easily placed inside the executable, that is, it would be enough to keep all symbols in a table, not just the ones needed for normal use. It has data from public members in addition to their name that facilitate debugging.

You can even have the source code in that file. If not, at least you can map the binaries to the source that is available on the machine. Thus it is known which piece of source code generated a certain instruction of the machine and thus allows to control the execution in a simple way.

Obviously, if you want to debug right into target code you don’t need symbols. It’s just really hard. Real hacker does a lot of this.

The file may contain information on how to present data of certain types to be better viewed.

In general you can configure the level of detail of information that will be available.

PDB file

Microsoft uses the format .pdb to store this information.

The term is used in some code contexts:

Further details can be found at MSDN.

About the PDB:

See Artur’s comment on the question.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.