Re: [PATCH 1/1] pahole: Add option to obtain a vmlinux matching the running kernel

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, 2024-08-28 at 16:35 -0300, Arnaldo Carvalho de Melo wrote:

[...]

Tested-by: Eduard Zingerman <eddyz87@xxxxxxxxx>

> @@ -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;
>  







[Index of Archives]     [Linux Samsung SoC]     [Linux Rockchip SoC]     [Linux Actions SoC]     [Linux for Synopsys ARC Processors]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]


  Powered by Linux