This is the mail archive of the insight@sourceware.cygnus.com mailing list for the Insight project.


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

Gdb/Insight enhancement


Hello,
I am using gdb/insight to debug an embedded system across a network
connection and currently don't have the IP address for the node in any name
server or in my local hosts file.  When this is the case I found that you
are not able to connect to a remote target through TCP/IP using the IP
address.  An example of using an IP address might be the command "target
remote 192.168.1.1:1058".  GDB returns an error when trying to do this.  I
made a change in the ser-tcp.c file which allows the connection to be made
either by the DNS name or by the IP address.  To facilitate the explanation
of the change, I will include the original lines from ser-tcp.c first and
then the new/changes lines to facilitate using an IP address>

Lines 69-74 of original source for ser-tcp.c

  if (!hostent)
    {
      fprintf_unfiltered (gdb_stderr, "%s: unknown host\n", hostname);
      errno = ENOENT;
      return -1;
    }


Lines 69-88 of a modified ser-tcp.c file

  if (!hostent)
  {
    
		//Can't get information by name try to get by IP address
		unsigned long IPAddress = inet_addr (  hostname  );
		if (INADDR_NONE == IPAddress)
		{
			fprintf_unfiltered (gdb_stderr, "%s: bad
hostname\n", hostname);
			errno = ENOENT;
			return -1;
		}
		hostent = gethostbyaddr((char*)&IPAddress,
sizeof(IPAddress), 2);
		if (!hostent)
		{
			fprintf_unfiltered (gdb_stderr, "%s: unknown
host\n", hostname);
			errno = ENOENT;
			return -1;
		}
  
	}

I hope this change is acceptable and will be incorporated into future
releases of gdb/insight.

Thank you,
Kevin Staggs

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