Wii - debug through wifi
-
- Posts: 3
- Joined: Wed Apr 25, 2012 6:12 pm
Wii - debug through wifi
Since the new Wiis no longer have a gamecube port for gecko debugging, what is the feasability of wifi debugging?
It seems like you should be able to put a server into GDB and route the gecko routines to it.
I imagine if it was this simple, then it would have been done by now, so I am wondering what makes this not feasible? It should be able to be a least used for some printf debugging.
Thanks.
(my first post disappeared, so if this gets double posted, sorry.)
It seems like you should be able to put a server into GDB and route the gecko routines to it.
I imagine if it was this simple, then it would have been done by now, so I am wondering what makes this not feasible? It should be able to be a least used for some printf debugging.
Thanks.
(my first post disappeared, so if this gets double posted, sorry.)
-
- Site Admin
- Posts: 1988
- Joined: Tue Aug 09, 2005 3:21 am
- Location: UK
- Contact:
Re: Wii - debug through wifi
Wifi on the Wii is handled entirely by starlet (including the tcp/ip layer) and the powerpc communicates with starlet using interrupts. This makes it rather difficult to implement a reliable gdb stub since it obviously can't communicate with the host gdb when interrupts are disabled. Enabling interrupts will obviously allow parts of your application to continue running which is then likely to cause the whole thing to fall apart when the stub is waiting for commands while halted.
I'm not saying it's impossible but all tests so far have failed quite badly - stepping and continuing between breakpoints just freezes after several iterations.
I'm not saying it's impossible but all tests so far have failed quite badly - stepping and continuing between breakpoints just freezes after several iterations.
Re: Wii - debug through wifi
Communication to starlet doesn't require interrupts, you can poll the IPC register to see if a response is ready. But there are also other issues that need to be fixed to make the debug stub more reliable overall (don't rely on the stack being usable in the default exception handler, don't use r2/r13 relative accesses inside the debug stub code, etc).
-
- Posts: 3
- Joined: Wed Apr 25, 2012 6:12 pm
Re: Wii - debug through wifi
I have just been trying wifi code from elsewhere and it seems to work:
The section on "run the net_print server" does not work as is. The code supplied in wii_dev_debug\net_print\sockettest\source\net_print.c does not work as is with IP addresses.
Easily fixed with this code:
But that code does not really matter, it is just a sample. All we care about is the debug library.
The library supplied overwrites the normal libdb.a. A better way world be to merge in the code and add it a DEBUG_Init device_type. Maybe called GDBSTUB_DEVICE_WII_TCP
thoughts?
The section on "run the net_print server" does not work as is. The code supplied in wii_dev_debug\net_print\sockettest\source\net_print.c does not work as is with IP addresses.
Easily fixed with this code:
Code: Select all
static int clientsocket(const char *rhost, unsigned short port)
{
struct hostent *ptrh; /* pointer to a host table entry */
struct sockaddr_in sad;/* structure to hold server's address*/
int fd; /* socket descriptor */
memset((char *)&sad, 0, sizeof(sad)); /* clear sockaddr structure */
sad.sin_port = htons((u_short)port);
struct in_addr myaddr;
if (inet_aton(rhost, &myaddr))
{
// setup 'sa' with binarified address and a couple other things
sad.sin_family= PF_INET;
sad.sin_len = sizeof (struct sockaddr_in);
sad.sin_port= htons (port);
memcpy ((char *) &sad.sin_addr, &myaddr.s_addr, sizeof(struct in_addr));
}
else
{
/* Convert host name to equivalent IP address and copy sad */
sad.sin_family = AF_INET; /* set family to Internet */
ptrh = net_gethostbyname(rhost);
if (((char *)ptrh) == NULL)
{
fprintf(stderr, "invalid host: %s\n", rhost);
return (-1);
}
memcpy(&sad.sin_addr, ptrh->h_addr, ptrh->h_length);
}
/* Create a socket */
fd = net_socket(PF_INET, SOCK_STREAM, 0);
if (fd < 0) {
fprintf(stderr, "socket creation failed\n");
return (-1);;
}
/* Connect the socket to the specified server */
if (net_connect(fd, (struct sockaddr *)&sad, sizeof(sad)) < 0) {
fprintf(stderr, "connect failed\n");
return (-1);
}
return fd;
}
The library supplied overwrites the normal libdb.a. A better way world be to merge in the code and add it a DEBUG_Init device_type. Maybe called GDBSTUB_DEVICE_WII_TCP
thoughts?
-
- Posts: 3
- Joined: Wed Apr 25, 2012 6:12 pm
Re: Wii - debug through wifi
Further testing of that code shows that it seems to work if the program is well behaved. Stack dumps cause problems for it. And it does seem to loose sync with the tcip on occasion.
Oh well, at least I might be able to use the net print stuff to do some printf debugging. Beats getting up, removing the SD card with my fprintf logs, putting it in the computer, ...
Oh well, at least I might be able to use the net print stuff to do some printf debugging. Beats getting up, removing the SD card with my fprintf logs, putting it in the computer, ...
Re: Wii - debug through wifi
Would it be possible to run a ppc version of gdb on the wii itself? Or would that suffer from the same interrupt issues?
reg,
Danny
reg,
Danny
-
- Posts: 1
- Joined: Mon Feb 24, 2014 2:57 pm
Re: Wii - debug through wifi
Yardape8000,
Did you manage to actually get GDB client to communicate to the wii? My GDB is dumping a message, " unrecognized item "timeout" in "qsupported" fixed in linux ".
Did you manage to actually get GDB client to communicate to the wii? My GDB is dumping a message, " unrecognized item "timeout" in "qsupported" fixed in linux ".
Re: Wii - debug through wifi
@DRS, you can't run your program and gdb at the same time on the Wii. The Wii "os" isn't designed to be multitasking.
Who is online
Users browsing this forum: No registered users and 3 guests