[ECOS] gdb and ioctl(sd, SIOCIFCREATE, &ifreq)

Morris Walton mwalton@telesyn.com
Wed Nov 3 08:18:00 GMT 2004


I can't just simply replace with the latest CVS version:
 
#ifdef CYGSEM_HAL_VIRTUAL_VECTOR_DIAG
    // Set up interfaces so debug environment can share this device
    {
        void *dbg = CYGACC_CALL_IF_DBG_DATA();
        if (!dbg) {
            CYGACC_CALL_IF_DBG_DATA_SET((void *)sc);
        }
    }
#endif

This code seems to set the first interface as the debug interface.  My debug
eth is actually the second eth device to be configured (fcc3/eth2).  
Hmm.

> -----Original Message-----
> From: Morris Walton [mailto:mwalton@telesyn.com]
> Sent: Tuesday, November 02, 2004 9:16 PM
> To: 'Morris Walton'; 'Gary Thomas'
> Cc: 'eCos Discussion'
> Subject: RE: [ECOS] gdb and ioctl(sd, SIOCIFCREATE, &ifreq)
> 
> I have stepped into the if_clone_create code and discovered this last
> section of eth_drv_init in eth_drv.c is causing the problem:
> 
> #ifdef CYGSEM_HAL_VIRTUAL_VECTOR_DIAG
> // Set up interfaces so debug environment can share this device
>     {
>         void *dbg = CYGACC_CALL_IF_DBG_DATA();
>         char *dev;
>         hal_virtual_comm_table_t* __chan;
>         __chan = CYGACC_CALL_IF_DEBUG_PROCS();
>         dev = CYGACC_COMM_IF_CONTROL(*__chan, __COMMCTL_GET_DEVICE_NAME,
> 0);
> 
>         // 'dev' will be the device name of the console.
>         if ((dev == 0) || (strcmp(dev, sc->dev_name) == 0)) {
>             CYGACC_CALL_IF_DBG_DATA_SET((void *)sc);
>         }
>     }
> #endif
> }
> 
> dev turns out to be null in my case, so CYGACC_CALL_IF_DBG_DATA_SET
> rearranges our dbg vector table entry.  I will have to look more closely
> in order to propose a fix and so I am entertaining suggestions.
> 
> Thanks,
> 
> Morris
> 
> 
> > -----Original Message-----
> > From: Morris Walton [mailto:mwalton@telesyn.com]
> > Sent: Tuesday, November 02, 2004 1:02 PM
> > To: 'Morris Walton'; 'Gary Thomas'
> > Cc: 'eCos Discussion'
> > Subject: RE: [ECOS] gdb and ioctl(sd, SIOCIFCREATE, &ifreq)
> >
> > Nm about duplicate ip - found the source and got rid of those messages.
> > Still have problem with SIOCIFCREATE.
> >
> > > -----Original Message-----
> > > From: Morris Walton [mailto:mwalton@telesyn.com]
> > > Sent: Tuesday, November 02, 2004 11:30 AM
> > > To: 'Gary Thomas'
> > > Cc: 'eCos Discussion'
> > > Subject: RE: [ECOS] gdb and ioctl(sd, SIOCIFCREATE, &ifreq)
> > >
> > > You were right: I was using the same IP for both redboot and
> > application.
> > > Although I still see the original problem, I also see this on the gdb
> > > console before getting to the ioctl, as the application starts
> running:
> > >
> > > arp: 4019892 is using my IP address :!
> > > arp: 4019892 is using my IP address :!
> > >
> > > I wonder if this is not "confusing" the network now. I hadn't noticed
> > this
> > > before (when using same IP).
> > >
> > > I have checked the lan, and neither address x.101 nor x.100 is used by
> > > anthing else.
> > >
> > > > -----Original Message-----
> > > > From: Gary Thomas [mailto:gary@mlbassoc.com]
> > > > Sent: Tuesday, November 02, 2004 6:57 AM
> > > > To: Morris Walton
> > > > Cc: eCos Discussion
> > > > Subject: Re: [ECOS] gdb and ioctl(sd, SIOCIFCREATE, &ifreq)
> > > >
> > > > On Mon, 2004-11-01 at 18:39, Morris Walton wrote:
> > > > > Hi,
> > > > >
> > > > > My gdb session to my ppc 8xxx target (using Ethernet - target
> remote
> > > > > <ip>:9000) appears to be hung after the code running on the target
> > > > issues
> > > > > the SIOCIFCREATE io command:
> > > > >
> > > > > int
> > > > > if_dev_create(char *name)
> > > > > {
> > > > >    struct ifreq ifreq;
> > > > >
> > > > >    int sd = socket(AF_INET, SOCK_DGRAM, 0);
> > > > >
> > > > >    strcpy(ifreq.ifr_name, name);
> > > > >    if (ioctl(sd, SIOCIFCREATE, &ifreq) == -1)
> > > > >
> > > > > <no longer stepping, gdb unresponsive>
> > > > >
> > > > > Anyone had luck or have suggestions with using the SIOCIFCREATE?
> > This
> > > > looks
> > > > > like it amounts to a call to if_clone_create.
> > > >
> > > > Does your RedBoot have a separate IP address from the eCos
> > application?
> > > > If not, e.g. RedBoot's IP address is DHCP assigned, then once the
> eCos
> > > > application starts up, things will get confused and the debug
> session
> > > > will break.
> > > >
> > > > Simply make sure that the GDB world (RedBoot) and eCos application
> > > > have different IP addresses.  I do this by using static unique IP
> > > > addresses for RedBoot.
> > > >
> > > > --
> > > > Gary Thomas <gary@mlbassoc.com>
> > > > MLB Associates



--
Before posting, please read the FAQ: http://ecos.sourceware.org/fom/ecos
and search the list archive: http://ecos.sourceware.org/ml/ecos-discuss



More information about the Ecos-discuss mailing list