This is the mail archive of the
gdb-patches@sources.redhat.com
mailing list for the GDB project.
Re: [PATCH] Generic register_virtual_size function.
- From: Michael Snyder <msnyder at cygnus dot com>
- To: gdb-patches at sources dot redhat dot com, cagney at redhat dot com
- Date: Mon, 10 Dec 2001 13:43:19 -0800
- Subject: Re: [PATCH] Generic register_virtual_size function.
- Organization: Red Hat, Inc.
- References: <200112102141.fBALfJW01783@reddwarf.cygnus.com>
Argh -- this is what I meant to say...
Michael Snyder wrote:
>
> This idea occurred to me after looking at Andrew's
> generic version of register_raw_size:
>
> 2001-12-10 Michael Snyder <msnyder@redhat.com>
>
> * arch-utils.c (generic_register_virtual_size): New function.
> * arch-utils.h: Export generic version of register_virtual_size.
> * gdbarch.sh (REGISTER_VIRTUAL_SIZE): Use new function as default.
> * gdbarch.c: Regenerate.
>
> Index: gdbarch.sh
> ===================================================================
> RCS file: /cvs/src/src/gdb/gdbarch.sh,v
> retrieving revision 1.96
> diff -c -3 -p -r1.96 gdbarch.sh
> *** gdbarch.sh 2001/12/10 04:58:29 1.96
> --- gdbarch.sh 2001/12/10 21:40:13
> *************** v:2:REGISTER_BYTES:int:register_bytes:::
> *** 429,435 ****
> f:2:REGISTER_BYTE:int:register_byte:int reg_nr:reg_nr::0:0
> f:2:REGISTER_RAW_SIZE:int:register_raw_size:int reg_nr:reg_nr::generic_register_raw_size:0
> v:2:MAX_REGISTER_RAW_SIZE:int:max_register_raw_size::::0:-1
> ! f:2:REGISTER_VIRTUAL_SIZE:int:register_virtual_size:int reg_nr:reg_nr::0:0
> v:2:MAX_REGISTER_VIRTUAL_SIZE:int:max_register_virtual_size::::0:-1
> f:2:REGISTER_VIRTUAL_TYPE:struct type *:register_virtual_type:int reg_nr:reg_nr::0:0
> f:2:DO_REGISTERS_INFO:void:do_registers_info:int reg_nr, int fpregs:reg_nr, fpregs:::do_registers_info::0
> --- 429,435 ----
> f:2:REGISTER_BYTE:int:register_byte:int reg_nr:reg_nr::0:0
> f:2:REGISTER_RAW_SIZE:int:register_raw_size:int reg_nr:reg_nr::generic_register_raw_size:0
> v:2:MAX_REGISTER_RAW_SIZE:int:max_register_raw_size::::0:-1
> ! f:2:REGISTER_VIRTUAL_SIZE:int:register_virtual_size:int reg_nr:reg_nr::generic_register_virtual_size:0
> v:2:MAX_REGISTER_VIRTUAL_SIZE:int:max_register_virtual_size::::0:-1
> f:2:REGISTER_VIRTUAL_TYPE:struct type *:register_virtual_type:int reg_nr:reg_nr::0:0
> f:2:DO_REGISTERS_INFO:void:do_registers_info:int reg_nr, int fpregs:reg_nr, fpregs:::do_registers_info::0
> Index: gdbarch.c
> ===================================================================
> RCS file: /cvs/src/src/gdb/gdbarch.c,v
> retrieving revision 1.91
> diff -c -3 -p -r1.91 gdbarch.c
> *** gdbarch.c 2001/12/10 04:58:29 1.91
> --- gdbarch.c 2001/12/10 21:40:13
> *************** struct gdbarch startup_gdbarch =
> *** 314,320 ****
> 0,
> generic_register_raw_size,
> 0,
> ! 0,
> 0,
> 0,
> 0,
> --- 314,320 ----
> 0,
> generic_register_raw_size,
> 0,
> ! generic_register_virtual_size,
> 0,
> 0,
> 0,
> Index: arch-utils.c
> ===================================================================
> RCS file: /cvs/src/src/gdb/arch-utils.c,v
> retrieving revision 1.40
> diff -c -3 -p -r1.40 arch-utils.c
> *** arch-utils.c 2001/12/10 04:58:29 1.40
> --- arch-utils.c 2001/12/10 21:40:13
> *************** generic_register_raw_size (int regnum)
> *** 387,392 ****
> --- 387,400 ----
> return TARGET_INT_BIT / HOST_CHAR_BIT;
> }
>
> + /* Assume the virtual size corresponds to the virtual type. */
> +
> + int
> + generic_register_virtual_size (int regnum)
> + {
> + return TYPE_LENGTH (REGISTER_VIRTUAL_TYPE (regnum));
> + }
> +
>
> /* Functions to manipulate the endianness of the target. */
>
> Index: arch-utils.h
> ===================================================================
> RCS file: /cvs/src/src/gdb/arch-utils.h,v
> retrieving revision 1.25
> diff -c -3 -p -r1.25 arch-utils.h
> *** arch-utils.h 2001/12/10 04:58:29 1.25
> --- arch-utils.h 2001/12/10 21:40:13
> *************** extern int generic_in_function_epilogue_
> *** 142,145 ****
> --- 142,149 ----
> of the integer type. */
> extern int generic_register_raw_size (int regnum);
>
> + /* Assume the virtual size of registers corresponds to the virtual type. */
> +
> + extern int generic_register_virtual_type (int regnum);
> +
> #endif