]> git.karo-electronics.de Git - karo-tx-linux.git/blobdiff - tools/perf/util/annotate.c
perf report: Enable sorting by srcline as key
[karo-tx-linux.git] / tools / perf / util / annotate.c
index 06cc04e5806a2692fffabbc2c038b82380dfcafd..3d0263e5d1db662147487c13d1eab35a4738b9f5 100644 (file)
@@ -1435,7 +1435,7 @@ int symbol__disassemble(struct symbol *sym, struct map *map, const char *arch_na
        snprintf(command, sizeof(command),
                 "%s %s%s --start-address=0x%016" PRIx64
                 " --stop-address=0x%016" PRIx64
-                " -l -d %s %s -C %s 2>/dev/null|grep -v %s|expand",
+                " -l -d %s %s -C %s 2>/dev/null|grep -v %s:|expand",
                 objdump_path ? objdump_path : "objdump",
                 disassembler_style ? "-M " : "",
                 disassembler_style ? disassembler_style : "",
@@ -1482,6 +1482,12 @@ int symbol__disassemble(struct symbol *sym, struct map *map, const char *arch_na
 
        nline = 0;
        while (!feof(file)) {
+               /*
+                * The source code line number (lineno) needs to be kept in
+                * accross calls to symbol__parse_objdump_line(), so that it
+                * can associate it with the instructions till the next one.
+                * See disasm_line__new() and struct disasm_line::line_nr.
+                */
                if (symbol__parse_objdump_line(sym, map, arch, file, privsize,
                            &lineno) < 0)
                        break;
@@ -1668,7 +1674,8 @@ static int symbol__get_source_line(struct symbol *sym, struct map *map,
                        goto next;
 
                offset = start + i;
-               src_line->path = get_srcline(map->dso, offset, NULL, false);
+               src_line->path = get_srcline(map->dso, offset, NULL,
+                                            false, true);
                insert_source_line(&tmp_root, src_line);
 
        next:
@@ -1768,7 +1775,7 @@ int symbol__annotate_printf(struct symbol *sym, struct map *map,
        printf("%-*.*s----\n",
               graph_dotted_len, graph_dotted_len, graph_dotted_line);
 
-       if (verbose)
+       if (verbose > 0)
                symbol__annotate_hits(sym, evsel);
 
        list_for_each_entry(pos, &notes->src->source, node) {