This is the mail archive of the
gdb-patches@sources.redhat.com
mailing list for the GDB project.
Re: [PATCH] Cross target core debugging: host=i386, Target=PPC
- From: Kevin Buettner <kevinb at redhat dot com>
- To: Martin Gadbois <martin dot gadbois at colubris dot com>, gdb-patches at sources dot redhat dot com
- Date: Mon, 29 Jul 2002 14:53:59 -0700
- Subject: Re: [PATCH] Cross target core debugging: host=i386, Target=PPC
- References: <3D45ACCC.9040803@colubris.com>
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