Re: [PATCH 5/9 v7] Introduce common-regcache.h

Pedro Alves
2014-09-10T13:09:28Z

On 08/29/2014 02:51 PM, Gary Benson wrote:
> This introduces common-regcache.h. This contains two functions that
> allow nat/linux-btrace.c to be simplified. A better long term
> solution would be unify the regcache code, but this is sufficient for
> now.
>
> This patch differs from the version I posted on August 1
> (https://sourceware.org/ml/gdb-patches/2014-08/msg00010.html) in that
> some suggested documentation changes have been made and that various
> updates were required to reflect regcache changes recently committed
> by Andreas Arnez.
>
> gdb/ChangeLog:
>
> * common/common-regcache.h: New file.
> * Makefile.in (HFILES_NO_SRCDIR): Add common/common-regcache.h.
> * regcache.h: Include common-regcache.h.
> (regcache_read_pc): Don't declare.
> * regcache.c (get_thread_regcache_for_ptid): New function.
> * nat/linux-btrace.c: Don't include regcache.h.
> Include common-regcache.h.
> (perf_event_read_bts): Use get_thread_regcache_for_ptid.
>
> gdb/gdbserver/ChangeLog:
>
> * regcache.h: Include common-regcache.h.
> (regcache_read_pc): Don't declare.
> * regcache.c (get_thread_regcache_for_ptid): New function.
> diff --git a/gdb/gdbserver/regcache.h b/gdb/gdbserver/regcache.h
> index 891fead..0c933f3 100644
> --- a/gdb/gdbserver/regcache.h
> +++ b/gdb/gdbserver/regcache.h
> @@ -19,6 +19,8 @@
> #ifndef REGCACHE_H
> #define REGCACHE_H
>
> +#include "common-regcache.h"
> +
> struct thread_info;
> struct target_desc;
>
> @@ -91,8 +93,6 @@ void registers_to_string (struct regcache *regcache, char *buf);
>
> void registers_from_string (struct regcache *regcache, char *buf);
>
> -CORE_ADDR regcache_read_pc (struct regcache *regcache);
> -

Like in the target patches, please leave breadcrumbs pointing
to the shared header (here and elsewhere).

Otherwise looks good to me too.

Thanks,
Pedro Alves