hc
2023-12-11 d2ccde1c8e90d38cee87a1b0309ad2827f3fd30d
kernel/tools/perf/builtin-probe.c
....@@ -1,24 +1,10 @@
1
+// SPDX-License-Identifier: GPL-2.0-or-later
12 /*
23 * builtin-probe.c
34 *
45 * Builtin probe command: Set up probe events by C expression
56 *
67 * Written by Masami Hiramatsu <mhiramat@redhat.com>
7
- *
8
- * This program is free software; you can redistribute it and/or modify
9
- * it under the terms of the GNU General Public License as published by
10
- * the Free Software Foundation; either version 2 of the License, or
11
- * (at your option) any later version.
12
- *
13
- * This program is distributed in the hope that it will be useful,
14
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
15
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16
- * GNU General Public License for more details.
17
- *
18
- * You should have received a copy of the GNU General Public License
19
- * along with this program; if not, write to the Free Software
20
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
21
- *
228 */
239 #include <sys/utsname.h>
2410 #include <sys/types.h>
....@@ -30,17 +16,19 @@
3016 #include <stdlib.h>
3117 #include <string.h>
3218
33
-#include "perf.h"
3419 #include "builtin.h"
35
-#include "util/util.h"
20
+#include "namespaces.h"
21
+#include "util/build-id.h"
3622 #include "util/strlist.h"
3723 #include "util/strfilter.h"
38
-#include "util/symbol.h"
24
+#include "util/symbol_conf.h"
3925 #include "util/debug.h"
4026 #include <subcmd/parse-options.h>
4127 #include "util/probe-finder.h"
4228 #include "util/probe-event.h"
4329 #include "util/probe-file.h"
30
+#include <linux/string.h>
31
+#include <linux/zalloc.h>
4432
4533 #define DEFAULT_VAR_FILTER "!__k???tab_* & !__crc_*"
4634 #define DEFAULT_FUNC_FILTER "!_*"
....@@ -464,7 +452,8 @@
464452 ret = probe_file__del_strlist(kfd, klist);
465453 if (ret < 0)
466454 goto error;
467
- }
455
+ } else if (ret == -ENOMEM)
456
+ goto error;
468457
469458 ret2 = probe_file__get_events(ufd, filter, ulist);
470459 if (ret2 == 0) {
....@@ -474,7 +463,8 @@
474463 ret2 = probe_file__del_strlist(ufd, ulist);
475464 if (ret2 < 0)
476465 goto error;
477
- }
466
+ } else if (ret2 == -ENOMEM)
467
+ goto error;
478468
479469 if (ret == -ENOENT && ret2 == -ENOENT)
480470 pr_warning("\"%s\" does not hit any event.\n", str);