[Crash-utility] [PATCH] Show the module's base address for "mod" command

lijiang lijiang at redhat.com
Mon Jan 25 07:51:06 UTC 2021


Hi,Shiyuan
Thank you for the patch.
在 2021年01月19日 17:43, crash-utility-request at redhat.com 写道:
> Date: Tue, 19 Jan 2021 10:02:17 +0800
> From: Yunfeng Ye <yeyunfeng at huawei.com>
> To: <crash-utility at redhat.com>
> Cc: Hewenliang <hewenliang4 at huawei.com>, Shiyuan Hu
> 	<hushiyuan at huawei.com>
> Subject: [Crash-utility] [PATCH] Show the module's base address for
> 	"mod" command
> Message-ID: <f1f1ae61-1526-a7d5-ff07-493a1579ff3d at huawei.com>
> Content-Type: text/plain; charset="utf-8"
> 
> Currently the "mod" command show the address of the module struct,
> it is inconvenient to know the address range of the module, so extend
> to show the base adddress for "mod" command.

Acked-by: Lianbo Jiang <lijiang at redhat.com>

> 
> Signed-off-by: Yunfeng Ye <yeyunfeng at huawei.com>
> ---
>  kernel.c | 7 ++++++-
>  1 file changed, 6 insertions(+), 1 deletion(-)
> 
> diff --git a/kernel.c b/kernel.c
> index 272e0d8751cf..9391c5b37a15 100644
> --- a/kernel.c
> +++ b/kernel.c
> @@ -4473,6 +4473,7 @@ do_module_cmd(ulong flag, char *modref, ulong address,
>  	char buf1[BUFSIZE];
>  	char buf2[BUFSIZE];
>  	char buf3[BUFSIZE];
> +	char buf4[BUFSIZE];
> 
>  	if (NO_MODULES())
>  		return;
> @@ -4494,10 +4495,12 @@ do_module_cmd(ulong flag, char *modref, ulong address,
>  	        }
>  	
>  		if (flag == LIST_MODULE_HDR) {
> -			fprintf(fp, "%s  %s  %s  OBJECT FILE\n",
> +			fprintf(fp, "%s  %s  %s  %s  OBJECT FILE\n",
>  				mkstring(buf1, VADDR_PRLEN, CENTER|LJUST,
>  				"MODULE"),
>  				mkstring(buf2, maxnamelen, LJUST, "NAME"),
> +				mkstring(buf4, VADDR_PRLEN, CENTER|LJUST,
> +				"BASE"),
>  				mkstring(buf3, maxsizelen, RJUST, "SIZE"));
>  		}
>  	
> @@ -4509,6 +4512,8 @@ do_module_cmd(ulong flag, char *modref, ulong address,
>  				    LONG_HEX|RJUST, MKSTR(lm->module_struct)));
>  				fprintf(fp, "%s  ", mkstring(buf2, maxnamelen,
>  					LJUST, lm->mod_name));
> +				fprintf(fp, "%s  ", mkstring(buf4, VADDR_PRLEN,
> +				    LONG_HEX|RJUST, MKSTR(lm->mod_base)));
>  				fprintf(fp, "%s  ", mkstring(buf3, maxsizelen,
>  					RJUST|LONG_DEC, MKSTR(lm->mod_size)));
>  				// fprintf(fp, "%6ld  ", lm->mod_size);
> -- 2.27.0




More information about the Crash-utility mailing list