Index | Thread | Search

From:
Mark Kettenis <mark.kettenis@xs4all.nl>
Subject:
Re: devel/gdb assorted fixes
To:
Jeremie Courreges-Anglas <jca@wxcvbn.org>
Cc:
pascal@stumpf.co, ports@openbsd.org, kernigh@gmail.com
Date:
Sat, 28 Dec 2024 15:53:52 +0100

Download raw body.

Thread
> Date: Fri, 27 Dec 2024 18:01:44 +0100
> From: Jeremie Courreges-Anglas <jca@wxcvbn.org>
> 
> I'm working on an update to gdb-15.2, but the changes below are
> already legit.
> 
> 0. add some missing files to ALLDEPFILES for consistency, update
>   comment
> 1. add ppc64-obsd-tdep.o to ALL_64_TARGET_OBS, so that it is built on
>   all architectures and not only on powerpc64.  This makes it possible
>   to read powerpc64 core files on other architectures.  However...
> 2. hooking up this file results in a runtime assertion because of a
>   conflict between powerpc and powerpc64 (see the patch for the error
>   message).  This error is probably already breaking gdb-13.2 runtime
>   on powerpc64 since Makefile rev 1.90 where I actually activated
>   --enable-targets=all.
> 3. drop patches/patch-gdb_doc_gdb_texinfo: it's not needed since we
>   patch the existing .info file, and it breaks with gdb-15.2 where the
>   build system tries to regenerate the .info
> 
> gkoehler & kettenis: if you could please check the current egdb
> runtime on powerpc64 (point 2 above), and whether the diff below fixes
> it.  ... are C++ exceptions still broken on that arch? :-/
> 
> ok?

Well, the current port doesn't even build on powerpc64 because of
undefined references.  Probably this is what point 1 is fixing.

I think exceptions are still broken.  At least gdb segfaults.

Anyway, I see no reason not to commit this.

