This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [PATCH] Add comments to gdbarch_address_class_name_to_type_flags
- From: Simon Marchi <simon dot marchi at ericsson dot com>
- To: Pedro Alves <palves at redhat dot com>
- Cc: GDB Patches <gdb-patches at sourceware dot org>
- Date: Thu, 16 Jan 2014 14:31:27 -0500
- Subject: Re: [PATCH] Add comments to gdbarch_address_class_name_to_type_flags
- Authentication-results: sourceware.org; auth=none
- References: <52D8293B dot 6060701 at ericsson dot com> <52D82EDF dot 5010402 at redhat dot com>
On 14-01-16 02:11 PM, Pedro Alves wrote:
> On 01/16/2014 06:47 PM, Simon Marchi wrote:
>> +/* Return the appropriate type_flags for the supplied address class.
>> + This function should return 1 if the address class was recognized and
>> + type_flags was set, zero otherwise.
>
> Say true/false instead of 1/zero.
>
>> + No assumption should be made about the initial value of *type_flags_ptr,
>> + which means that if it returns 1, the function should write it, even if
>> + no flags are set. */
>
> This makes me a little confused. This is a mapping/conversion function:
>
> class name -> type flags
>
> I'd expect the function to recognize the name, and return a valid flag
> (thus return true), or not recognize the name, and return false.
>
> What would "even if no flags are set" mean? What's the use case for that?
> Recognizing a class name, but having that map to no flags? As in,
> ignoring the class name? Is that useful?
In our case, address classes are used for multiple memory spaces support. For completeness sake, I wanted to allow the user to specify that a variable is in the default address space, for those who like to be explicit. An address in the default space would cause no flag to be set. So yeah, this is a little far fetched and arguable, so probably doesn't need to be mentioned here.
The part "No assumption should be made about the initial value of *type_flags_ptr" is still important I think, so that people know that you should not just OR your flags, but overwrite the whole content.
Simon