[Crash-utility] [PATCH 2/2] dis: Report duplicate symbols

Dave Anderson anderson at redhat.com
Mon Jul 6 15:04:02 UTC 2015



----- Original Message -----
> On Mon 2015-07-06 10:15 -0400, Dave Anderson wrote:
> > 
> > 
> > ----- Original Message -----
> > > Notify the user if there is more than one symbol of the given target.
> > > 
> > > For example, after this patch:
> > > 
> > > - The 'dis' command now reports that more than one symbol of "watchdog"
> > >   exists, to allow the user to be more specific
> > > 
> > >   crash> dis watchdog
> > >   duplicate symbols found: watchdog
> > >   ffffffff810e6100 (t) watchdog
> > >   /usr/src/debug/kernel-2.6.32-431.1.2.el6/linux-2.6.32-431.1.2.el6.x86_64/kernel/hung_task.c:
> > >   199
> > >   ffffffff810e6990 (t) watchdog
> > >   /usr/src/debug/kernel-2.6.32-431.1.2.el6/linux-2.6.32-431.1.2.el6.x86_64/kernel/watchdog.c:
> > >   332
> > >   ffffffff81eb3fc8 (b) watchdog
> > > 
> > > - Choose to disassemble the watchdog() function defined in
> > >   kernel/watchdog.c by using the address of the first function
> > > 
> > >   crash> dis ffffffff810e6990
> > >   0xffffffff810e6990 <watchdog>:	push   %rbp
> > >   0xffffffff810e6991 <watchdog+1>:	mov    %rsp,%rbp
> > >   0xffffffff810e6994 <watchdog+4>:	push   %r13
> > >   0xffffffff810e699d <watchdog+13>:	nopl   0x0(%rax,%rax,1)
> > >   ...
> > > 
> > > Signed-off-by: Aaron Tomlin <atomlin at redhat.com>
> > 
> > Hi Aaron,
> > 
> > Good plan.
> > 
> > But is there any particular reason for adding "show_flags"?  Since the
> > symbol
> > passed to show_symbol() will never have an offset, it doesn't make any
> > difference
> > to save and use the incoming radix, as opposed to the -x|d override, or for
> > that
> > matter, nothing.
> 
> Hi Dave,
> 
> 
> Do you mind applying the follow patch on top of this one?
> I agree - SHOW_RADIX() is absolutely not required here.

Nope -- but I still don't think it's worth disrupting the command if a
duplicate symbol exists that isn't a text address.

Dave


> 
> Thanks!
> 
> 
> diff --git a/kernel.c b/kernel.c
> index b87d9ec..f2b1434 100644
> --- a/kernel.c
> +++ b/kernel.c
> @@ -1339,7 +1339,6 @@ cmd_dis(void)
>  	ulong revtarget;
>  	ulong count;
>  	ulong offset;
> -	ulong show_flags;
>  	struct syment *sp;
>  	struct gnu_request *req;
>  	char *savename;
> @@ -1363,7 +1362,6 @@ cmd_dis(void)
>  	sp = NULL;
>  	unfiltered = user_mode = do_machdep_filter = do_load_module_filter = 0;
>  	radix = 0;
> -	show_flags = SHOW_LINENUM | SHOW_RADIX();
>  
>  	req = (struct gnu_request *)getbuf(sizeof(struct gnu_request));
>  	req->buf = GETBUF(BUFSIZE);
> @@ -1435,9 +1433,9 @@ cmd_dis(void)
>  			do {
>  				if (module_symbol(sp->value, NULL, NULL,
>  				    NULL, 0))
> -					show_symbol(sp, 0, show_flags|SHOW_MODULE);
> +					show_symbol(sp, 0, SHOW_LINENUM|SHOW_MODULE);
>  				else
> -					show_symbol(sp, 0, show_flags);
> +					show_symbol(sp, 0, SHOW_LINENUM);
>  
>  			} while ((sp = symbol_search_next(sp->name, sp)));
>  
> 
> --
> Aaron Tomlin
> 
> --
> Crash-utility mailing list
> Crash-utility at redhat.com
> https://www.redhat.com/mailman/listinfo/crash-utility
> 




More information about the Crash-utility mailing list