From: Eduard Zingerman <eddyz87@gmail.com>
To: Arnaldo Carvalho de Melo <acme@kernel.org>
Cc: Alan Maguire <alan.maguire@oracle.com>,
Andrii Nakryiko <andrii@kernel.org>,
Jiri Olsa <jolsa@kernel.org>,
dwarves@vger.kernel.org, bpf@vger.kernel.org,
Linux Kernel Mailing List <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH 1/1] pahole: Add option to obtain a vmlinux matching the running kernel
Date: Wed, 28 Aug 2024 17:08:34 -0700 [thread overview]
Message-ID: <2b92648adb162a1c6202ba447277a37902d0b407.camel@gmail.com> (raw)
In-Reply-To: <Zs977_n0rkleEl94@x1>
On Wed, 2024-08-28 at 16:35 -0300, Arnaldo Carvalho de Melo wrote:
[...]
Tested-by: Eduard Zingerman <eddyz87@gmail.com>
> @@ -3707,6 +3716,21 @@ int main(int argc, char *argv[])
> goto out;
> }
>
> + if (show_running_kernel_vmlinux) {
> + const char *vmlinux = vmlinux_path__find_running_kernel();
> +
> + if (vmlinux) {
> + fprintf(stdout, "%s\n", vmlinux);
> + rc = EXIT_SUCCESS;
> + } else {
> + fputs("pahole: couldn't find a vmlinux that matches the running kernel\n"
> + "HINT: Maybe you're inside a container or missing a debuginfo package?\n",
> + stderr);
> + }
Nitpick: when run with valgrind this reports a leak for 'vmlinux':
==186== Memcheck, a memory error detector
==186== Copyright (C) 2002-2024, and GNU GPL'd, by Julian Seward et al.
==186== Using Valgrind-3.23.0 and LibVEX; rerun with -h for copyright info
==186== Command: /home/eddy/work/dwarves-fork/build/pahole --running_kernel_vmlinux
==186==
vmlinux
==186==
==186== HEAP SUMMARY:
==186== in use at exit: 8 bytes in 1 blocks
==186== total heap usage: 15 allocs, 14 frees, 21,408 bytes allocated
==186==
==186== 8 bytes in 1 blocks are definitely lost in loss record 1 of 1
==186== at 0x4843866: malloc (vg_replace_malloc.c:446)
==186== by 0x4A8F9AE: strdup (strdup.c:42)
==186== by 0x48755EC: vmlinux_path__find_running_kernel (dwarves.c:2718)
==186== by 0x40ABBD: main (pahole.c:3720)
==186==
==186== LEAK SUMMARY:
==186== definitely lost: 8 bytes in 1 blocks
==186== indirectly lost: 0 bytes in 0 blocks
==186== possibly lost: 0 bytes in 0 blocks
==186== still reachable: 0 bytes in 0 blocks
==186== suppressed: 0 bytes in 0 blocks
While technically this is not a problem, maybe add a call to free()
just to avoid noise in valgrind output?
(Note that 'const' qualifier is no longer needed for
vmlinux_path__find_running_kernel, as it returns strdup result).
> +
> + return rc;
> + }
> +
> if (languages.str && parse_languages())
> return rc;
>
prev parent reply other threads:[~2024-08-29 0:08 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-08-28 19:35 Arnaldo Carvalho de Melo
2024-08-29 0:08 ` Eduard Zingerman [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=2b92648adb162a1c6202ba447277a37902d0b407.camel@gmail.com \
--to=eddyz87@gmail.com \
--cc=acme@kernel.org \
--cc=alan.maguire@oracle.com \
--cc=andrii@kernel.org \
--cc=bpf@vger.kernel.org \
--cc=dwarves@vger.kernel.org \
--cc=jolsa@kernel.org \
--cc=linux-kernel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®