[cfarm-users] gcc230: Unable to use GDB on 64-bit mips executable

Pierre Muller pierre at freepascal.org
Tue Jun 17 10:16:43 CEST 2025


   Hi all,

I am currently trying to add support for 64-bit mips CPU to Free Pascal compiler.

One big issue I am faced with now is that I am unable to use the 32-bit compiled
GDB (latest release 16.3) to debug 64-bit mips executable.

I configured using:
muller at cfarm230:~/gnu/gdb/build-gdb-16.3-all$ ./config.status  --version
config.status
configured by ../gdb-16.3/configure, generated by GNU Autoconf 2.69,
   with options "'--with-python=/usr/bin/python3' '--enable-targets=all' '--enable-64-bit-bfd' '--disable-werror' '-with-python' 'CC=' 'CFLAGS= -gdwarf-2 -O0'"



I am typically getting this error.
Reading symbols from ./hello...
(No debugging symbols found in ./hello)
(gdb) run
Starting program: /home/muller/pas/check/hello
../../gdb-16.3/gdb/mips-tdep.c:797: internal-error: bad register size

The same happens for a simple C source compiled:

 >>>>>>>>>>>>>>>>>>>>>>>>
muller at cfarm230:~/pas/check$ cat simple-c-hello.c
#include <stdio.h>

int
main ()
{
   fprintf(stdout,"hello\n");
   return 0;
}
muller at cfarm230:~/pas/check$ gcc -mabi=64 -o simple-c-hello -g simple-c-hello.c
muller at cfarm230:~/pas/check$ ./simple-c-hello
hello
muller at cfarm230:~/pas/check$ gdb ./simple-c-hello
GNU gdb (GDB) 16.3
Copyright (C) 2024 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
Type "show copying" and "show warranty" for details.
This GDB was configured as "mips-unknown-linux-gnu".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<https://www.gnu.org/software/gdb/bugs/>.
Find the GDB manual and other documentation resources online at:
     <http://www.gnu.org/software/gdb/documentation/>.

For help, type "help".
Type "apropos word" to search for commands related to "word"...
Reading symbols from ./simple-c-hello...
(gdb) start
Temporary breakpoint 1 at 0xb20: file simple-c-hello.c, line 6.
Starting program: /home/muller/pas/check/simple-c-hello
../../gdb-16.3/gdb/mips-tdep.c:797: internal-error: bad register size
A problem internal to GDB has been detected,
further debugging may prove unreliable.
 >>>>>>>>>>>>>>>>>>>>>

(I also tested using gdbserver, but the internal-error also appears).

I tried to compile a 64-bit GDB executable, but there are missing dependencies
which are required to compile GDB:

  ../gdb-16.3/configure --host=mips64-unknown-linux-gnu CFLAGS="-gdwarf-4 -mabi=64" CXXFLAGS="-gdwarf-4 -mabi=64" LDFLAGS="-Wl,-m -Wl,elf64btsmip"

configure: error: Building GDB requires GMP 4.2+, and MPFR 3.1.0+.
Try the --with-gmp and/or --with-mpfr options to specify
their locations.  If you obtained GMP and/or MPFR from a vendor
distribution package, make sure that you have installed both the libraries
and the header files.  They may be located in separate packages.

Would it be possible to install a 64-bit version of the debugger if this is available as a package,
or otherwise to install 64-bit versions of gmp and mpfr (and possibly several other needed packages)?


Pierre





More information about the cfarm-users mailing list