Re: [PATCH 2/4] as-name: allow real names for address spaces

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

 




On 08/12/2018 22:03, Luc Van Oostenryck wrote:
> Currently, address space 1 is displayed as '<asn:1>' and so on.
> It would be more useful to display a name like the one used in
> the code: '__user'.
> 
> Allow this by letting show_as() display an identifier associated
> with the address space if one exist.
> 
> Signed-off-by: Luc Van Oostenryck <luc.vanoostenryck@xxxxxxxxx>
> ---
>  lib.c        | 2 ++
>  lib.h        | 1 +
>  show-parse.c | 5 +++++
>  3 files changed, 8 insertions(+)
> 
> diff --git a/lib.c b/lib.c
> index 818207450..d8f652421 100644
> --- a/lib.c
> +++ b/lib.c
> @@ -52,6 +52,8 @@ int die_if_error = 0;
>  int has_error = 0;
>  int do_output = 1;
>  
> +const struct ident *address_space_names[16];
> +

s/16/MAX_AS_NAMES/ ?

>  #ifndef __GNUC__
>  # define __GNUC__ 2
>  # define __GNUC_MINOR__ 95
> diff --git a/lib.h b/lib.h
> index 14b13b676..5718867ea 100644
> --- a/lib.h
> +++ b/lib.h
> @@ -47,6 +47,7 @@ extern int verbose, optimize_level, optimize_size, preprocessing;
>  extern int die_if_error;
>  extern int repeat_phase;
>  extern int do_output;
> +extern const struct ident *address_space_names[16];

ditto

>  extern int gcc_major, gcc_minor, gcc_patchlevel;
>  
>  extern const char *base_filename;
> diff --git a/show-parse.c b/show-parse.c
> index 89afdb5f4..4dedccf39 100644
> --- a/show-parse.c
> +++ b/show-parse.c
> @@ -188,6 +188,11 @@ const char *show_as(unsigned int as)
>  	static int n;
>  	char *buff;
>  
> +	if (as < ARRAY_SIZE(address_space_names)) {
> +		const struct ident *name = address_space_names[as];
> +		if (name)
> +			return show_ident(name);
> +	}
>  	buff = buffer[2 & ++n];
>  	sprintf(buff, "<asn:%u>", as);
>  	return buff;
> 



[Index of Archives]     [Newbies FAQ]     [LKML]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Trinity Fuzzer Tool]

  Powered by Linux