> Index: patches/patch-gdb_Makefile_in
> ===================================================================
> RCS file: /cvs/ports/devel/gdb/patches/patch-gdb_Makefile_in,v
> diff -u -p -r1.6 patch-gdb_Makefile_in
> --- patches/patch-gdb_Makefile_in	9 Nov 2024 13:33:19 -0000	1.6
> +++ patches/patch-gdb_Makefile_in	26 Dec 2024 09:17:58 -0000
> @@ -1,11 +1,10 @@
> -
>  Add support for aarch64, powerpc64 and riscv64.
> -TODO Use OpenBSD-specific files for arm.
> +Add native support for arm.
>  
>  Index: gdb/Makefile.in
>  --- gdb/Makefile.in.orig
>  +++ gdb/Makefile.in
> -@@ -699,6 +699,7 @@ ALL_64_TARGET_OBS = \
> +@@ -726,6 +726,7 @@ ALL_64_TARGET_OBS = \
>   	aarch64-fbsd-tdep.o \
>   	aarch64-linux-tdep.o \
>   	aarch64-newlib-tdep.o \
> @@ -13,7 +12,11 @@ Index: gdb/Makefile.in
>   	aarch64-ravenscar-thread.o \
>   	aarch64-tdep.o \
>   	alpha-bsd-tdep.o \
> -@@ -737,6 +738,7 @@ ALL_64_TARGET_OBS = \
> +@@ -762,9 +763,11 @@ ALL_64_TARGET_OBS = \
> + 	mips-sde-tdep.o \
> + 	mips-tdep.o \
> + 	mips64-obsd-tdep.o \
> ++	ppc64-obsd-tdep.o \
>   	riscv-fbsd-tdep.o \
>   	riscv-linux-tdep.o \
>   	riscv-none-tdep.o \
> @@ -21,7 +24,7 @@ Index: gdb/Makefile.in
>   	riscv-ravenscar-thread.o \
>   	riscv-tdep.o \
>   	sparc64-fbsd-tdep.o \
> -@@ -1436,6 +1438,7 @@ HFILES_NO_SRCDIR = \
> +@@ -1477,6 +1480,7 @@ HFILES_NO_SRCDIR = \
>   	riscv-fbsd-tdep.h \
>   	riscv-ravenscar-thread.h \
>   	riscv-tdep.h \
> @@ -29,7 +32,7 @@ Index: gdb/Makefile.in
>   	rs6000-aix-tdep.h \
>   	run-on-main-thread.h \
>   	s390-linux-tdep.h \
> -@@ -1627,6 +1630,8 @@ ALLDEPFILES = \
> +@@ -1671,6 +1675,8 @@ ALLDEPFILES = \
>   	aarch64-linux-nat.c \
>   	aarch64-linux-tdep.c \
>   	aarch64-newlib-tdep.c \
> @@ -38,7 +41,24 @@ Index: gdb/Makefile.in
>   	aarch64-ravenscar-thread.c \
>   	aarch64-tdep.c \
>   	aix-thread.c \
> -@@ -1776,6 +1781,8 @@ ALLDEPFILES = \
> +@@ -1709,6 +1715,7 @@ ALLDEPFILES = \
> + 	arm-netbsd-nat.c \
> + 	arm-netbsd-tdep.c \
> + 	arm-none-tdep.c \
> ++	arm-obsd-nat.c \
> + 	arm-obsd-tdep.c \
> + 	arm-tdep.c \
> + 	avr-tdep.c \
> +@@ -1812,6 +1819,8 @@ ALLDEPFILES = \
> + 	ppc-ravenscar-thread.c \
> + 	ppc-sysv-tdep.c \
> + 	ppc64-tdep.c \
> ++	ppc64-obsd-nat.c \
> ++	ppc64-obsd-tdep.c \
> + 	procfs.c \
> + 	ravenscar-thread.c \
> + 	remote-sim.c \
> +@@ -1822,6 +1831,8 @@ ALLDEPFILES = \
>   	riscv-none-tdep.c \
>   	riscv-ravenscar-thread.c \
>   	riscv-tdep.c \
> Index: patches/patch-gdb_ppc-obsd-tdep_c
> ===================================================================
> RCS file: patches/patch-gdb_ppc-obsd-tdep_c
> diff -N patches/patch-gdb_ppc-obsd-tdep_c
> --- /dev/null	1 Jan 1970 00:00:00 -0000
> +++ patches/patch-gdb_ppc-obsd-tdep_c	26 Dec 2024 12:04:50 -0000
> @@ -0,0 +1,17 @@
> +Avoid clash with ppc64-obsd-tdep.c:
> +  /usr/ports/pobj/gdb-15.2/gdb-15.2/gdb/osabi.c:178: internal-error: gdbarch_register_osabi: A handler for OS ABI "OpenBSD" has already been registered for architecture powerpc:common64
> +  A problem internal to GDB has been detected,
> +  ...
> +
> +Index: gdb/ppc-obsd-tdep.c
> +--- gdb/ppc-obsd-tdep.c.orig
> ++++ gdb/ppc-obsd-tdep.c
> +@@ -268,7 +268,7 @@ _initialize_ppcobsd_tdep ()
> + {
> +   gdbarch_register_osabi (bfd_arch_rs6000, 0, GDB_OSABI_OPENBSD,
> + 			  ppcobsd_init_abi);
> +-  gdbarch_register_osabi (bfd_arch_powerpc, 0, GDB_OSABI_OPENBSD,
> ++  gdbarch_register_osabi (bfd_arch_powerpc, bfd_mach_ppc, GDB_OSABI_OPENBSD,
> + 			  ppcobsd_init_abi);
> + 
> +   /* Avoid initializing the register offsets again if they were
> Index: patches/patch-gdb_doc_gdb_texinfo
> ===================================================================
> RCS file: /cvs/ports/devel/gdb/patches/patch-gdb_doc_gdb_texinfo,v
> diff -u -p -r1.1 patch-gdb_doc_gdb_texinfo
> --- patches/patch-gdb_doc_gdb_texinfo	1 Oct 2024 07:41:42 -0000	1.1
> +++ patches/patch-gdb_doc_gdb_texinfo	26 Dec 2024 09:17:58 -0000
> @@ -1,12 +0,0 @@
> -Index: gdb/doc/gdb.texinfo
> ---- gdb/doc/gdb.texinfo.orig
> -+++ gdb/doc/gdb.texinfo
> -@@ -36,7 +36,7 @@
> - @set EDITION Tenth
> - 
> - @c !!set GDB edit command default editor
> --@set EDITOR /bin/ex
> -+@set EDITOR /usr/bin/ex
> - 
> - @c THIS MANUAL REQUIRES TEXINFO 4.0 OR LATER.
> - 
> 
> -- 
> jca
>