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 <dsahern@gmail.com>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Namhyung Kim <namhyung@gmail.com>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Stephane Eranian <eranian@google.com>
Link: http://lkml.kernel.org/n/tip-xrn35g2mlawz1ydo1p73w3q6@git.kernel.orgSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
parent 44d1a3ed
...@@ -75,10 +75,13 @@ static int jump__parse(struct ins_operands *ops) ...@@ -75,10 +75,13 @@ static int jump__parse(struct ins_operands *ops)
{ {
const char *s = strchr(ops->raw, '+'); const char *s = strchr(ops->raw, '+');
if (s++ == NULL) ops->target.addr = strtoll(ops->raw, NULL, 16);
return -1;
if (s++ != NULL)
ops->target.offset = strtoll(s, NULL, 16); ops->target.offset = strtoll(s, NULL, 16);
else
ops->target.offset = UINT64_MAX;
return 0; return 0;
} }
......
...@@ -2,6 +2,7 @@ ...@@ -2,6 +2,7 @@
#define __PERF_ANNOTATE_H #define __PERF_ANNOTATE_H
#include <stdbool.h> #include <stdbool.h>
#include <stdint.h>
#include "types.h" #include "types.h"
#include "symbol.h" #include "symbol.h"
#include <linux/list.h> #include <linux/list.h>
...@@ -41,6 +42,11 @@ struct disasm_line { ...@@ -41,6 +42,11 @@ struct disasm_line {
struct ins_operands ops; struct ins_operands ops;
}; };
static inline bool disasm_line__has_offset(const struct disasm_line *dl)
{
return dl->ops.target.offset != UINT64_MAX;
}
void disasm_line__free(struct disasm_line *dl); void disasm_line__free(struct disasm_line *dl);
struct disasm_line *disasm__get_next_ip_line(struct list_head *head, struct disasm_line *pos); struct disasm_line *disasm__get_next_ip_line(struct list_head *head, struct disasm_line *pos);
size_t disasm__fprintf(struct list_head *head, FILE *fp); size_t disasm__fprintf(struct list_head *head, FILE *fp);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment