Re: [Mingw-users] Re: _WIN32?

Christopher Faylor
2001-05-05T18:54:00Z

On Sun, May 06, 2001 at 08:56:48AM +1000, Danny Smith wrote:
>Please be patient. I have very little experience with multiplatform
>configurations, none with autoconfigury I am one of these folk:
>
>>>(don't worry we're working on it and will have something in the next
>>><<undeterminied>> timeframe, really we will) Windows.
>
>and I am getting a bit confused by some of this discussion, and what I
>should do. For me examples teach.

Possibly reading the gdb archives might be helpful, then.

It is difficult to rectify confusion if you are only making an assertion
of confusion without actually saying what you are confused about.

If you have a question during a discussion, then please ask it.

>Here is an example of what I would like to add:
>
>In event-loop.c, a clock is needed. Posix uses gettimeofday. Here is
>how I would provide that clock for w32:
>
>/* winbase.h definitions */ typedef struct _FILETIME { unsigned long
>dwLowDateTime; unsigned long dwHighDateTime; } FILETIME; void __stdcall
>GetSystemTimeAsFileTime(FILETIME*);
>
>/*time from 1 Jan 1601 to 1 Jan 1970 in 100ns units */ #define
>_W32_FT_OFFSET (116444736000000000LL)
>
>typedef union { long long ns100; /*time since 1 Jan 1601 in 100ns units
>*/ FILETIME ft; } w32_ftv;
>
>void nt_gettimeofday(struct timeval* p, struct timezone* tz /* IGNORED
>*/){ w32_ftv _now; GetSystemTimeAsFileTime( &(_now.ft) );
>p->tv_usec=(long)((_now.ns100 / 10LL) % 1000000LL ); p->tv_sec=
>(long)((_now.ns100-_W32_FT_OFFSET)/10000000LL); return;
>
>
>Now, how would you like me to put this into event-loop.c. An example
>please, either on this list or privately

I may be wrong but I don't believe that anyone wants to be involved in
telling you what to do step by step along the way.

Your first step is to visit the gdb web page at
http://sources.redhat.com/gdb/ and check out all of the information
there.

Once you are sure that you have mastered all of the intracies of
submitting patches that are outlined on this pages and the pages that it
references, you should start submitting patches in the proscribed
manner. People will then offer suggestions about your patches and
you will refine them based on your suggestions.

If I were you, I would encapsulate everything as much as possible.
Rather than make changes to 27 different gdb functions, create
compatibility functions and put them in win32-nat.c, controlled by a
defined (_WIN32) && !defined (__CYGWIN__) conditional. I think that it
is appropriate to use system-specific defines in something like
win32-nat.c. I wouldn't deny a patch which contained this kind of
change (modulo Andrew's oversight, of course).

I'm not sure what you are expecting from reading the above. If you are
implying that you will be including things like the definition for
FILETIME in gdb somewhere, that is clearly wrong. Your formatting is
also not GNU compliant. It will have to conform to the rest of gdb if
you want to get it accepted.

It looks like you could just name the function above gettimeofday and
that would satisfy gdb's gettimeofday requirement. You'll need to put
the prototypes for this function into something that is included by gdb,
though. I'm not sure what header file would be appropriate for that.
That is something that you'll have to research.

We were talking about the fact that there may be places in gdb which
are currently under _WIN32 control which should actually be under something
like FILESYSTEM_USES_COLON control, or something like that. Those are
the things that should be set in configure.host, IMO.

cgf