This is the mail archive of the gdb-patches@sources.redhat.com mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH] Cross target core debugging: host=i386, Target=PPC


On Jul 29,  4:59pm, Martin Gadbois wrote:

> diff -Naur gdb-5.2/gdb/gregset.h gdb-5.2-ppc-core/gdb/gregset.h
> --- gdb-5.2/gdb/gregset.h	Sun Feb 24 17:14:33 2002
> +++ gdb-5.2-ppc-core/gdb/gregset.h	Mon Jul 29 15:45:43 2002
> @@ -21,6 +21,20 @@
>  #ifndef GREGSET_H
>  #define GREGSET_H
>  
> +
> +#define ELF_NGREG	48	/* includes nip, msr, lr, etc. */
> +#define ELF_NFPREG	33	/* includes fpscr */
> +#define ELF_NVRREG	33	/* includes vscr */
> +
> +typedef unsigned long elf_greg_t;
> +typedef elf_greg_t elf_gregset_t[ELF_NGREG];
> +
> +typedef double elf_fpreg_t;
> +typedef elf_fpreg_t elf_fpregset_t[ELF_NFPREG];
> +
> +#define GDB_GREGSET_T elf_gregset_t
> +#define GDB_FPREGSET_T elf_fpregset_t
> +
>  #ifndef GDB_GREGSET_T
>  #define GDB_GREGSET_T gregset_t
>  #endif

This part will need some work.  (The other parts might too; I haven't
looked closely at them yet.)  Anyway, there are several problems here...

1) The constants ELF_NGREG, ELF_NFPREG, ELF_NVRREG will almost certainly
   be incorrect for other targets.

2) Defining elf_greg_t in terms of a long isn't portable.

3) Likewise, for elf_fpreg_t being defined in terms of a double.

For #1, why do these constants need to be put into a header file at
all.  Couldn't this knowledge be localized in the portion of the .c
file responsible for decoding the core format?

For #2 and #3, I think it's reasonably portable to define your data
types in terms of arrays of characters.  (Or perhaps in terms of
structs containing arrays of characters.  The struct representation
is perhaps more convenient in certain situations.)

Kevin


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]