const struct perf_dlfilter_al *(*resolve_addr)(void *ctx);
char **(*args)(void *ctx, int *dlargc);
__s32 (*resolve_address)(void *ctx, __u64 address, struct perf_dlfilter_al *al);
- void *(*reserved[124])(void *);
+ const __u8 *(*insn)(void *ctx, __u32 *length);
+ void *(*reserved[123])(void *);
};
----
'resolve_address' provides information about 'address'. al->size must be set
before calling. Returns 0 on success, -1 otherwise.
+'insn' returns instruction bytes and length.
+
The perf_dlfilter_al structure
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#include "dso.h"
#include "map.h"
#include "thread.h"
+#include "trace-event.h"
#include "symbol.h"
#include "dlfilter.h"
#include "perf_dlfilter.h"
return 0;
}
+static const __u8 *dlfilter__insn(void *ctx, __u32 *len)
+{
+ struct dlfilter *d = (struct dlfilter *)ctx;
+
+ if (!len)
+ return NULL;
+
+ *len = 0;
+
+ if (!d->ctx_valid)
+ return NULL;
+
+ if (d->sample->ip && !d->sample->insn_len) {
+ struct addr_location *al = d->al;
+
+ if (!al->thread && machine__resolve(d->machine, al, d->sample) < 0)
+ return NULL;
+
+ if (al->thread->maps && al->thread->maps->machine)
+ script_fetch_insn(d->sample, al->thread, al->thread->maps->machine);
+ }
+
+ if (!d->sample->insn_len)
+ return NULL;
+
+ *len = d->sample->insn_len;
+
+ return (__u8 *)d->sample->insn;
+}
+
static const struct perf_dlfilter_fns perf_dlfilter_fns = {
.resolve_ip = dlfilter__resolve_ip,
.resolve_addr = dlfilter__resolve_addr,
.args = dlfilter__args,
.resolve_address = dlfilter__resolve_address,
+ .insn = dlfilter__insn,
};
static char *find_dlfilter(const char *file)
* calling). Returns 0 on success, -1 otherwise.
*/
__s32 (*resolve_address)(void *ctx, __u64 address, struct perf_dlfilter_al *al);
+ /* Return instruction bytes and length */
+ const __u8 *(*insn)(void *ctx, __u32 *length);
/* Reserved */
- void *(*reserved[124])(void *);
+ void *(*reserved[123])(void *);
};
/*