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]

Re: [PATCH]: Use 16-bit int for hc11/hc12


> Hi!
> 
> For HC11/HC12, the `int' can be 16 or 32 depending on gcc -mshort option.  
> Since the current dwarf2 reader does not take into account the size
> of basic types, the definition of `int' is often wrong for hc11/hc12.
> 
> The default in gdb is 32 but most people are using short ints (16).  
> The patch uses that to be correct in most common cases (while waiting 
> for new dwarf2 reader).


FYI,

Other ABI's have handled this (see MIPS where int/long can be randomly 
32 or 64) by checking for ABI information in the file header.  By having 
  that information in the header, the linker is able to perform sanity 
checks for things like trying to link int16 and int32 code.

This also makes it possible for a single GDB to debug both ABIs.  Just 
look at the ABI and set things accordingly.

	Andrew


> I've committed this patch.
> 
> 	Stephane
> 
> 2001-07-22  Stephane Carrez  <Stephane.Carrez@worldnet.fr>
> 
> * m68hc11-tdep.c (m68hc11_gdbarch_init): Define int at 16-bits.
> 
> 
> 
> Index: m68hc11-tdep.c
> ===================================================================
> RCS file: /cvs/src/src/gdb/m68hc11-tdep.c,v
> retrieving revision 1.14
> diff -u -p -r1.14 m68hc11-tdep.c
> --- m68hc11-tdep.c	2001/07/15 20:10:02	1.14
> +++ m68hc11-tdep.c	2001/07/22 12:35:55
> @@ -1060,10 +1060,13 @@ m68hc11_gdbarch_init (struct gdbarch_inf
>      default:
>        break;
>      }
> -  
> -  /* Initially set everything according to the ABI.  */
> +
> +  /* Initially set everything according to the ABI.
> +     Use 16-bit integers since it will be the case for most
> +     programs.  The size of these types should normally be set
> +     according to the dwarf2 debug information.  */
>    set_gdbarch_short_bit (gdbarch, 16);
> -  set_gdbarch_int_bit (gdbarch, 32);
> +  set_gdbarch_int_bit (gdbarch, 16);
>    set_gdbarch_float_bit (gdbarch, 32);
>    set_gdbarch_double_bit (gdbarch, 64);
>    set_gdbarch_long_double_bit (gdbarch, 64);
> 



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