| .. | .. |
|---|
| 1 | +// SPDX-License-Identifier: GPL-2.0-or-later |
|---|
| 1 | 2 | /* |
|---|
| 2 | 3 | * builtin-probe.c |
|---|
| 3 | 4 | * |
|---|
| 4 | 5 | * Builtin probe command: Set up probe events by C expression |
|---|
| 5 | 6 | * |
|---|
| 6 | 7 | * 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 | | - * |
|---|
| 22 | 8 | */ |
|---|
| 23 | 9 | #include <sys/utsname.h> |
|---|
| 24 | 10 | #include <sys/types.h> |
|---|
| .. | .. |
|---|
| 30 | 16 | #include <stdlib.h> |
|---|
| 31 | 17 | #include <string.h> |
|---|
| 32 | 18 | |
|---|
| 33 | | -#include "perf.h" |
|---|
| 34 | 19 | #include "builtin.h" |
|---|
| 35 | | -#include "util/util.h" |
|---|
| 20 | +#include "namespaces.h" |
|---|
| 21 | +#include "util/build-id.h" |
|---|
| 36 | 22 | #include "util/strlist.h" |
|---|
| 37 | 23 | #include "util/strfilter.h" |
|---|
| 38 | | -#include "util/symbol.h" |
|---|
| 24 | +#include "util/symbol_conf.h" |
|---|
| 39 | 25 | #include "util/debug.h" |
|---|
| 40 | 26 | #include <subcmd/parse-options.h> |
|---|
| 41 | 27 | #include "util/probe-finder.h" |
|---|
| 42 | 28 | #include "util/probe-event.h" |
|---|
| 43 | 29 | #include "util/probe-file.h" |
|---|
| 30 | +#include <linux/string.h> |
|---|
| 31 | +#include <linux/zalloc.h> |
|---|
| 44 | 32 | |
|---|
| 45 | 33 | #define DEFAULT_VAR_FILTER "!__k???tab_* & !__crc_*" |
|---|
| 46 | 34 | #define DEFAULT_FUNC_FILTER "!_*" |
|---|
| .. | .. |
|---|
| 464 | 452 | ret = probe_file__del_strlist(kfd, klist); |
|---|
| 465 | 453 | if (ret < 0) |
|---|
| 466 | 454 | goto error; |
|---|
| 467 | | - } |
|---|
| 455 | + } else if (ret == -ENOMEM) |
|---|
| 456 | + goto error; |
|---|
| 468 | 457 | |
|---|
| 469 | 458 | ret2 = probe_file__get_events(ufd, filter, ulist); |
|---|
| 470 | 459 | if (ret2 == 0) { |
|---|
| .. | .. |
|---|
| 474 | 463 | ret2 = probe_file__del_strlist(ufd, ulist); |
|---|
| 475 | 464 | if (ret2 < 0) |
|---|
| 476 | 465 | goto error; |
|---|
| 477 | | - } |
|---|
| 466 | + } else if (ret2 == -ENOMEM) |
|---|
| 467 | + goto error; |
|---|
| 478 | 468 | |
|---|
| 479 | 469 | if (ret == -ENOENT && ret2 == -ENOENT) |
|---|
| 480 | 470 | pr_warning("\"%s\" does not hit any event.\n", str); |
|---|