gdb-6.1 おぼえがき補逸

以下はgdb/configureの10532行目からの引用.

host_makefile_frag=${srcdir}/config/${gdb_host_cpu}/${gdb_host}.mh
if test ! -f ${host_makefile_frag}; then
    # When building a native debuger the .mh file containing things
    # like NATDEPFILES is needed.  Cross debuggers don't need .mh
    # since it no longer contains anything useful.
    if test "${target}" = "${host}"; then
        { echo "configure: error: "*** Gdb does not support native target ${host}"" 1>&2; exit 1; }
    else
        host_makefile_frag=/dev/null
    fi
fi

ここで${srcdir}=gdb,${gdb_host_cpu}=sh4, ${gdb_host}=linuxということになっているらしい.したがって,ここの判定に成功するためには,gdb/config/sh4/linux.mhというファイルが存在しなければならない.

想像したとおり,gdb/config/shというディレクトリはあるが,gdb/config/sh4というディレクトリはない.まあ,これはlinkを張ってやればいいだけ.

問題は,

landisk# ls gdb/config/sh
embed.mt  nbsd.mh  nm-nbsd.h   tm-nbsd.h  tm-wince.h
linux.mt  nbsd.mt  tm-linux.h  tm-sh.h    wince.mt

…*.mhがnbsd.mhしかない.

ただ,この中身を見ると,

landisk# cat gdb/config/sh/nbsd.mh
# Host: SuperH running NetBSD
NAT_CLIBS=
NATDEPFILES= infptrace.o inftarg.o fork-child.o shnbsd-nat.o
NAT_FILE= nm-nbsd.h

というだけなので,gdbとsh4の両方についてちゃんと知っていればshnbsd-nat.c相当品(のlinux版)をでっちあげるだけでいけるばず.

…と,ここまで書いてふと思い立って「sh-linux-nat.c(mips-linux-nat.cからの類推)」でぐぐってみたら,やっぱり誰か書いたことがあって存在するらしい.それなのになぜgdb-6.1に含まれないんだろうと思っていたら,

... See the -nat file associated with your target. In this case it's sh-linux-nat.c, if I remember right - which isn't in the FSF GDB sources (was never contributed :().

…そういうことだったのか.oTZ