[Crash-utility] [PATCH v2] struct: Fix handing of percpu symbols (when symbolic argument only)

Aaron Tomlin atomlin at redhat.com
Fri Sep 30 14:50:10 UTC 2016


On Fri 2016-09-30 09:32 -0400, Dave Anderson wrote:
> Fair enough -- but let's avoid the heavy-handed call to expr_type_name()
> unless the argument is actually a cpuspec:
> 
> --- crash-7.1.5/symbols.c.orig	2016-09-30 09:21:15.577896529 -0400
> +++ crash-7.1.5/symbols.c	2016-09-30 09:16:53.676652458 -0400
> @@ -81,6 +81,7 @@ static void cmd_datatype_common(ulong);
>  static void do_datatype_addr(struct datatype_member *, ulong, int,
>  			     ulong, char **, int);
>  static void process_gdb_output(char *, unsigned, const char *, int);
> +static char *expr_type_name(const char *);
>  static int display_per_cpu_info(struct syment *, int, char *);
>  static struct load_module *get_module_percpu_sym_owner(struct syment *);
>  static int is_percpu_symbol(struct syment *);
> @@ -6112,6 +6113,7 @@ cmd_datatype_common(ulong flags)
>          char *separator;
>          char *structname, *members;
>          char *memberlist[MAXARGS];
> +        char *typename;
>  
>          dm = &datatype_member;
>  	count = 0xdeadbeef;
> @@ -6245,6 +6247,15 @@ cmd_datatype_common(ulong flags)
>  				      sp->name);
>  				cpuspec = NULL;
>  			}
> +			if (cpuspec) {
> +				if ((typename = expr_type_name(sp->name))) {
> +				    	if (LASTCHAR(typename) == '*')
> +						error(WARNING,
> +						    "percpu symbol %s is of type pointer\n",
> +							sp->name);
> +					FREEBUF(typename);
> +				}
> +			}
>  	                addr = sp->value;
>  			aflag++;
>  	        } else {

Ack

-- 
Aaron Tomlin




More information about the Crash-utility mailing list