devkitPro / binutils-gdb

Unofficial mirror of sourceware binutils-gdb repository. Updated daily.
https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git
GNU General Public License v2.0
2 stars 1 forks source link

Update GDB to newest version #2

Closed janmaartenbuis closed 1 year ago

janmaartenbuis commented 2 years ago

From what I know, the reason an older version of GDB is included in this repo is because of the connection error that appears in later GDB versions. I've traced the assert error in the GDB source code and I think I've fixed it. I've been using GDB 12.1 (build for ppc) on Linux in combination with the gdbstub for debugging GameCube homebrew over the BBA and it works fine. I don't have permission to push to this repo, but I'd be happy to share my fix if you're interested.

digitall commented 1 year ago

@janmaartenbuis : If you still have this patch, could you share it as a github gist or similar as trying to sort out GDB for the Wii when using newer GDB than 7.7.1 ...

WinterMute commented 1 year ago

This repo contains only upstream gdb & patches for devkitARM-gdb. This is not the appropriate place for this issue nor is the issue with gdb.

janmaartenbuis commented 1 year ago

@WinterMute sorry, my bad. For me the issue was very much GDB. Any suggestion where I could share this then?

digitall commented 1 year ago

@WinterMute : Can you please indicate where in the devkitPro org, the repository for gdb for Wii / Gamecube is generated / built from then? I haven't been able to locate this and thought that this was the source repo...

digitall commented 1 year ago

@janmaartenbuis : You can create a public gist as per https://docs.github.com/en/get-started/writing-on-github/editing-and-sharing-content-with-gists/creating-gists ... Once done, drop me a message at @scummvm.org. Thanks.

@WinterMute, @devkitPro: Sorry for the noise. Will not bother you further.

WinterMute commented 1 year ago

@WinterMute sorry, my bad. For me the issue was very much GDB. Any suggestion where I could share this then?

Would very much prefer if you kept it to yourself. The issue lies primarily with libogc's debug stub which requires updating for latest gdb.

WinterMute commented 1 year ago

@WinterMute : Can you please indicate where in the devkitPro org, the repository for gdb for Wii / Gamecube is generated / built from then? I haven't been able to locate this and thought that this was the source repo...

The gdb we supply for devkitPPC is built from vanilla sources. If we ever patch gdb then there will be a branch in this repository.

We would also very much appreciate it if people weren't encouraged to share and use inappropriate patches.

janmaartenbuis commented 1 year ago

@WinterMute As you wish. Just trying to be helpful.

digitall commented 1 year ago

@WinterMute : I understand that, but I think you have an issue with the powerpc-eabi-gdb shipped with r43 i.e. 20230501 release hence why I am doing this. That is v7.6.2 which I assume is to allow it to work correctly with the debugging stub for the Wii since that breaks for remote debugging after v7.7.1.

However, that version of GDB only understands DWARF v4 and lower. However, your updates to the GCC toolchain now mean that -g builds the library code with DWARF v5 by default, hence the gdb shipped can't load the debug symbols of any executable which has been linked against libogc etc. :|

The solution is for you to fix the library build scripts to pass "-gdwarf-4" and I will need to add the same to my application build scripts to work with GDB v7.6.2 ...

digitall commented 1 year ago

The other solution would be to update the toolchain to a newer GDB version... but as you have indicated that would need updates / changes to the Wii debugging stub code. I didn't spot this previously, but that is https://github.com/devkitPro/libogc/tree/master/libdb if I am correct?

WinterMute commented 1 year ago

The other solution would be to update the toolchain to a newer GDB version... but as you have indicated that would need updates / changes to the Wii debugging stub code. I didn't spot this previously, but that is https://github.com/devkitPro/libogc/tree/master/libdb if I am correct?

It is, yes. I found some time to look at it sorted the problem & updated gdb to 13.2 so it's all good now.

digitall commented 1 year ago

@WinterMute : Thank you very much for doing that. I can shelve the pending PRs I was making to add -gdwarf-4 in far too many places :) Can I check a couple of points:

  1. Did you test this with a real USB Gecko in a Wii to see if it connects to the target correctly?
  2. I looked at the GDB remote protocol implementation in https://github.com/devkitPro/libogc/blob/master/libdb/debug.c#L300. This is a bit sparse currently compared to https://sourceware.org/gdb/onlinedocs/gdb/General-Query-Packets.html. I did some testing myself with Dolphin's virtual USB Gecko and the older gdb-3.6.2 and this worked, but from the warning / errors emitted, I think that qSupported should be implemented as a minimum to avoid issues in future: https://sourceware.org/gdb/onlinedocs/gdb/General-Query-Packets.html#qSupported. If you are busy or I am adding a task, I can look at sending a PR for this myself if you are open to that?
WinterMute commented 1 year ago

@digitall Tested with real usb gecko on Wii & tcp/ip on cube. Logs attached on https://github.com/devkitPro/libogc/pull/154

Do feel free to PR qSupported packet support, would be much appreciated.

digitall commented 1 year ago

@WinterMute: Thanks. Will look at adding in qSupported if I can and any other packets. One further point, it isn't well documented that the GDB_NETWORK_TCP only works on the Gamecube with the Broad Band Adapter, though I suppose you could connect a BBA to the EXI ports on a Wii, but I haven't seen a cable / adaptor to do that.

Since the USB Gecko is practically impossible to get now (and I don't have one) and building a Shuriken is a problem since the XC9500 CPLD is also unobtainium, I was aiming to look at using GDB_NETWORK_TCP on the Wii. This was done once previously, but the code was not upstreamed to libogc and the links for the code patches are now all dead: https://wiibrew.org/wiki/User:Qiang0/Debugging#Debugging_Homebrew_apps_without_Gecko_USB

However, I assume this would entail using the IOS network API calls instead of the bba.h API. Any views on whether this would work and do you have a copy of that RAR file?