tmf: Handle spaces in function names in the Callstack View
authorAlexandre Montplaisir <alexmonthy@voxpopuli.im>
Tue, 10 Feb 2015 18:43:52 +0000 (13:43 -0500)
committerAlexandre Montplaisir <alexmonthy@voxpopuli.im>
Tue, 10 Feb 2015 22:59:10 +0000 (17:59 -0500)
De-mangled C++ symbol names may contain spaces, so the function
name reader must not split around these spaces.

Also mention in the documentation that 'nm --demangle' can be used
to get readable C++ function names.

Refs bug #459534.

Change-Id: Ib046a15ada590b389bb8d1af2983e00629d17a35
Signed-off-by: Alexandre Montplaisir <alexmonthy@voxpopuli.im>
Reviewed-on: https://git.eclipse.org/r/41561
Reviewed-by: Hudson CI
Reviewed-by: Marc-Andre Laperle <marc-andre.laperle@ericsson.com>
Tested-by: Marc-Andre Laperle <marc-andre.laperle@ericsson.com>
doc/org.eclipse.tracecompass.doc.user/doc/User-Guide.mediawiki
org.eclipse.tracecompass.tmf.ui/src/org/eclipse/tracecompass/tmf/ui/views/callstack/FunctionNameMapper.java

index a88b27eb72fdcd9266c5d1166bbd9cf544a6f6a5..3c8597961a30a1f3254dfc26307b06ab7d315d86 100644 (file)
@@ -1755,6 +1755,8 @@ If you followed the steps in the previous section, you should have a Callstack V
 ** <pre>nm myprogram > mapping.txt</pre>
 * Click the '''Import Mapping File''' ([[Image:images/import.gif]]) button in the Callstack View, and select the ''mapping.txt'' file that was just created.
 
+(If you are dealing with C++ executables, you may want to use ''nm --demangle'' instead to get readable function names.)
+
 The view should now update to display the function names instead. Make sure the binary used for taking the trace is the one used for this step too (otherwise, there is a good chance of the addresses not being the same).
 
 == Memory Usage ==
index 179425167e071786c69567eba500f03d27d022cf..62e908bd84cb5b871a080a767f894deabbb7f2e0 100644 (file)
@@ -52,8 +52,8 @@ class FunctionNameMapper {
         try (FileReader fr = new FileReader(mappingFile);
                 BufferedReader reader = new BufferedReader(fr);) {
             for (String line = reader.readLine(); line != null; line = reader.readLine()) {
-                String[] elems = line.split(" "); //$NON-NLS-1$
                 /* Only lines with 3 elements contain addresses */
+                String[] elems = line.split(" ", 3); //$NON-NLS-1$
                 if (elems.length == 3) {
                     /* Strip the leading zeroes from the address */
                     String address = elems[0].replaceFirst("^0+(?!$)", ""); //$NON-NLS-1$ //$NON-NLS-2$;
This page took 0.029855 seconds and 5 git commands to generate.