This is the mail archive of the gdb@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: GDB --> Parallel Port --> Target??


Andrew Batchelor <A.C.Batchelor-99@student.lboro.ac.uk> writes:

> Hello, 
> 
> I was wondering how straightforward it would be to write an extension
> for GDB to use the parallel port to connect to a target instead of the
> serial port?  (Changing only a few files?  Many files?  Which ones?,
> etc.)
> 
> Now I'm not really very familiar with GDB and before I jump in at the
> deep end, I was wondering if any of you guys could give me any pointers?
> At the moment I'm just having a read through the User Manual and the
> Internals Manual and looking at some of the C files that look like they
> might be of some help - can any of you guys point me in the right
> direction?
> 
> Any help or advice you could offer would be much appreciated.

Have you tried simply doing "target remote /dev/lpt"?  It's worth a
shot.

If it turns out that doesn't work because the parallel device needs
special handling, that can be done pretty easily.  
Someone asked about this regarding USB recently:

http://sources.redhat.com/ml/insight/2003-q4/msg00016.html


Oddly enough, it seems like someone was thinking about this at some
point.  In serial.c:

    struct serial *
    serial_open (const char *name)
    {
      struct serial *scb;
      struct serial_ops *ops;
      const char *open_name = name;

      for (scb = scb_base; scb; scb = scb->next)
        if (scb->name && strcmp (scb->name, name) == 0)
          {
            scb->refcnt++;
            return scb;
          }

      if (strcmp (name, "pc") == 0)
        ops = serial_interface_lookup ("pc");
      else if (strchr (name, ':'))
        ops = serial_interface_lookup ("tcp");
      else if (strncmp (name, "lpt", 3) == 0)
        ops = serial_interface_lookup ("parallel");
      else if (strncmp (name, "|", 1) == 0)
        {
          ops = serial_interface_lookup ("pipe");
          open_name = name + 1; /* discard ``|'' */
        }
      else
        ops = serial_interface_lookup ("hardwire");

But this is just parsing what comes after "target remote".  So "target
remote lpt" would try to find a serial interface named "parallel".
But there is no code I could find that registered an interface by that
name, so the open would fail.


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