build-id.c 919 B

123456789101112131415161718192021222324252627282930313233343536373839
  1. /*
  2. * build-id.c
  3. *
  4. * build-id support
  5. *
  6. * Copyright (C) 2009, 2010 Red Hat Inc.
  7. * Copyright (C) 2009, 2010 Arnaldo Carvalho de Melo <acme@redhat.com>
  8. */
  9. #include "build-id.h"
  10. #include "event.h"
  11. #include "symbol.h"
  12. #include <linux/kernel.h>
  13. static int build_id__mark_dso_hit(event_t *event, struct perf_session *session)
  14. {
  15. struct addr_location al;
  16. u8 cpumode = event->header.misc & PERF_RECORD_MISC_CPUMODE_MASK;
  17. struct thread *thread = perf_session__findnew(session, event->ip.pid);
  18. if (thread == NULL) {
  19. pr_err("problem processing %d event, skipping it.\n",
  20. event->header.type);
  21. return -1;
  22. }
  23. thread__find_addr_map(thread, session, cpumode, MAP__FUNCTION,
  24. event->ip.ip, &al);
  25. if (al.map != NULL)
  26. al.map->dso->hit = 1;
  27. return 0;
  28. }
  29. struct perf_event_ops build_id__mark_dso_hit_ops = {
  30. .sample = build_id__mark_dso_hit,
  31. .mmap = event__process_mmap,
  32. .fork = event__process_task,
  33. };