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: [RFA] Bugfixes in x86-64 target


> Index: ChangeLog
> from  Jiri Smid  <smid@suse.cz>
> 
> * x86-64-tdep.c (value.h): Delete.
> 	(gdb_assert.h): Include.
> 	(x86_64_register_convert_to_virtual,
> 	x86_64_register_convert_to_raw ): Add check whitch caouse that


tipo.

> 	only floating-point values are converted.
> 	(value_push): Delete.
> 	(x86_64_push_arguments): Order of arguments pushed on stack fixed.
> 	(i386_gdbarch_init): Number of register_bytes fixed.
> 

> !   /* Convert to TYPE.  This should be a no-op, if TYPE is equivalent
> !      to the extended floating-point format used by the FPU.  */
> !   d = extract_floating (buf, sizeof buf);
> !   store_floating (to, TYPE_LENGTH (type), d);


Use extract/store typed_floating() or better yet Mark K's 
convert_typed_floating().

>   }
>   
>   /* Convert data from virtual format with type TYPE in buffer FROM to
> *************** void
> *** 127,132 ****
> --- 143,152 ----
>   x86_64_register_convert_to_raw (struct type *type, int regnum,
>   				char *from, char *to)
>   {
> +   gdb_assert (TYPE_CODE (type) == TYPE_CODE_FLT
> + 	      && TYPE_LENGTH (type) == 12);
> + 
> +   /* Simply omit the two unused bytes.  */
>     memcpy (to, from, FPU_REG_RAW_SIZE);
>   }


Same here.

I suspect you also need to update the register virtual type function so 
that they are more explicit (don't rely on sizeof(int) et.al.) vis:

> /* Return the GDB type object for the "standard" data type of data in
>    register N. */
> static struct type *
> x86_64_register_virtual_type (int regno)
> {
>   if (regno == PC_REGNUM || regno == SP_REGNUM)
>     return lookup_pointer_type (builtin_type_void);


builtin_type_void_func_ptr

>   if (IS_FP_REGNUM (regno))
>     return builtin_type_long_double;


builtin_type_i386_ext.  Changing this and the above should magically fix 
some of the FP conversion problems I suspect you're seeing.

>   if (IS_SSE_REGNUM (regno))
>     return builtin_type_v4sf;
>   if (IS_FPU_CTRL_REGNUM (regno) || regno == MXCSR_REGNUM
>       || regno == EFLAGS_REGNUM)
>     return builtin_type_int;


builtin_type_int32 or int64?

>   return builtin_type_long;


builtin_type_int64?


> }



>   CORE_ADDR
>   x86_64_push_arguments (int nargs, struct value **args, CORE_ADDR sp,
>   		       int struct_return, CORE_ADDR struct_addr)

> +   int stack_values[nargs];


You'll need to use something like xmalloc() or alloca() as the above is 
a GCC extension.

otherwize ok.


Andrew




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