[1/5] RISC-V: Make riscv_isa_xlen a global function.
Commit Message
This allows the function to be used from riscv OS files, which also need to
depend on XLEN size.
gdb/
* riscv-tdep.c (riscv_isa_xlen): Drop static.
* riscv-tdep.h (riscv_isa_xlen): Add extern declaration.
---
gdb/riscv-tdep.c | 2 +-
gdb/riscv-tdep.h | 3 +++
2 files changed, 4 insertions(+), 1 deletion(-)
Comments
* Jim Wilson <jimw@sifive.com> [2018-08-07 19:14:06 -0700]:
> This allows the function to be used from riscv OS files, which also need to
> depend on XLEN size.
>
> gdb/
> * riscv-tdep.c (riscv_isa_xlen): Drop static.
> * riscv-tdep.h (riscv_isa_xlen): Add extern declaration.
Looks good.
Thanks,
Andrew
> ---
> gdb/riscv-tdep.c | 2 +-
> gdb/riscv-tdep.h | 3 +++
> 2 files changed, 4 insertions(+), 1 deletion(-)
>
> diff --git a/gdb/riscv-tdep.c b/gdb/riscv-tdep.c
> index abcac98016..20181896c5 100644
> --- a/gdb/riscv-tdep.c
> +++ b/gdb/riscv-tdep.c
> @@ -346,7 +346,7 @@ riscv_has_feature (struct gdbarch *gdbarch, char feature)
> Possible return values are 4, 8, or 16 for RiscV variants RV32, RV64, or
> RV128. */
>
> -static int
> +int
> riscv_isa_xlen (struct gdbarch *gdbarch)
> {
> switch (gdbarch_tdep (gdbarch)->abi.fields.base_len)
> diff --git a/gdb/riscv-tdep.h b/gdb/riscv-tdep.h
> index 4fc05976ba..b35266daf7 100644
> --- a/gdb/riscv-tdep.h
> +++ b/gdb/riscv-tdep.h
> @@ -76,4 +76,7 @@ struct gdbarch_tdep
> unsigned core_features;
> };
>
> +/* Return the width in bytes of the general purpose registers for GDBARCH. */
> +extern int riscv_isa_xlen (struct gdbarch *gdbarch);
> +
> #endif /* RISCV_TDEP_H */
> --
> 2.17.1
>
On Wed, Aug 8, 2018 at 5:42 AM, Andrew Burgess
<andrew.burgess@embecosm.com> wrote:
> * Jim Wilson <jimw@sifive.com> [2018-08-07 19:14:06 -0700]:
>
>> This allows the function to be used from riscv OS files, which also need to
>> depend on XLEN size.
>>
>> gdb/
>> * riscv-tdep.c (riscv_isa_xlen): Drop static.
>> * riscv-tdep.h (riscv_isa_xlen): Add extern declaration.
>
> Looks good.
Committed.
Jim
On 2018-08-07 22:14, Jim Wilson wrote:
> This allows the function to be used from riscv OS files, which also
> need to
> depend on XLEN size.
>
> gdb/
> * riscv-tdep.c (riscv_isa_xlen): Drop static.
> * riscv-tdep.h (riscv_isa_xlen): Add extern declaration.
> ---
> gdb/riscv-tdep.c | 2 +-
> gdb/riscv-tdep.h | 3 +++
> 2 files changed, 4 insertions(+), 1 deletion(-)
>
> diff --git a/gdb/riscv-tdep.c b/gdb/riscv-tdep.c
> index abcac98016..20181896c5 100644
> --- a/gdb/riscv-tdep.c
> +++ b/gdb/riscv-tdep.c
> @@ -346,7 +346,7 @@ riscv_has_feature (struct gdbarch *gdbarch, char
> feature)
> Possible return values are 4, 8, or 16 for RiscV variants RV32,
> RV64, or
> RV128. */
>
> -static int
> +int
> riscv_isa_xlen (struct gdbarch *gdbarch)
> {
> switch (gdbarch_tdep (gdbarch)->abi.fields.base_len)
Just a note for further patches (you can fix this instance as an obvious
patch if you want): when a function is extern, put the documentation in
the .h, and
/* See riscv-tdep.h. */
in the header file. This way, the two comments won't diverge over time.
Simon
@@ -346,7 +346,7 @@ riscv_has_feature (struct gdbarch *gdbarch, char feature)
Possible return values are 4, 8, or 16 for RiscV variants RV32, RV64, or
RV128. */
-static int
+int
riscv_isa_xlen (struct gdbarch *gdbarch)
{
switch (gdbarch_tdep (gdbarch)->abi.fields.base_len)
@@ -76,4 +76,7 @@ struct gdbarch_tdep
unsigned core_features;
};
+/* Return the width in bytes of the general purpose registers for GDBARCH. */
+extern int riscv_isa_xlen (struct gdbarch *gdbarch);
+
#endif /* RISCV_TDEP_H */