Bug 215868 - devel/gdb: as of -r429946 targeting powerpc64: ppcfbsd-kern.c:61:6: error: no matching function 'target_read_memory': no conversion from 'struct pcb *' to 'gdb_byte *'
Summary: devel/gdb: as of -r429946 targeting powerpc64: ppcfbsd-kern.c:61:6: error: no...
Status: Closed FIXED
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: powerpc Any
: --- Affects Only Me
Assignee: freebsd-ports-bugs (Nobody)
Depends on:
Reported: 2017-01-08 09:12 UTC by Mark Millard
Modified: 2017-01-13 20:02 UTC (History)
3 users (show)

See Also:
luca.pizzamiglio: maintainer-feedback+

Fixing the build on powerpc64 (505 bytes, patch)
2017-01-09 14:52 UTC, luca.pizzamiglio
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Mark Millard 2017-01-08 09:12:53 UTC
[I experiment with buildworld builkernel based on clang for powerpc64,
currently clang/clang++ 3.9.1. So this is a "system clang" context
despite the powerpc64 context.]

The build log details are:

. . .
c++ -pipe -B/usr/local/bin/ -DRL_NO_COMPAT -Wno-unused-function -Wno-unused-variable -Wno-extended-offsetof -DLIBICONV_PLUG -g -fno-strict-aliasing -B/usr/local/bin/  -DLIBICONV_PLUG   -I. -I. -I./com
mon -I./config -DLOCALEDIR="\"/usr/local/share/locale\"" -DHAVE_CONFIG_H -I./../include/opcode -I./../opcodes/..  -I./../zlib -I../bfd -I./../bfd -I./../include -I../libdecnumber -I./../libdecnumber  
-I./gnulib/import -Ibuild-gnulib/import   -DTUI=1  -B/usr/local/bin/ -DLIBICONV_PLUG -I/usr/local/include  -I/usr/local/include/python2.7 -I/usr/local/include/python2.7 -Wall -Wpointer-arith -Wno-unus
ed -Wno-switch -Wno-char-subscripts -Wempty-body -Wno-sign-compare -Wno-write-strings -Wno-narrowing -Wformat-nonliteral  -c -o ppcfbsd-kern.o -MT ppcfbsd-kern.o -MMD -MP -MF .deps/ppcfbsd-kern.Tpo ppcfbsd-kern.c
. . .
ppcfbsd-kern.c:61:6: error: no matching function for call to 'target_read_memory'
        if (target_read_memory(pcb_addr, &pcb, sizeof(pcb)) != 0)
