Configuring shared library support
The memory-analyzing tools produce results that contain backtraces for allocations, corruption errors, and leaks. To display line numbers for shared libraries in these backtraces, the active tool must have access to library copies with debug symbols.
To find these debug symbols, the tools search the paths listed in the Libraries tab. When you add a library to a project, the IDE normally adds the path with the debug version of the library to the search list. It also adds the library file to the list of files to upload to the target, defined in the Upload tab. You can strip the debug information when uploading this file—the IDE just needs to find the debug symbols somewhere on the host when displaying the results.
If the automation fails, though, the user must manually specify where to find the right library files. The way to do this depends on the tool.
Memory Analysis
- Confirm that the project that you want to analyze is selected in the Launch Configuration dropdown,
then click the edit button (
) on the right.
- Access the Libraries tab and examine the Shared Libraries Path listings. For each library, you should see either the directory containing its debug version or the library file itself.
- If some required directory paths or library files are missing, click the Auto button. This action populates the list with the host directories containing any user (non-system) libraries needed by the executable binary.
- If you still notice missing paths or files, you must manually add them. You can do so with the Add Directory and Add Files buttons, which open selectors for browsing to and choosing items.
- When you're finished adding library entries, click OK to save the configuration changes and close the window.
Valgrind
By default, the IDE starts a symbol server that the Valgrind tools use to gather debug information. The server runs on the host and searches the paths listed in the Libraries tab to provide symbol data to any tool upon request, which the tool uses to write the analysis results.
- Confirm that the project that you're running Valgrind on is selected in the Launch Configuration dropdown,
then click the edit button (
) on the right.
- Access the rightmost tab, confirm that the appropriate Valgrind tool is enabled, then click the Symbols tab within the Valgrind controls.
Ensure that the Start symbol server box is checked and the Server Port and Server Host fields are properly set.
You would change the port only if your host were running another service behind the default port of 1500. You would specify an IP address in that second field only if your host had multiple network interfaces and you wanted to use a specific one to communicate with the target.
- Click OK to save the configuration changes and close the window.
You should now be able to analyze a program with a Valgrind tool and see error and memory information about any shared libraries with paths listed in the Libraries tab. If the symbol server still doesn't work, you have to upload the shared libraries to the target and specify their paths, as explained below.
Manually loading debug symbols on the target
- Access the Valgrind controls in the launch configuration.
- In the Symbols tab, uncheck the Start symbol server box.
In the Select symbols to be loaded on device field, add the paths of any libraries used by the application.
This field is auto-populated with the filenames of any user libraries needed by the executable binary. On the right, there are buttons for adding new library entries, editing the paths in existing entries, removing entries, and moving them in the list. You can uncheck entries, to prevent Valgrind from loading those particular symbols.