Re: [PATCH 2/5] Associate target_dcache to address_space.

Tom Tromey
2013-10-23T16:37:10Z

>>>>> "Yao" == Yao Qi <yao@codesourcery.com> writes:

Yao> Nowadays, 'target_dcache' is a global variable in GDB, which is not
Yao> necessary. It can be a per-address-space variable. In this patch, we
Yao> add a new structure 'target_dcache', which includes all dcaches of
Yao> target and all of them are per-address-space.

I like this patch quite a bit. For one thing, it fixes the target
dcache for the coming multi-target work :-)

Yao> +/* The current added space. */
Yao> +#define current_address_space current_program_space->aspace

On the whole I would prefer we not add new object-style macros like
this. (Actually I'd really like it if we got rid of the existing ones
too...) Writing out the expansion in the few places it is used seems
better to me.

Yao> +static void
Yao> +target_dcache_cleanup (struct address_space *aspace, void *arg)
Yao> +{
Yao> + struct target_dcache *dcache
Yao> + = address_space_data (aspace, target_dcache_aspace_key);
Yao> +
Yao> + target_dcache_xfree (dcache);

Here you don't need to call address_space_data, since ARG is the dcache
that was passed in.

Tom