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: [RFC] Suggested ways to remove the need for xm-go32.h


Christopher Faylor <me@cgf.cx> wrote:
> MichaelC has indicated which systems support "rb".  Is there any way to
> somehow figure out if this is supported for the whole list of supported
> targets?

That brings up a tough philosophical issue.  Well, okay, part of it
is tough because it implies more work for me.

There isn't a list of supported hosts or supported targets.

The software itself has "list of hosts and targets that somebody, at
some time in the past, contributed at least some work towards."

The gdb-testers@ group records "somebody tested something and reported
results in some way".  That's where the "more work for me" comes in:
devising some standard meta-information for a test run (like a little
XML file, that's what I use in my test bed), and then augmenting the
test suite to generate gdb-test-run.xml on every run, and then having
people mail that in, and then begging more people to report their
results, and then writing "Terf II" to keep track of it all.

The release criteria for gdb is "break main ; run works on unspecified
platforms".

> Or can we try going without the wrapper function and move
> to a wrapper function when someone complains?

For the second question, from a support point of view, I want something
that (a) works on a lot of systems and (b) when it doesn't work on some
system, it's an obvious 1-line patch to work around the problem.  So I
don't like "no wrapper function but then change the code when someone
shows up with a weird system".

To avoid the wrapper function, perhaps probe for the modes at
run time:

  static const char * read_mode = NULL;

  void set_read_mode ()
  {
    FILE * fp = NULL;

    if (read_mode == NULL)
      {
	if ((fp = fopen ("/dev/null", "rb")) != NULL)
	  read_mode = "rb";
	else if ((fp = fopen ("/dev/null", "r")) != NULL)
	  read_mode = "r";
	else
	  some sort of error;
      }

    if (fp != NULL)
      {
	if (fclose(fp) != 0 )
	  error;
      }
  }

Personally I like wrappers for ease of porting.  It doesn't bug me to
see gdb_fopen + fopen on the call stack.

I don't think that "rb" versus "r" can be autoconf'ed.  The gdb
configure script would need to execute a host program to figure out
whether "rb" is supported or not, and that won't work if build != host.
Or maybe I'm wrong about that and there's some way to do it.

Michael


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