This is the mail archive of the gdb-patches@sourceware.org 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: Add support for nanoseconds


On Thursday 12 January 2012 14:54:39 Mike Stump wrote:
> I'd like to add support for nanoseconds to stat in the simulator:

idea is good by me

> --- sim/common/config.in	(revision 1988)
> +++ sim/common/config.in	(working copy)

this file is autogenerated too, so you don't need to include that in your diffs

> --- sim/common/callback.c	(revision 1988)
> +++ sim/common/callback.c	(working copy)
>
> +#ifdef HAVE_STRUCT_STAT_ST_ATIM_TV_NSEC
> +	  ST_x (st_atim.tv_nsec);
> +#endif
> +#ifdef HAVE_STRUCT_STAT_ST_ATIMENSEC
> +	  ST_x (st_atimensec);
> +#endif

i'm not sure about this part.  if the host where the sim runs has 
"st_atim.tv_nsec", but the target code uses "st_atimensec", the field won't get 
translated.  it'd only work if they both use the same name.

let's go with "st_atimensec" always being the translation name.  so we'd keep 
these ones:
	#ifdef HAVE_STRUCT_STAT_ST_ATIMENSEC
		  ST_x (st_atimensec);
	#endif

but we'll have to add a new helper for the others.  maybe:
#undef ST_xx
#define ST_xx(HFLD, TFLD)                   \
      else if (strncmp (m, #TFLD, q - m) == 0)   \
        cb_store_target_endian (cb, p, size, hs->HFLD)
#undef ST_x
#define ST_x(FLD) ST_xx(FLD, FLD)

and then you'd do:
	#ifdef HAVE_STRUCT_STAT_ST_ATIM_TV_NSEC
		  ST_xx (st_atim.tv_nsec, st_atimensec);
	#endif

could you give that a spin ?
-mike

Attachment: signature.asc
Description: This is a digitally signed message part.


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