Created attachment 178528 [details]
This patch includes two upstream commits to add support for FreeBSD/mips user binaries as well as a new backend from my freebsd-7.12-kgdb branch that adds support for debugging FreeBSD/mips kernels to kgdb.
I've tested cross-debugging of process cores and kernel cores on amd64 as well as running a native gdb in qemu for user binaries.
There is still an open issue with gdb not recognizing mips64 core dumps. I have a pending patch in review to add a workaround to binutils, though the real bug is in the kernel.
I have done my testing from my git branch, and I have only build-tested the port update on amd64. I've cc'd Sean hoping he can use the qemu-user magic to build a gdb package for mips for testing?
I'm integrating your patch with other modifications that I was preparing to fix other stuff.
I'll prepare a new PR ASAP ready to be committed.
I'm preparing also the qemu magic to build for mips (atm I've only arm)
Is this patch for both mips32 and mips64?
(In reply to luca.pizzamiglio from comment #1)
It has been tested for both mips (o32) and mips64 (n64). It should build fine for n32 as well, but I can't get mipsn32 to work at all in qemu (/sbin/init fails). The ONLY_FOR_ARCH match in bsd.port.mk uses a very simple substring match, so just "mips" will match all of the mips architectures by my reading (and having "powerpc64" and "powerpc" is redundant as the check for "powerpc" will already match "powerpc64"). It might also be worth inverting the check to just be !aarch64 at this point (I think that's the only architecture not supported now?)
Please include a 'Sponsored by: DARPA / AFRL' line in the commit log for the MIPS bits of the actual commit to the port.
A commit references this bug:
Date: Thu Jan 12 21:40:06 UTC 2017
New revision: 431323
Add MIPS support and other fixes
- Main PR that merge all
Submitted by: email@example.com (maintainer)
- Add MIPS support
Submitted by: jhb
Sponsored by: DARPA / AFRL
- Fix build on powerpc architecture
Reported by: Mark Millard
- Add a workaround to mitigate gdb hangs under some circumstances
with multi-threaded applications
(thanks to firstname.lastname@example.org)
Reported by: tijl
- Fix build by removing option to use system readline
Reported by: email@example.com
Thanks for your improvement: I hope the Sponsored mention in the commit log suit you.