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.

Note: If you're seeing line numbers for a shared library but double-clicking its function entries takes you to unexpected code locations, you have a mismatch between the host version of the library that contains debug symbols and the target version that gets loaded by the executable. You should therefore rebuild the application to link in the correct version, and verify that the Upload shared libraries list (in the Upload tab) contains the right library file.

Memory Analysis

If you don't see line numbers for certain shared libraries in the analysis results:
  1. Confirm that the project that you want to analyze is selected in the Launch Configuration dropdown, then click the edit button (Icon: Edit button) on the right.
  2. 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.
  3. 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.
  4. 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.
  5. 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 provides data upon request, which the tools use to write analysis results.

If Valgrind isn't producing any results and is terminating with a message saying that it's unable to connect to the server, you have to manually start it. To do this:
  1. Confirm that the project that you're running Valgrind on is selected in the Launch Configuration dropdown, then click the edit button (Icon: Edit button) on the right.
  2. Access the rightmost tab, confirm that the appropriate Valgrind tool is enabled, then click the Symbols tab within the Valgrind controls.
  3. 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.

  4. 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

If the debug symbols are already on the target, you don't need to run the server but you must manually specify the paths containing the debug libraries so Valgrind can load their symbols. To do this:
  1. Access the Valgrind controls in the launch configuration.
  2. In the Symbols tab, uncheck the Start symbol server box.
  3. 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.