Skip to content

Commit fb29fa5

Browse files
committed
perf annotate: Mark jump instructions with no offset
I.e. jumps that go to code outside the current function, that is denoted in objdump -dS as: 399f877a9f: jne 399f87bcf4 <_L_lock_5154> I.e. without the + after the name of the current function, like in: 399f877aa5: jmp 399f877ab2 <_int_free+0x412> The browser will use that info to avoid drawing connectors to the start of the function, since ops.target.addr was zero. Cc: David Ahern <[email protected]> Cc: Frederic Weisbecker <[email protected]> Cc: Mike Galbraith <[email protected]> Cc: Namhyung Kim <[email protected]> Cc: Paul Mackerras <[email protected]> Cc: Peter Zijlstra <[email protected]> Cc: Stephane Eranian <[email protected]> Link: http://lkml.kernel.org/n/[email protected] Signed-off-by: Arnaldo Carvalho de Melo <[email protected]>
1 parent 44d1a3e commit fb29fa5

File tree

2 files changed

+12
-3
lines changed

2 files changed

+12
-3
lines changed

tools/perf/util/annotate.c

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -75,10 +75,13 @@ static int jump__parse(struct ins_operands *ops)
7575
{
7676
const char *s = strchr(ops->raw, '+');
7777

78-
if (s++ == NULL)
79-
return -1;
78+
ops->target.addr = strtoll(ops->raw, NULL, 16);
79+
80+
if (s++ != NULL)
81+
ops->target.offset = strtoll(s, NULL, 16);
82+
else
83+
ops->target.offset = UINT64_MAX;
8084

81-
ops->target.offset = strtoll(s, NULL, 16);
8285
return 0;
8386
}
8487

tools/perf/util/annotate.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
#define __PERF_ANNOTATE_H
33

44
#include <stdbool.h>
5+
#include <stdint.h>
56
#include "types.h"
67
#include "symbol.h"
78
#include <linux/list.h>
@@ -41,6 +42,11 @@ struct disasm_line {
4142
struct ins_operands ops;
4243
};
4344

45+
static inline bool disasm_line__has_offset(const struct disasm_line *dl)
46+
{
47+
return dl->ops.target.offset != UINT64_MAX;
48+
}
49+
4450
void disasm_line__free(struct disasm_line *dl);
4551
struct disasm_line *disasm__get_next_ip_line(struct list_head *head, struct disasm_line *pos);
4652
size_t disasm__fprintf(struct list_head *head, FILE *fp);

0 commit comments

Comments
 (0)