hc
2023-12-11 d2ccde1c8e90d38cee87a1b0309ad2827f3fd30d
kernel/tools/perf/tests/dwarf-unwind.c
....@@ -1,7 +1,9 @@
11 // SPDX-License-Identifier: GPL-2.0
22 #include <linux/compiler.h>
33 #include <linux/types.h>
4
+#include <linux/zalloc.h>
45 #include <inttypes.h>
6
+#include <limits.h>
57 #include <unistd.h>
68 #include "tests.h"
79 #include "debug.h"
....@@ -10,8 +12,10 @@
1012 #include "../util/unwind.h"
1113 #include "perf_regs.h"
1214 #include "map.h"
15
+#include "symbol.h"
1316 #include "thread.h"
1417 #include "callchain.h"
18
+#include "util/synthetic-events.h"
1519
1620 #if defined (__x86_64__) || defined (__i386__) || defined (__powerpc__)
1721 #include "arch-tests.h"
....@@ -33,8 +37,9 @@
3337 union perf_event event;
3438 pid_t pid = getpid();
3539
40
+ memset(&event, 0, sizeof(event));
3641 return perf_event__synthesize_mmap_events(NULL, &event, pid, pid,
37
- mmap_handler, machine, true, 500);
42
+ mmap_handler, machine, true);
3843 }
3944
4045 /*
....@@ -55,7 +60,7 @@
5560 static int unwind_entry(struct unwind_entry *entry, void *arg)
5661 {
5762 unsigned long *cnt = (unsigned long *) arg;
58
- char *symbol = entry->sym ? entry->sym->name : NULL;
63
+ char *symbol = entry->ms.sym ? entry->ms.sym->name : NULL;
5964 static const char *funcs[MAX_STACK] = {
6065 "test__arch_unwind_sample",
6166 "test_dwarf_unwind__thread",
....@@ -114,8 +119,8 @@
114119 }
115120
116121 out:
117
- free(sample.user_stack.data);
118
- free(sample.user_regs.regs);
122
+ zfree(&sample.user_stack.data);
123
+ zfree(&sample.user_regs.regs);
119124 return err;
120125 }
121126