./target/target.h:35:12: note: candidate function not viable: no known conversion from 'struct pcb *' to 'gdb_byte *' (aka 'unsigned char *') for 2nd argument
extern int target_read_memory (CORE_ADDR memaddr, gdb_byte *myaddr,
1 error generated.
gmake[4]: *** [Makefile:1158: ppcfbsd-kern.o] Error 1
gmake[4]: *** Waiting for unfinished jobs....
gmake[4]: Leaving directory '/usr/obj/portswork/usr/ports/devel/gdb/work/gdb-7.12/gdb'
Comment 1 luca.pizzamiglio 2017-01-09 14:52:56 UTC
Created attachment 178669 [details]
Fixing the build on powerpc64

Yes, gdb changed the signator of the function target_read_memory and now some kgdb support is broken.

This (easy) patch should fix the build and hopefully it doesn't introduce any regression.

Unfortunately I've no powerpc system available to build or test gdb.
Comment 2 John Baldwin freebsd_committer freebsd_triage 2017-01-09 16:13:47 UTC
The patch is correct.  The issue is that gdb 7.12 is now C++ instead of C so requires explicit casts.
Comment 3 commit-hook freebsd_committer 2017-01-12 21:40:26 UTC
A commit references this bug:

Author: olivier
Date: Thu Jan 12 21:40:07 UTC 2017
New revision: 431323
URL: https://svnweb.freebsd.org/changeset/ports/431323

  Add MIPS support and other fixes

  PR:		215938
  - Main PR that merge all
  Submitted by:   luca.pizzamiglio@gmail.com (maintainer)

  PR:		215783
  - Add MIPS support
  Submitted by:   jhb
  Sponsored by:   DARPA / AFRL

  PR:		215868
  - Fix build on powerpc architecture
  Reported by:    Mark Millard

  PR:		212607
  - Add a workaround to mitigate gdb hangs under some circumstances
  with multi-threaded applications
  (thanks to misc-freebsd-bugzilla@talk2dom.com)
  Reported by:    tijl

  PR:		215578
  - Fix build by removing option to use system readline
  Reported by:    rozhuk.im@gmail.com

Comment 4 Olivier Cochard freebsd_committer 2017-01-12 21:48:57 UTC
Thanks for your work.
Comment 5 Mark Millard 2017-01-13 05:24:32 UTC
(In reply to Olivier Cochard from comment #4)

[Note: my svnlite status shows nothing modified. . .

# svnlite status /usr/ports/


I tried updating from -r429946 to -431339 on for /usr/ports
and my amd64 context and devel/gdb failed:

===>>> All >> gdb-7.12 (26/28)

===>  Cleaning for gdb-7.12_1
===>  License GPLv3 accepted by the user
===>  Found saved configuration for gdb-7.11.1_1
===>   gdb-7.12_1 depends on file: /usr/local/sbin/pkg - found
===> Fetching all distfiles required by gdb-7.12_1 for building
===>  Extracting for gdb-7.12_1
=> SHA256 Checksum OK for gdb-7.12.tar.xz.
===>  Patching for gdb-7.12_1
===>  Applying extra patch /usr/ports/devel/gdb/files/commit-387360daf9
Ignoring previously applied (or reversed) patch.
2 out of 2 hunks ignored--saving rejects to gdb/Makefile.in.rej
Ignoring previously applied (or reversed) patch.
1 out of 1 hunks ignored--saving rejects to gdb/configure.tgt.rej
Ignoring previously applied (or reversed) patch.
1 out of 1 hunks ignored--saving rejects to gdb/doc/gdb.texinfo.rej
*** Error code 1

make[1]: stopped in /usr/ports/devel/gdb
*** Error code 1

make: stopped in /usr/ports/devel/gdb

===>>> make build failed for devel/gdb
===>>> Aborting update

===>>> Update for devel/gdb failed
===>>> Aborting update

# more /usr/obj/portswork/usr/ports/devel/gdb/work/gdb-7.12/gdb/Makefile.in.rej
@@ -685,6 +685,7 @@
        m88k-tdep.o \
        mep-tdep.o \
        microblaze-tdep.o microblaze-linux-tdep.o \
+       mips-fbsd-tdep.o \
        mips-linux-tdep.o mips-sde-tdep.o \
        mipsnbsd-tdep.o mips-tdep.o \
        mn10300-linux-tdep.o mn10300-tdep.o \
@@ -1724,6 +1725,7 @@
        m88k-tdep.c m88kbsd-nat.c \
        microblaze-tdep.c microblaze-linux-tdep.c \
        mingw-hdep.c common/mingw-strerror.c \
+       mips-fbsd-tdep.c \
        mips-linux-nat.c mips-linux-tdep.c \
        mips-sde-tdep.c \
        mips-tdep.c \

# more /usr/obj/portswork/usr/ports/devel/gdb/work/gdb-7.12/gdb/configure.tgt.rej
@@ -358,6 +358,11 @@
        gdb_target_obs="mips-tdep.o mipsnbsd-tdep.o solib-svr4.o nbsd-tdep.o"
+       # Target: MIPS running FreeBSD
+       gdb_target_obs="mips-tdep.o mips-fbsd-tdep.o solib-svr4.o fbsd-tdep.o"
+       gdb_sim=../sim/mips/libsim.a
+       ;;
        # Target: OpenBSD/mips64
        gdb_target_obs="mips-tdep.o mips64obsd-tdep.o obsd-tdep.o solib-svr4.o"

# more /usr/obj/portswork/usr/ports/devel/gdb/work/gdb-7.12/gdb/doc/gdb.texinfo.rej
@@ -541,6 +541,11 @@
 Michael Eager and staff of Xilinx, Inc., contributed support for the
 Xilinx MicroBlaze architecture.
+Initial support for the FreeBSD/mips target and native configuration
+was developed by SRI International and the University of Cambridge
+Computer Laboratory under DARPA/AFRL contract FA8750-10-C-0237
+("CTSRD"), as part of the DARPA CRASH research programme.
 @node Sample Session
 @chapter A Sample @value{GDBN} Session
Comment 6 Mark Millard 2017-01-13 20:02:28 UTC
(In reply to Mark Millard from comment #5)

Updating to -r431413 (to pick up -r431343) worked for building
devel/gdb on amd64.