Garbage collect gnu/usr.bin/binutils/{gasp,gdb,gdbreplay}, as these have

not been connected to the build for more than 6 years.

Obtained from:	projects/binutils-2.17
This commit is contained in:
Dimitry Andric 2010-11-11 23:45:19 +00:00
parent dfbf73475a
commit cfe6b823a2
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=215151
26 changed files with 0 additions and 3330 deletions

View File

@ -1,21 +0,0 @@
# $FreeBSD$
.include "../Makefile.inc0"
.PATH: ${SRCDIR}/gas
PROG= gasp
SRCS+= gasp.c macro.c sb.c hash.c xregex.h
WARNS?= 2
CFLAGS+= -DBFD_ASSEMBLER
CFLAGS+= -I${.CURDIR}/../as/${TARGET_ARCH}-freebsd -I${.CURDIR}/../as
CFLAGS+= -I${.CURDIR}
CFLAGS+= -I${SRCDIR} -I${SRCDIR}/gas -I${SRCDIR}/gas/config
DPADD= ${RELTOP}/libiberty/libiberty.a
LDADD= ${DPADD}
CLEANFILES= xregex.h
xregex.h:
@echo '#include <regex.h>' >${.TARGET}
.include <bsd.prog.mk>

View File

@ -1,115 +0,0 @@
.\" Copyright (c) 1999
.\" The Regents of the University of California. All rights reserved.
.\" and David E. O'Brien
.\"
.\" Redistribution and use in source and binary forms, with or without
.\" modification, are permitted provided that the following conditions
.\" are met:
.\" 1. Redistributions of source code must retain the above copyright
.\" notice, this list of conditions and the following disclaimer.
.\" 2. Redistributions in binary form must reproduce the above copyright
.\" notice, this list of conditions and the following disclaimer in the
.\" documentation and/or other materials provided with the distribution.
.\" 3. Neither the name of the University nor the names of its contributors
.\" may be used to endorse or promote products derived from this software
.\" without specific prior written permission.
.\"
.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
.\" ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
.\" $FreeBSD$
.\"
.Dd December 29, 1999
.Dt GASP 1
.Os
.Sh NAME
.Nm gasp
.Nd the GNU Assembler Macro Preprocessor
.Sh SYNOPSIS
.Nm
.Op Fl adhMpsuv
.Op Fl c Ar char
.Op Fl o Ar outfile
.Op Fl D Ns Ar name=value
.Op Fl I Ns Ar path
.Op infile
.Sh DESCRIPTION
.Nm
is the GNU Assembler Macro Preprocessor.
The argument
.Ar infile
is processed and the resulting text is sent to the standard output.
.Pp
The options are as follows:
.Bl -tag -width "-Dname=value"
.It Fl a
Enter enter alternate macro mode.
Also specifiable as
.Op Fl \-alternate
.It Fl c Ar char
Change the comment character from `!'
Also specifiable as
.Op Fl \-commentchar\ char
.It Fl d
Print limited debugging information.
Also specifiable as
.Op Fl \-debug
.It Fl h
Print the help message.
Also specifiable as
.Op Fl \-help
.It Fl M
Enter MRI compatibility mode
Also specifiable as
.Op Fl \-mri
.It Fl o Ar outfile
Specify the output file.
Also specifiable as
.Op Fl \-output\ outfile
.It Fl p
Print line numbers.
Also specifiable as
.Op Fl \-print
.It Fl s
Copy source through as comments.
Also specifiable as
.Op Fl \-copysource
.It Fl u
Allow unreasonable nesting.
Also specifiable as
.Op Fl \-unreasonable
.It Fl v
Print the program version and exit.
Also specifiable as
.Op Fl \-version
.It Fl D Ns Ar name=value
Define the preprocessor symbol
.Ar name
to have the value specified by "value".
.It Fl I Ns Ar path
Add
.Ar path
to the include path list.
.El
.Sh SEE ALSO
.Xr cpp 1 ,
.Xr m4 1
.Rs
.%T The gasp GNU hypertext system info pages
.Re
.Sh HISTORY
The
.Nm
command is part of the GNU Binutils package.
.Sh AUTHORS
This man page was written by
.An David E. O'Brien .

View File

@ -1,139 +0,0 @@
# ex:ts=8
# $FreeBSD$
.include "../Makefile.inc0"
GDBDIR= ${.CURDIR}/../../../../contrib/gdb
.PATH: ${GDBDIR}/gdb ${GDBDIR}/gdb/cli ${GDBDIR}/gdb/mi
.PATH: ${SRCDIR}/opcodes ${SRCDIR}/binutils
# For FSF GDB files, use their CPU (arch) name; for our files use ours.
GDB_CPU=${TARGET_CPUARCH:C/amd64/i386/:C/powerpc.*/rs6000/:C/sparc64/sparc/}
NO_SHARED?=yes
PROG= gdb
XSRCS= annotate.c arch-utils.c ax-general.c ax-gdb.c bcache.c \
blockframe.c breakpoint.c buildsym.c complaints.c completer.c \
copying.c corefile.c corelow.c dcache.c doublest.c event-loop.c \
event-top.c environ.c eval.c exec.c expprint.c fork-child.c \
frame.c gdb-events.c gdbarch.c gdbtypes.c infcmd.c inflow.c \
infptrace.c inf-loop.c infrun.c inftarg.c language.c linespec.c \
main.c maint.c mdebugread.c mem-break.c memattr.c minsyms.c \
objfiles.c parse.c printcmd.c regcache.c remote.c \
remote-utils.c signals.c source.c stabsread.c stack.c symfile.c \
symmisc.c symtab.c target.c thread.c top.c tracepoint.c \
typeprint.c ui-file.c ui-out.c utils.c valarith.c valops.c \
varobj.c valprint.c values.c wrapper.c \
cli-cmds.c cli-cmds.h cli-decode.c cli-decode.h cli-out.c \
cli-script.c cli-script.h cli-setshow.c cli-setshow.h \
cli-utils.c cli-utils.h \
mi-cmd-break.c mi-cmd-disas.c mi-cmd-stack.c mi-cmd-var.c \
mi-cmds.c mi-console.c mi-getopt.c mi-main.c mi-out.c mi-parse.c\
serial.c ser-unix.c ser-tcp.c \
c-exp.y c-lang.c c-typeprint.c c-valprint.c \
ch-exp.c ch-lang.c ch-typeprint.c ch-valprint.c \
cp-abi.c gnu-v2-abi.c gnu-v3-abi.c cp-valprint.c demangle.c \
f-exp.y f-lang.c f-typeprint.c f-valprint.c findvar.c \
jv-exp.y jv-lang.c jv-valprint.c jv-typeprint.c nlmread.c \
m2-lang.c m2-exp.y m2-typeprint.c m2-valprint.c \
scm-exp.c scm-lang.c scm-valprint.c \
coffread.c dbxread.c dwarfread.c dwarf2read.c elfread.c \
solib.c solib-svr4.c solib-legacy.c
XSRCS+= freebsd-uthread.c kvm-fbsd.c kvm-fbsd-machine.h solib-fbsd-kld.c
SRCS= init.c ${XSRCS} nm.h tm.h xm.h gdbversion.c xregex.h
.include "${.CURDIR}/Makefile.${TARGET_ARCH}"
WARNS?= 0
.if ${TARGET_ARCH} != ${MACHINE_ARCH}
CFLAGS+= -DCROSS_COMPILE=1
.endif
CFLAGS+= -DDEFAULT_BFD_ARCH=bfd_${GDB_CPU}_arch
CFLAGS+= -I${.CURDIR}/${TARGET_CPUARCH}
CFLAGS+= -I${SRCDIR}/binutils -I${SRCDIR}/bfd
CFLAGS+= -I${GDBDIR}/gdb -I${GDBDIR}/gdb/config
CFLAGS+= -I$(.CURDIR)
YFLAGS=
DPADD= ${LIBKVM} ${LIBM}
DPADD+= ${RELTOP}/libbfd/libbfd.a ${RELTOP}/libopcodes/libopcodes.a
DPADD+= ${LIBGNUREGEX}
DPADD+= ${RELTOP}/libiberty/libiberty.a
DPADD+= ${LIBREADLINE} ${LIBTERMCAP}
LDADD= -lkvm -lm
LDADD+= ${RELTOP}/libbfd/libbfd.a ${RELTOP}/libopcodes/libopcodes.a
LDADD+= -lgnuregex
LDADD+= ${RELTOP}/libiberty/libiberty.a
LDADD+= -lreadline -ltermcap
CLEANFILES= init.c init.c-tmp nm.h tm.h xm.h gdbversion.c xregex.h kvm-fbsd-machine.h
# We do this by grepping through sources. If that turns out to be too slow,
# maybe we could just require every .o file to have an initialization routine
# of a given name (remote-udi.o -> _initialize_remote_udi, etc.).
#
# Formatting conventions: The name of the _initialize_* routines must start
# in column zero, and must not be inside #if.
#
# Note that the set of files with init functions might change, or the names
# of the functions might change, so this files needs to depend on all the
# object files that will be linked into gdb.
init.c: ${XSRCS}
@${ECHO} Making ${.TARGET}
@rm -f init.c-tmp
@echo '/* Do not modify this file. */' >init.c-tmp
@echo '/* It is created automatically by the Makefile. */'>>init.c-tmp
@echo '#include "defs.h"' >>init.c-tmp
@echo '#include "call-cmds.h"' >>init.c-tmp
@echo 'void initialize_all_files () {' >>init.c-tmp
@for i in ${.ALLSRC} ; do \
filename=`echo $$i | sed \
-e '/^Onindy.c/d' \
-e '/^nindy.c/d' \
-e '/ttyflush.c/d' \
-e '/xdr_ld.c/d' \
-e '/xdr_ptrace.c/d' \
-e '/xdr_rdb.c/d' \
-e '/udr.c/d' \
-e '/udip2soc.c/d' \
-e '/udi2go32.c/d' \
-e '/version.c/d' \
-e '/^[a-z0-9A-Z_]*_[SU].c/d' \
-e '/[a-z0-9A-Z_]*-exp.tab.c/d'` ; \
case $$filename in \
"") ;; \
*) sed <$$filename >>init.c-tmp -n \
-e '/^_initialize_[a-z_0-9A-Z]* *(/s/^\([a-z_0-9A-Z]*\).*/ {extern void \1 (); \1 ();}/p' ; ;; \
esac ; \
done
@echo '}' >>init.c-tmp
@mv init.c-tmp ${.TARGET}
.PRECIOUS: init.c
tm.h:
echo '#include "${GDB_CPU}/tm-fbsd.h"' > ${.TARGET}
.if exists(${.CURDIR}/fbsd-kgdb-${TARGET_CPUARCH}.h)
echo '#include "fbsd-kgdb-${TARGET_CPUARCH}.h"' >> ${.TARGET}
.endif
.for H in nm-fbsd xm-${GDB_CPU}
${H:C/-.*$//}.h:
ln -sf ${GDBDIR}/gdb/config/${GDB_CPU}/${H}.h ${.TARGET}
.endfor
kvm-fbsd-machine.h:
ln -sf ${.CURDIR}/kvm-fbsd-${TARGET_CPUARCH}.h ${.TARGET}
GDB_VERSION= "5.2.1 (FreeBSD)"
gdbversion.c: Makefile
@echo '#include "version.h"' > ${.TARGET}
@echo 'const char version[] = ${GDB_VERSION};' >>${.TARGET}
@echo 'const char host_name[] = "${MACHINE_ARCH}-undermydesk-freebsd";' >>${.TARGET}
@echo 'const char target_name[] = "${TARGET_ARCH}-undermydesk-freebsd";' >>${.TARGET}
xregex.h:
@echo '#include <gnu/regex.h>' >${.TARGET}
.include <bsd.prog.mk>

View File

@ -1,5 +0,0 @@
# $FreeBSD$
XSRCS+= armnbsd-nat.c armnbsd-tdep.c arm-tdep.c \
core-regset.c
CFLAGS+= -DDEFAULT_BFD_VEC=bfd_elf32_arm_vec

View File

@ -1,9 +0,0 @@
# $FreeBSD$
XSRCS+= i386fbsd-nat.c i386bsd-tdep.c i386bsd-nat.c i386-nat.c i386-tdep.c \
i387-nat.c i387-tdep.c \
core-regset.c core-aout.c
CFLAGS+= -Dprint_insn_i386=print_insn_i386_att
CFLAGS+= -DDEFAULT_BFD_VEC=bfd_elf32_i386_freebsd_vec
CFLAGS+= -DGDB_XM_FILE

View File

@ -1,5 +0,0 @@
# $FreeBSD$
XSRCS+= ia64-tdep.c ia64-fbsd-nat.c \
core-regset.c
CFLAGS+= -DDEFAULT_BFD_VEC=bfd_elf64_ia64_vec

View File

@ -1,5 +0,0 @@
# $FreeBSD$
XSRCS+= ppcnbsd-nat.c ppc-tdep.c \
core-regset.c
CFLAGS+= -DDEFAULT_BFD_VEC=bfd_elf32_powerpc_vec

View File

@ -1,5 +0,0 @@
# $FreeBSD$
XSRCS+= ppcnbsd-nat.c ppc-tdep.c \
core-regset.c
CFLAGS+= -DDEFAULT_BFD_VEC=bfd_elf64_powerpc_vec

View File

@ -1,4 +0,0 @@
# $FreeBSD$
XSRCS+= sparc-nat.c sparc-tdep.c
CFLAGS+= -DDEFAULT_BFD_VEC=bfd_elf64_sparc_vec

View File

@ -1,505 +0,0 @@
/* $FreeBSD$ */
/* config.h. Generated automatically by configure. */
/* config.in. Generated automatically from configure.in by autoheader. */
/* Define if on AIX 3.
System headers sometimes define this.
We just want to avoid a redefinition error message. */
#ifndef _ALL_SOURCE
/* #undef _ALL_SOURCE */
#endif
/* Define if using alloca.c. */
/* #undef C_ALLOCA */
/* Define to empty if the keyword does not work. */
/* #undef const */
/* Define to one of _getb67, GETB67, getb67 for Cray-2 and Cray-YMP systems.
This function is required for alloca.c support on those systems. */
/* #undef CRAY_STACKSEG_END */
/* Define if you have alloca, as a function or macro. */
#define HAVE_ALLOCA 1
/* Define if you have <alloca.h> and it should be used (not on Ultrix). */
/* #undef HAVE_ALLOCA_H */
/* Define if the `long double' type works. */
#define HAVE_LONG_DOUBLE 1
/* Define if you have a working `mmap' system call. */
#define HAVE_MMAP 1
/* Define if you have <vfork.h>. */
/* #undef HAVE_VFORK_H */
/* Define as __inline if that's what the C compiler calls it. */
/* #undef inline */
/* Define to `long' if <sys/types.h> doesn't define. */
/* #undef off_t */
/* Define to `int' if <sys/types.h> doesn't define. */
/* #undef pid_t */
/* Define as the return type of signal handlers (int or void). */
#define RETSIGTYPE void
/* Define if the `setpgrp' function takes no argument. */
/* #undef SETPGRP_VOID */
/* Define to `unsigned' if <sys/types.h> doesn't define. */
/* #undef size_t */
/* If using the C implementation of alloca, define if you know the
direction of stack growth for your system; otherwise it will be
automatically deduced at run-time.
STACK_DIRECTION > 0 => grows toward higher addresses
STACK_DIRECTION < 0 => grows toward lower addresses
STACK_DIRECTION = 0 => direction of growth unknown
*/
/* #undef STACK_DIRECTION */
/* Define if the `S_IS*' macros in <sys/stat.h> do not work properly. */
/* #undef STAT_MACROS_BROKEN */
/* Define if you have the ANSI C header files. */
#define STDC_HEADERS 1
/* Define vfork as fork if vfork does not work. */
/* #undef vfork */
/* Define if compiling on Solaris 7. */
/* #undef _MSE_INT_H */
/* Define if your struct reg has r_fs. */
#define HAVE_STRUCT_REG_R_FS 1
/* Define if your struct reg has r_gs. */
#define HAVE_STRUCT_REG_R_GS 1
/* Define if <link.h> exists and defines struct link_map which has
members with an ``l_'' prefix. (For Solaris, SVR4, and
SVR4-like systems.) */
#define HAVE_STRUCT_LINK_MAP_WITH_L_MEMBERS 1
/* Define if <link.h> exists and defines struct link_map which has
members with an ``lm_'' prefix. (For SunOS.) */
/* #undef HAVE_STRUCT_LINK_MAP_WITH_LM_MEMBERS */
/* Define if <link.h> exists and defines a struct so_map which has
members with an ``som_'' prefix. (Found on older *BSD systems.) */
/* #undef HAVE_STRUCT_SO_MAP_WITH_SOM_MEMBERS */
/* Define if <sys/link.h> has struct link_map32 */
/* #undef HAVE_STRUCT_LINK_MAP32 */
/* Define if the prfpregset_t type is broken. */
/* #undef PRFPREGSET_T_BROKEN */
/* Define if you want to use new multi-fd /proc interface
(replaces HAVE_MULTIPLE_PROC_FDS as well as other macros). */
/* #undef NEW_PROC_API */
/* Define if ioctl argument PIOCSET is available. */
/* #undef HAVE_PROCFS_PIOCSET */
/* Define if the `long long' type works. */
#define CC_HAS_LONG_LONG 1
/* Define if the "ll" format works to print long long ints. */
#define PRINTF_HAS_LONG_LONG 1
/* Define if the "%Lg" format works to print long doubles. */
#define PRINTF_HAS_LONG_DOUBLE 1
/* Define if the "%Lg" format works to scan long doubles. */
#define SCANF_HAS_LONG_DOUBLE 1
/* Define if using Solaris thread debugging. */
/* #undef HAVE_THREAD_DB_LIB */
/* Define on a GNU/Linux system to work around problems in sys/procfs.h. */
/* #undef START_INFERIOR_TRAPS_EXPECTED */
/* #undef sys_quotactl */
/* Define if you have HPUX threads */
/* #undef HAVE_HPUX_THREAD_SUPPORT */
/* Define if you want to use the memory mapped malloc package (mmalloc). */
/* #undef USE_MMALLOC */
/* Define if the runtime uses a routine from mmalloc before gdb has a chance
to initialize mmalloc, and we want to force checking to be used anyway.
This may cause spurious memory corruption messages if the runtime tries
to explicitly deallocate that memory when gdb calls exit. */
/* #undef MMCHECK_FORCE */
/* Define if <proc_service.h> on solaris uses int instead of
size_t, and assorted other type changes. */
/* #undef PROC_SERVICE_IS_OLD */
/* If you want to specify a default CPU variant, define this to be its
name, as a C string. */
/* #undef TARGET_CPU_DEFAULT */
/* Define if the simulator is being linked in. */
/* #undef WITH_SIM */
/* Set to true if the save_state_t structure is present */
/* #undef HAVE_STRUCT_SAVE_STATE_T */
/* Set to true if the save_state_t structure has the ss_wide member */
/* #undef HAVE_STRUCT_MEMBER_SS_WIDE */
/* Define if <sys/ptrace.h> defines the PTRACE_GETREGS request. */
/* #undef HAVE_PTRACE_GETREGS */
/* Define if <sys/ptrace.h> defines the PTRACE_GETFPXREGS request. */
/* #undef HAVE_PTRACE_GETFPXREGS */
/* Define if <sys/ptrace.h> defines the PT_GETDBREGS request. */
#define HAVE_PT_GETDBREGS 1
/* Define if <sys/ptrace.h> defines the PT_GETXMMREGS request. */
/* #undef HAVE_PT_GETXMMREGS */
/* Define if gnu-regex.c included with GDB should be used. */
#define USE_INCLUDED_REGEX 1
/* BFD's default architecture. */
/* #define DEFAULT_BFD_ARCH bfd_alpha_arch */
/* BFD's default target vector. */
/* #define DEFAULT_BFD_VEC bfd_elf64_alpha_vec */
/* Multi-arch enabled. */
/* #undef GDB_MULTI_ARCH */
/* hostfile */
/* #define GDB_XM_FILE 1 */
/* targetfile */
#define GDB_TM_FILE 1
/* nativefile */
#define GDB_NM_FILE 1
/* Define if you have the __argz_count function. */
/* #undef HAVE___ARGZ_COUNT */
/* Define if you have the __argz_next function. */
/* #undef HAVE___ARGZ_NEXT */
/* Define if you have the __argz_stringify function. */
/* #undef HAVE___ARGZ_STRINGIFY */
/* Define if you have the bcopy function. */
#define HAVE_BCOPY 1
/* Define if you have the btowc function. */
/* #undef HAVE_BTOWC */
/* Define if you have the bzero function. */
#define HAVE_BZERO 1
/* Define if you have the canonicalize_file_name function. */
/* #undef HAVE_CANONICALIZE_FILE_NAME */
/* Define if you have the dcgettext function. */
/* #undef HAVE_DCGETTEXT */
/* Define if you have the getcwd function. */
#define HAVE_GETCWD 1
/* Define if you have the getpagesize function. */
#define HAVE_GETPAGESIZE 1
/* Define if you have the isascii function. */
#define HAVE_ISASCII 1
/* Define if you have the munmap function. */
#define HAVE_MUNMAP 1
/* Define if you have the poll function. */
#define HAVE_POLL 1
/* Define if you have the putenv function. */
#define HAVE_PUTENV 1
/* Define if you have the realpath function. */
#define HAVE_REALPATH 1
/* Define if you have the sbrk function. */
#define HAVE_SBRK 1
/* Define if you have the setenv function. */
#define HAVE_SETENV 1
/* Define if you have the setlocale function. */
#define HAVE_SETLOCALE 1
/* Define if you have the setpgid function. */
#define HAVE_SETPGID 1
/* Define if you have the setpgrp function. */
#define HAVE_SETPGRP 1
/* Define if you have the sigaction function. */
#define HAVE_SIGACTION 1
/* Define if you have the sigprocmask function. */
#define HAVE_SIGPROCMASK 1
/* Define if you have the sigsetmask function. */
#define HAVE_SIGSETMASK 1
/* Define if you have the socketpair function. */
#define HAVE_SOCKETPAIR 1
/* Define if you have the stpcpy function. */
#define HAVE_STPCPY 1
/* Define if you have the strcasecmp function. */
#define HAVE_STRCASECMP 1
/* Define if you have the strchr function. */
#define HAVE_STRCHR 1
/* Define if you have the <argz.h> header file. */
/* #undef HAVE_ARGZ_H */
/* Define if you have the <asm/debugreg.h> header file. */
/* #undef HAVE_ASM_DEBUGREG_H */
/* Define if you have the <ctype.h> header file. */
#define HAVE_CTYPE_H 1
/* Define if you have the <curses.h> header file. */
#define HAVE_CURSES_H 1
/* Define if you have the <dirent.h> header file. */
#define HAVE_DIRENT_H 1
/* Define if you have the <limits.h> header file. */
#define HAVE_LIMITS_H 1
/* Define if you have the <link.h> header file. */
#define HAVE_LINK_H 1
/* Define if you have the <locale.h> header file. */
#define HAVE_LOCALE_H 1
/* Define if you have the <malloc.h> header file. */
/* #undef HAVE_MALLOC_H */
/* Define if you have the <memory.h> header file. */
#define HAVE_MEMORY_H 1
/* Define if you have the <ncurses.h> header file. */
#define HAVE_NCURSES_H 1
/* Define if you have the <ndir.h> header file. */
/* #undef HAVE_NDIR_H */
/* Define if you have the <nl_types.h> header file. */
#define HAVE_NL_TYPES_H 1
/* Define if you have the <nlist.h> header file. */
#define HAVE_NLIST_H 1
/* Define if you have the <objlist.h> header file. */
/* #undef HAVE_OBJLIST_H */
/* Define if you have the <poll.h> header file. */
#define HAVE_POLL_H 1
/* Define if you have the <proc_service.h> header file. */
/* #undef HAVE_PROC_SERVICE_H */
/* Define if you have the <ptrace.h> header file. */
/* #undef HAVE_PTRACE_H */
/* Define if you have the <sgtty.h> header file. */
#define HAVE_SGTTY_H 1
/* Define if you have the <stddef.h> header file. */
#define HAVE_STDDEF_H 1
/* Define if you have the <stdint.h> header file. */
#define HAVE_STDINT_H 1
/* Define if you have the <stdlib.h> header file. */
#define HAVE_STDLIB_H 1
/* Define if you have the <string.h> header file. */
#define HAVE_STRING_H 1
/* Define if you have the <sys/debugreg.h> header file. */
/* #undef HAVE_SYS_DEBUGREG_H */
/* Define if you have the <sys/dir.h> header file. */
/* #undef HAVE_SYS_DIR_H */
/* Define if you have the <sys/fault.h> header file. */
/* #undef HAVE_SYS_FAULT_H */
/* Define if you have the <sys/file.h> header file. */
#define HAVE_SYS_FILE_H 1
/* Define if you have the <sys/filio.h> header file. */
#define HAVE_SYS_FILIO_H 1
/* Define if you have the <sys/ioctl.h> header file. */
#define HAVE_SYS_IOCTL_H 1
/* Define if you have the <sys/ndir.h> header file. */
/* #undef HAVE_SYS_NDIR_H */
/* Define if you have the <sys/param.h> header file. */
#define HAVE_SYS_PARAM_H 1
/* Define if you have the <sys/poll.h> header file. */
#define HAVE_SYS_POLL_H 1
/* Define if you have the <sys/procfs.h> header file. */
#define HAVE_SYS_PROCFS_H 1
/* Define if you have the <sys/ptrace.h> header file. */
#define HAVE_SYS_PTRACE_H 1
/* Define if you have the <sys/reg.h> header file. */
/* #undef HAVE_SYS_REG_H */
/* Define if you have the <sys/select.h> header file. */
#define HAVE_SYS_SELECT_H 1
/* Define if you have the <sys/syscall.h> header file. */
#define HAVE_SYS_SYSCALL_H 1
/* Define if you have the <sys/user.h> header file. */
#define HAVE_SYS_USER_H 1
/* Define if you have the <sys/wait.h> header file. */
#define HAVE_SYS_WAIT_H 1
/* Define if you have the <term.h> header file. */
#define HAVE_TERM_H 1
/* Define if you have the <termio.h> header file. */
/* #undef HAVE_TERMIO_H */
/* Define if you have the <termios.h> header file. */
#define HAVE_TERMIOS_H 1
/* Define if you have the <thread_db.h> header file. */
/* #undef HAVE_THREAD_DB_H */
/* Define if you have the <time.h> header file. */
#define HAVE_TIME_H 1
/* Define if you have the <unistd.h> header file. */
#define HAVE_UNISTD_H 1
/* Define if you have the <values.h> header file. */
/* #undef HAVE_VALUES_H */
/* Define if you have the <wait.h> header file. */
/* #undef HAVE_WAIT_H */
/* Define if you have the <wchar.h> header file. */
#define HAVE_WCHAR_H 1
/* Define if you have the <wctype.h> header file. */
#define HAVE_WCTYPE_H 1
/* Define if you have the dl library (-ldl). */
/* #undef HAVE_LIBDL */
/* Define if you have the m library (-lm). */
#define HAVE_LIBM 1
/* Define if you have the socket library (-lsocket). */
/* #undef HAVE_LIBSOCKET */
/* Define if you have the w library (-lw). */
/* #undef HAVE_LIBW */
/* Define if you have the stpcpy function */
#define HAVE_STPCPY 1
/* Define if your locale.h file contains LC_MESSAGES. */
#define HAVE_LC_MESSAGES 1
/* Define to 1 if NLS is requested */
/* #define ENABLE_NLS 1 */
/* Define as 1 if you have gettext and don't want to use GNU gettext. */
/* #undef HAVE_GETTEXT */
/* Define if sigsetjmp is available. */
#define HAVE_SIGSETJMP 1
/* Define if malloc is not declared in system header files. */
/* #undef NEED_DECLARATION_MALLOC */
/* Define if realloc is not declared in system header files. */
/* #undef NEED_DECLARATION_REALLOC */
/* Define if free is not declared in system header files. */
/* #undef NEED_DECLARATION_FREE */
/* Define if strerror is not declared in system header files. */
/* #undef NEED_DECLARATION_STRERROR */
/* Define if strdup is not declared in system header files. */
/* #undef NEED_DECLARATION_STRDUP */
/* Define if strstr is not declared in system header files. */
/* #undef NEED_DECLARATION_STRSTR */
/* Define if <sys/procfs.h> has pstatus_t. */
/* #undef HAVE_PSTATUS_T */
/* Define if <sys/procfs.h> has prrun_t. */
/* #undef HAVE_PRRUN_T */
/* Define if <sys/procfs.h> has gregset_t. */
#ifndef CROSS_COMPILE
#define HAVE_GREGSET_T 1
#endif
/* Define if <sys/procfs.h> has fpregset_t. */
#define HAVE_FPREGSET_T 1
/* Define if <sys/procfs.h> has prgregset_t. */
/* #undef HAVE_PRGREGSET_T */
/* Define if <sys/procfs.h> has prfpregset_t. */
#define HAVE_PRFPREGSET_T 1
/* Define if <sys/procfs.h> has prgregset32_t. */
/* #undef HAVE_PRGREGSET32_T */
/* Define if <sys/procfs.h> has prfpregset32_t. */
/* #undef HAVE_PRFPREGSET32_T */
/* Define if <sys/procfs.h> has lwpid_t. */
/* #undef HAVE_LWPID_T */
/* Define if <sys/procfs.h> has psaddr_t. */
/* #undef HAVE_PSADDR_T */
/* Define if <sys/procfs.h> has prsysent_t. */
/* #undef HAVE_PRSYSENT_T */
/* Define if <sys/procfs.h> has pr_sigset_t. */
/* #undef HAVE_PR_SIGSET_T */
/* Define if <sys/procfs.h> has pr_sigaction64_t. */
/* #undef HAVE_PR_SIGACTION64_T */
/* Define if <sys/procfs.h> has pr_siginfo64_t. */
/* #undef HAVE_PR_SIGINFO64_T */

View File

@ -1,14 +0,0 @@
/* $FreeBSD$ */
#ifndef FBSD_KGDB_ALPHA_H
#define FBSD_KGDB_ALPHA_H
#include "alpha/tm-fbsd.h"
#include "fbsd-kgdb.h"
#undef FRAME_SAVED_PC
#define FRAME_SAVED_PC(FRAME) \
(kernel_debugging ? fbsd_kern_frame_saved_pc(FRAME) : \
alpha_saved_pc_after_call(FRAME))
#endif /* FBSD_KGDB_ALPHA_H */

View File

@ -1,8 +0,0 @@
/* $FreeBSD$ */
#ifndef FBSD_KGDB_AMD64_H
#define FBSD_KGDB_AMD64_H
#include "fbsd-kgdb.h"
#endif /* FBSD_KGDB_AMD64_H */

View File

@ -1,8 +0,0 @@
/* $FreeBSD$ */
#ifndef FBSD_KGDB_ARM_H
#define FBSD_KGDB_ARM_H
#include "fbsd-kgdb.h"
#endif /* FBSD_KGDB_ARM_H */

View File

@ -1,21 +0,0 @@
/* $FreeBSD$ */
#ifndef FBSD_KGDB_I386_H
#define FBSD_KGDB_I386_H
#include "i386/tm-fbsd.h"
#include "fbsd-kgdb.h"
/* Override FRAME_SAVED_PC to enable the recognition of signal handlers. */
#undef FRAME_SAVED_PC
#define FRAME_SAVED_PC(FRAME) \
(kernel_debugging \
? fbsd_kern_frame_saved_pc (FRAME) \
: i386bsd_frame_saved_pc (FRAME))
extern CORE_ADDR fbsd_kern_frame_saved_pc(struct frame_info *fr);
/* Offset to saved PC in sigcontext, from <sys/signal.h>. */
/* DEO:XXX where is this really from??? */
#define SIGCONTEXT_PC_OFFSET 20
#endif /* FBSD_KGDB_I386_H */

View File

@ -1,8 +0,0 @@
/* $FreeBSD$ */
#ifndef FBSD_KGDB_IA64_H
#define FBSD_KGDB_IA64_H
#include "fbsd-kgdb.h"
#endif /* FBSD_KGDB_IA64_H */

View File

@ -1,8 +0,0 @@
/* $FreeBSD$ */
#ifndef FBSD_KGDB_POWERPC_H
#define FBSD_KGDB_POWERPC_H
#include "fbsd-kgdb.h"
#endif /* FBSD_KGDB_POWERPC_H */

View File

@ -1,9 +0,0 @@
/* $FreeBSD$ */
#ifndef FBSD_KGDB_SPARC64_H
#define FBSD_KGDB_SPARC64_H
#include "sparc/tm-fbsd.h"
#include "fbsd-kgdb.h"
#endif /* FBSD_KGDB_SPARC64_H */

View File

@ -1,34 +0,0 @@
/* Native-kernel debugging definitions for FreeBSD.
* $FreeBSD$
*/
#ifndef FBSD_KGDB_H
#define FBSD_KGDB_H
extern int kernel_debugging;
extern int kernel_writablecore;
extern struct target_so_ops kgdb_so_ops;
#define ADDITIONAL_OPTIONS \
{"kernel", no_argument, &kernel_debugging, 1}, \
{"k", no_argument, &kernel_debugging, 1}, \
{"wcore", no_argument, &kernel_writablecore, 1}, \
{"w", no_argument, &kernel_writablecore, 1},
#define ADDITIONAL_OPTION_HELP \
"\
--kernel Enable kernel debugging.\n\
--wcore Make core file writable (only works for /dev/mem).\n\
This option only works while debugging a kernel !!\n\
"
#define DEFAULT_PROMPT kernel_debugging?"(kgdb) ":"(gdb) "
/* misuse START_PROGRESS to test whether we're running as kgdb */
/* START_PROGRESS is called at the top of main */
#undef START_PROGRESS
#define START_PROGRESS(STR,N) \
if (!strcmp (STR, "kgdb")) \
kernel_debugging = 1;
#endif /* FBSD_KGDB_H */

View File

@ -1,889 +0,0 @@
/* Low level interface for debugging FreeBSD user threads for GDB, the GNU debugger.
Copyright 1996, 1999 Free Software Foundation, Inc.
This file is part of GDB.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
/* $FreeBSD$ */
/* This module implements a sort of half target that sits between the
machine-independent parts of GDB and the ptrace interface (infptrace.c) to
provide access to the FreeBSD user-mode thread implementation.
FreeBSD threads are true user-mode threads, which are invoked via
the pthread_* interfaces. These are mostly implemented in
user-space, with all thread context kept in various structures that
live in the user's heap. For the most part, the kernel has no
knowlege of these threads.
Based largely on hpux-thread.c
*/
#include "defs.h"
#include <sys/queue.h>
#include <signal.h>
#include <setjmp.h>
#include "gdbthread.h"
#include "target.h"
#include "inferior.h"
#include <fcntl.h>
#include <ucontext.h>
#include <unistd.h>
#include <sys/stat.h>
#include "gdbcore.h"
extern int child_suppress_run;
extern struct target_ops child_ops; /* target vector for inftarg.c */
extern void _initialize_freebsd_uthread PARAMS ((void));
/* Set to true while we are part-way through attaching */
static int freebsd_uthread_attaching;
static int freebsd_uthread_active = 0;
static CORE_ADDR P_thread_list;
static CORE_ADDR P_thread_run;
/* Pointer to the next function on the objfile event chain. */
static void (*target_new_objfile_chain) (struct objfile *objfile);
static void freebsd_uthread_resume PARAMS ((ptid_t pid, int step,
enum target_signal signo));
static void init_freebsd_uthread_ops PARAMS ((void));
static struct target_ops freebsd_uthread_ops;
static ptid_t find_active_ptid PARAMS ((void));
struct cached_pthread {
u_int64_t uniqueid;
int state;
CORE_ADDR name;
union {
ucontext_t uc;
jmp_buf jb;
} ctx;
};
static ptid_t cached_ptid;
static struct cached_pthread cached_pthread;
static CORE_ADDR cached_pthread_addr;
LIST_HEAD(idmaplist, idmap);
struct idmap {
LIST_ENTRY(idmap) link;
u_int64_t uniqueid;
int tid;
};
#define MAPHASH_SIZE 257
#define TID_MIN 1
#define TID_MAX 16383
static int tid_to_hash[TID_MAX + 1]; /* set to map_hash index */
static struct idmaplist map_hash[MAPHASH_SIZE];
static int next_free_tid = TID_MIN; /* first available tid */
static int last_free_tid = TID_MIN; /* first unavailable */
static CORE_ADDR P_thread_next_offset;
static CORE_ADDR P_thread_uniqueid_offset;
static CORE_ADDR P_thread_state_offset;
static CORE_ADDR P_thread_name_offset;
static CORE_ADDR P_thread_ctx_offset;
static CORE_ADDR P_thread_PS_RUNNING_value;
static CORE_ADDR P_thread_PS_DEAD_value;
static int next_offset;
static int uniqueid_offset;
static int state_offset;
static int name_offset;
static int ctx_offset;
static int PS_RUNNING_value;
static int PS_DEAD_value;
#define UNIQUEID_HASH(id) (id % MAPHASH_SIZE)
#define TID_ADD1(tid) (((tid) + 1) == TID_MAX + 1 \
? TID_MIN : (tid) + 1)
#define IS_TID_FREE(tid) (tid_to_hash[tid] == -1)
static int
get_new_tid(int h)
{
int tid = next_free_tid;
tid_to_hash[tid] = h;
next_free_tid = TID_ADD1(next_free_tid);
if (next_free_tid == last_free_tid)
{
int i;
for (i = last_free_tid; TID_ADD1(i) != last_free_tid; i = TID_ADD1(i))
if (IS_TID_FREE(i))
break;
if (TID_ADD1(i) == last_free_tid)
{
error("too many threads");
return 0;
}
next_free_tid = i;
for (i = TID_ADD1(i); IS_TID_FREE(i); i = TID_ADD1(i))
;
last_free_tid = i;
}
return tid;
}
static ptid_t
find_ptid(u_int64_t uniqueid)
{
int h = UNIQUEID_HASH(uniqueid);
struct idmap *im;
LIST_FOREACH(im, &map_hash[h], link)
if (im->uniqueid == uniqueid)
return MERGEPID(PIDGET(inferior_ptid), im->tid);
im = xmalloc(sizeof(struct idmap));
im->uniqueid = uniqueid;
im->tid = get_new_tid(h);
LIST_INSERT_HEAD(&map_hash[h], im, link);
return MERGEPID(PIDGET(inferior_ptid), im->tid);
}
static void
free_ptid(ptid_t ptid)
{
int tid = TIDGET(ptid);
int h = tid_to_hash[tid];
struct idmap *im;
if (!tid) return;
LIST_FOREACH(im, &map_hash[h], link)
if (im->tid == tid)
break;
if (!im) return;
LIST_REMOVE(im, link);
tid_to_hash[tid] = -1;
free(im);
}
#define READ_OFFSET(field) read_memory(P_thread_##field##_offset, \
(char *) &field##_offset, \
sizeof(field##_offset))
#define READ_VALUE(name) read_memory(P_thread_##name##_value, \
(char *) &name##_value, \
sizeof(name##_value))
static void
read_thread_offsets (void)
{
READ_OFFSET(next);
READ_OFFSET(uniqueid);
READ_OFFSET(state);
READ_OFFSET(name);
READ_OFFSET(ctx);
READ_VALUE(PS_RUNNING);
READ_VALUE(PS_DEAD);
}
#define READ_FIELD(ptr, T, field, result) \
read_memory ((ptr) + field##_offset, (char *) &(result), sizeof result)
static u_int64_t
read_pthread_uniqueid (CORE_ADDR ptr)
{
u_int64_t uniqueid;
READ_FIELD(ptr, u_int64_t, uniqueid, uniqueid);
return uniqueid;
}
static CORE_ADDR
read_pthread_next (CORE_ADDR ptr)
{
CORE_ADDR next;
READ_FIELD(ptr, CORE_ADDR, next, next);
return next;
}
static void
read_cached_pthread (CORE_ADDR ptr, struct cached_pthread *cache)
{
READ_FIELD(ptr, u_int64_t, uniqueid, cache->uniqueid);
READ_FIELD(ptr, int, state, cache->state);
READ_FIELD(ptr, CORE_ADDR, name, cache->name);
READ_FIELD(ptr, ucontext_t, ctx, cache->ctx);
}
static ptid_t
find_active_ptid (void)
{
CORE_ADDR ptr;
read_memory ((CORE_ADDR)P_thread_run,
(char *)&ptr,
sizeof ptr);
return find_ptid(read_pthread_uniqueid(ptr));
}
static CORE_ADDR find_pthread_addr PARAMS ((ptid_t ptid));
static struct cached_pthread * find_pthread PARAMS ((ptid_t ptid));
static CORE_ADDR
find_pthread_addr (ptid_t ptid)
{
CORE_ADDR ptr;
if (ptid_equal(ptid, cached_ptid))
return cached_pthread_addr;
read_memory ((CORE_ADDR)P_thread_list,
(char *)&ptr,
sizeof ptr);
while (ptr != 0)
{
if (ptid_equal(find_ptid(read_pthread_uniqueid(ptr)), ptid))
{
cached_ptid = ptid;
cached_pthread_addr = ptr;
read_cached_pthread(ptr, &cached_pthread);
return ptr;
}
ptr = read_pthread_next(ptr);
}
return NULL;
}
static struct cached_pthread *
find_pthread (ptid_t ptid)
{
CORE_ADDR ptr;
if (ptid_equal(ptid, cached_ptid))
return &cached_pthread;
read_memory ((CORE_ADDR)P_thread_list,
(char *)&ptr,
sizeof ptr);
while (ptr != 0)
{
if (ptid_equal(find_ptid(read_pthread_uniqueid(ptr)), ptid))
{
cached_ptid = ptid;
cached_pthread_addr = ptr;
read_cached_pthread(ptr, &cached_pthread);
return &cached_pthread;
}
ptr = read_pthread_next(ptr);
}
#if 0
error ("Can't find pthread %d,%d", PIDGET(ptid), TIDGET(ptid));
#endif
return NULL;
}
/* Most target vector functions from here on actually just pass through to
inftarg.c, as they don't need to do anything specific for threads. */
/* ARGSUSED */
static void
freebsd_uthread_open (char *arg, int from_tty)
{
child_ops.to_open (arg, from_tty);
}
/* Attach to process PID, then initialize for debugging it
and wait for the trace-trap that results from attaching. */
static void
freebsd_uthread_attach (char *args, int from_tty)
{
child_ops.to_attach (args, from_tty);
push_target (&freebsd_uthread_ops);
freebsd_uthread_attaching = 1;
}
/* After an attach, see if the target is threaded */
static void
freebsd_uthread_post_attach (int pid)
{
if (freebsd_uthread_active)
{
read_thread_offsets ();
inferior_ptid = find_active_ptid ();
add_thread (inferior_ptid);
}
else
{
unpush_target (&freebsd_uthread_ops);
push_target (&child_ops);
}
freebsd_uthread_attaching = 0;
}
/* Take a program previously attached to and detaches it.
The program resumes execution and will no longer stop
on signals, etc. We'd better not have left any breakpoints
in the program or it'll die when it hits one. For this
to work, it may be necessary for the process to have been
previously attached. It *might* work if the program was
started via the normal ptrace (PTRACE_TRACEME). */
static void
freebsd_uthread_detach (char *args, int from_tty)
{
child_ops.to_detach (args, from_tty);
}
/* Resume execution of process PID. If STEP is nozero, then
just single step it. If SIGNAL is nonzero, restart it with that
signal activated. We may have to convert pid from a thread-id to an LWP id
for procfs. */
static void
freebsd_uthread_resume (ptid_t ptid, int step, enum target_signal signo)
{
if (freebsd_uthread_attaching)
{
child_ops.to_resume (ptid, step, signo);
return;
}
child_ops.to_resume (ptid, step, signo);
cached_ptid = MERGEPID(0, 0);
}
/* Wait for any threads to stop. We may have to convert PID from a thread id
to a LWP id, and vice versa on the way out. */
static ptid_t
freebsd_uthread_wait (ptid_t ptid, struct target_waitstatus *ourstatus)
{
ptid_t rtnval;
if (freebsd_uthread_attaching)
{
return child_ops.to_wait (ptid, ourstatus);
}
rtnval = child_ops.to_wait (ptid, ourstatus);
if (PIDGET(rtnval) >= 0)
{
rtnval = find_active_ptid ();
if (!in_thread_list (rtnval))
add_thread (rtnval);
}
return rtnval;
}
/* XXX: this needs to be selected by target, not [build] host */
#ifdef __i386__
static char jmpmap[MAX_NUM_REGS] = /* map reg to jmp_buf */
{
6, /* eax */
-1, /* ecx */
-1, /* edx */
1, /* ebx */
2, /* esp */
3, /* ebp */
4, /* esi */
5, /* edi */
0, /* eip */
-1, /* eflags */
-1, /* cs */
-1, /* ss */
-1, /* ds */
-1, /* es */
-1, /* fs */
-1, /* gs */
-1, -1, -1, -1, -1, -1, -1, /* st0-st7 */
-1, -1, -1, -1, -1, -1, -1, /* fctrl-fop */
-1, -1, -1, -1, -1, -1, -1, /* xmm0-xmm7 */
-1, /* mxcsr */
};
#endif
#ifdef __alpha__
static char jmpmap[NUM_REGS] = {
4, 5, 6, 7, 8, 9, 10, 11, /* v0 - t6 */
12, 13, 14, 15, 16, 17, 18, 19, /* t7 - fp */
20, 21, 22, 23, 24, 25, 26, 27, /* a0 - t9 */
28, 29, 30, 31, 32, 33, 34, 35, /* t10 - zero */
37, 38, 39, 40, 41, 42, 43, 44, /* f0 - f7 */
45, 46, 47, 48, 49, 50, 51, 52, /* f8 - f15 */
53, 54, 55, 56, 57, 58, 59, 60, /* f16 - f23 */
61, 62, 63, 64, 65, 66, 67, 68, /* f24 - f31 */
2, -1, /* pc, vfp */
};
#endif
#ifdef __sparc64__
static char jmpmap[125] = {
-1
};
#endif
static void
freebsd_uthread_fetch_registers (int regno)
{
struct cached_pthread *thread;
int active;
int first_regno, last_regno;
register_t *regbase;
char *regmap;
if (freebsd_uthread_attaching || TIDGET(inferior_ptid) == 0)
{
child_ops.to_fetch_registers (regno);
return;
}
thread = find_pthread (inferior_ptid);
active = (ptid_equal(inferior_ptid, find_active_ptid()));
if (active)
{
child_ops.to_fetch_registers (regno);
return;
}
if (regno == -1)
{
first_regno = 0;
last_regno = NUM_REGS - 1;
}
else
{
first_regno = regno;
last_regno = regno;
}
regbase = (register_t*) &thread->ctx.jb[0];
regmap = jmpmap;
for (regno = first_regno; regno <= last_regno; regno++)
{
if (regmap[regno] == -1)
child_ops.to_fetch_registers (regno);
else
if (thread)
supply_register (regno, (char*) &regbase[regmap[regno]]);
else
supply_register (regno, NULL);
}
}
static void
freebsd_uthread_store_registers (int regno)
{
struct cached_pthread *thread;
CORE_ADDR ptr;
int first_regno, last_regno;
u_int32_t *regbase;
char *regmap;
if (freebsd_uthread_attaching)
{
child_ops.to_store_registers (regno);
return;
}
thread = find_pthread (inferior_ptid);
if (thread->state == PS_RUNNING_value)
{
child_ops.to_store_registers (regno);
return;
}
if (regno == -1)
{
first_regno = 0;
last_regno = NUM_REGS - 1;
}
else
{
first_regno = regno;
last_regno = regno;
}
regbase = (u_int32_t*) &thread->ctx.jb[0];
regmap = jmpmap;
ptr = find_pthread_addr (inferior_ptid);
for (regno = first_regno; regno <= last_regno; regno++)
{
if (regmap[regno] == -1)
child_ops.to_store_registers (regno);
else
{
u_int32_t *reg = &regbase[regmap[regno]];
int off;
/* Hang onto cached value */
memcpy(reg, registers + REGISTER_BYTE (regno),
REGISTER_RAW_SIZE (regno));
/* And push out to inferior */
off = (char *) reg - (char *) thread;
write_memory (ptr + off,
registers + REGISTER_BYTE (regno),
REGISTER_RAW_SIZE (regno));
}
}
}
/* Get ready to modify the registers array. On machines which store
individual registers, this doesn't need to do anything. On machines
which store all the registers in one fell swoop, this makes sure
that registers contains all the registers from the program being
debugged. */
static void
freebsd_uthread_prepare_to_store (void)
{
child_ops.to_prepare_to_store ();
}
static int
freebsd_uthread_xfer_memory (CORE_ADDR memaddr, char *myaddr, int len,
int dowrite, struct mem_attrib *attrib,
struct target_ops *target)
{
return child_ops.to_xfer_memory (memaddr, myaddr, len, dowrite,
attrib, target);
}
/* Print status information about what we're accessing. */
static void
freebsd_uthread_files_info (struct target_ops *ignore)
{
child_ops.to_files_info (ignore);
}
static void
freebsd_uthread_kill_inferior (void)
{
child_ops.to_kill ();
}
static void
freebsd_uthread_notice_signals (ptid_t ptid)
{
child_ops.to_notice_signals (ptid);
}
/* Fork an inferior process, and start debugging it with /proc. */
static void
freebsd_uthread_create_inferior (char *exec_file, char *allargs, char **env)
{
child_ops.to_create_inferior (exec_file, allargs, env);
if (PIDGET(inferior_ptid) && freebsd_uthread_active)
{
read_thread_offsets ();
push_target (&freebsd_uthread_ops);
inferior_ptid = find_active_ptid ();
add_thread (inferior_ptid);
}
}
/* This routine is called to find out if the inferior is using threads.
We check for the _thread_run and _thread_list globals. */
void
freebsd_uthread_new_objfile (struct objfile *objfile)
{
struct minimal_symbol *ms;
if (!objfile)
{
freebsd_uthread_active = 0;
return;
}
ms = lookup_minimal_symbol ("_thread_run", NULL, objfile);
if (!ms)
return;
P_thread_run = SYMBOL_VALUE_ADDRESS (ms);
ms = lookup_minimal_symbol ("_thread_list", NULL, objfile);
if (!ms)
return;
P_thread_list = SYMBOL_VALUE_ADDRESS (ms);
#define OFFSET_SYM(field) "_thread_" #field "_offset"
#define LOOKUP_OFFSET(field) \
do { \
ms = lookup_minimal_symbol (OFFSET_SYM(field), NULL, objfile); \
if (!ms) \
return; \
P_thread_##field##_offset = SYMBOL_VALUE_ADDRESS (ms); \
} while (0);
#define VALUE_SYM(name) "_thread_" #name "_value"
#define LOOKUP_VALUE(name) \
do { \
ms = lookup_minimal_symbol (VALUE_SYM(name), NULL, objfile); \
if (!ms) \
return; \
P_thread_##name##_value = SYMBOL_VALUE_ADDRESS (ms); \
} while (0);
LOOKUP_OFFSET(next);
LOOKUP_OFFSET(uniqueid);
LOOKUP_OFFSET(state);
LOOKUP_OFFSET(name);
LOOKUP_OFFSET(ctx);
LOOKUP_VALUE(PS_RUNNING);
LOOKUP_VALUE(PS_DEAD);
freebsd_uthread_active = 1;
}
/* Clean up after the inferior dies. */
static void
freebsd_uthread_mourn_inferior ()
{
child_ops.to_mourn_inferior ();
unpush_target (&freebsd_uthread_ops);
}
/* Mark our target-struct as eligible for stray "run" and "attach" commands. */
static int
freebsd_uthread_can_run ()
{
return child_suppress_run;
}
static int
freebsd_uthread_thread_alive (ptid_t ptid)
{
struct cached_pthread *thread;
int ret = 0;
if (freebsd_uthread_attaching)
return 1;
/*
* We can get called from child_ops.to_wait() which passes the underlying
* pid (without a thread number).
*/
if (TIDGET(ptid) == 0)
return 1;
if (find_pthread_addr (ptid) != 0)
{
thread = find_pthread (ptid);
ret = (thread->state != PS_DEAD_value);
}
if (!ret)
free_ptid(ptid);
return ret;
}
static void
freebsd_uthread_stop (void)
{
child_ops.to_stop ();
}
static void
freebsd_uthread_find_new_threads (void)
{
CORE_ADDR ptr;
int state;
u_int64_t uniqueid;
read_memory ((CORE_ADDR)P_thread_list,
(char *)&ptr,
sizeof ptr);
while (ptr != 0)
{
READ_FIELD(ptr, int, state, state);
READ_FIELD(ptr, u_int64_t, uniqueid, uniqueid);
if (state != PS_DEAD_value &&
!in_thread_list (find_ptid(uniqueid)))
add_thread (find_ptid(uniqueid));
ptr = read_pthread_next(ptr);
}
}
/* MUST MATCH enum pthread_state */
static const char *statenames[] = {
"RUNNING",
"SIGTHREAD",
"MUTEX_WAIT",
"COND_WAIT",
"FDLR_WAIT",
"FDLW_WAIT",
"FDR_WAIT",
"FDW_WAIT",
"POLL_WAIT",
"FILE_WAIT",
"SELECT_WAIT",
"SLEEP_WAIT",
"WAIT_WAIT",
"SIGSUSPEND",
"SIGWAIT",
"SPINBLOCK",
"JOIN",
"SUSPENDED",
"DEAD",
"DEADLOCK",
};
#if 0
static int
freebsd_uthread_get_thread_info (ref, selection, info)
gdb_threadref *ref;
int selection;
struct gdb_ext_thread_info *info;
{
int pid = *ref;
struct cached_pthread *thread = find_pthread (pid);
struct cleanup *old_chain;
old_chain = save_inferior_pid ();
inferior_pid = main_pid;
memset(&info->threadid, 0, OPAQUETHREADBYTES);
memcpy(&info->threadid, ref, sizeof *ref);
info->active = thread->state == PS_RUNNING_value;
strcpy(info->display, statenames[thread->state]);
if (thread->name)
read_memory ((CORE_ADDR) thread->name, info->shortname, 32);
else
strcpy(info->shortname, "");
do_cleanups (old_chain);
return (0);
}
#endif
char *
freebsd_uthread_pid_to_str (ptid_t ptid)
{
static char buf[30];
if (STREQ (current_target.to_shortname, "freebsd-uthreads"))
sprintf (buf, "Process %d, Thread %ld",
PIDGET(ptid), TIDGET(ptid));
else
sprintf (buf, "Process %d", PIDGET(ptid));
return buf;
}
static void
init_freebsd_uthread_ops ()
{
freebsd_uthread_ops.to_shortname = "freebsd-uthreads";
freebsd_uthread_ops.to_longname = "FreeBSD uthreads";
freebsd_uthread_ops.to_doc = "FreeBSD user threads support.";
freebsd_uthread_ops.to_open = freebsd_uthread_open;
freebsd_uthread_ops.to_attach = freebsd_uthread_attach;
freebsd_uthread_ops.to_post_attach = freebsd_uthread_post_attach;
freebsd_uthread_ops.to_detach = freebsd_uthread_detach;
freebsd_uthread_ops.to_resume = freebsd_uthread_resume;
freebsd_uthread_ops.to_wait = freebsd_uthread_wait;
freebsd_uthread_ops.to_fetch_registers = freebsd_uthread_fetch_registers;
freebsd_uthread_ops.to_store_registers = freebsd_uthread_store_registers;
freebsd_uthread_ops.to_prepare_to_store = freebsd_uthread_prepare_to_store;
freebsd_uthread_ops.to_xfer_memory = freebsd_uthread_xfer_memory;
freebsd_uthread_ops.to_files_info = freebsd_uthread_files_info;
freebsd_uthread_ops.to_insert_breakpoint = memory_insert_breakpoint;
freebsd_uthread_ops.to_remove_breakpoint = memory_remove_breakpoint;
freebsd_uthread_ops.to_terminal_init = terminal_init_inferior;
freebsd_uthread_ops.to_terminal_inferior = terminal_inferior;
freebsd_uthread_ops.to_terminal_ours_for_output = terminal_ours_for_output;
freebsd_uthread_ops.to_terminal_ours = terminal_ours;
freebsd_uthread_ops.to_terminal_info = child_terminal_info;
freebsd_uthread_ops.to_kill = freebsd_uthread_kill_inferior;
freebsd_uthread_ops.to_create_inferior = freebsd_uthread_create_inferior;
freebsd_uthread_ops.to_mourn_inferior = freebsd_uthread_mourn_inferior;
freebsd_uthread_ops.to_can_run = freebsd_uthread_can_run;
freebsd_uthread_ops.to_notice_signals = freebsd_uthread_notice_signals;
freebsd_uthread_ops.to_thread_alive = freebsd_uthread_thread_alive;
freebsd_uthread_ops.to_stop = freebsd_uthread_stop;
freebsd_uthread_ops.to_stratum = process_stratum;
freebsd_uthread_ops.to_has_all_memory = 1;
freebsd_uthread_ops.to_has_memory = 1;
freebsd_uthread_ops.to_has_stack = 1;
freebsd_uthread_ops.to_has_registers = 1;
freebsd_uthread_ops.to_has_execution = 1;
freebsd_uthread_ops.to_has_thread_control = 0;
freebsd_uthread_ops.to_magic = OPS_MAGIC;
freebsd_uthread_ops.to_find_new_threads = freebsd_uthread_find_new_threads;
freebsd_uthread_ops.to_pid_to_str = freebsd_uthread_pid_to_str;
#if 0
freebsd_uthread_vec.get_thread_info = freebsd_uthread_get_thread_info;
#endif
}
void
_initialize_freebsd_uthread ()
{
init_freebsd_uthread_ops ();
add_target (&freebsd_uthread_ops);
target_new_objfile_chain = target_new_objfile_hook;
target_new_objfile_hook = freebsd_uthread_new_objfile;
child_suppress_run = 1;
}

View File

@ -1,385 +0,0 @@
.\" Copyright (c) 1991 Free Software Foundation
.\" See section COPYING for conditions for redistribution
.\" $FreeBSD$
.TH gdb 1 "4nov1991" "GNU Tools" "GNU Tools"
.SH NAME
gdb \- The GNU Debugger
.SH SYNOPSIS
.na
.TP
.B gdb
.RB "[\|" \-help "\|]"
.RB "[\|" \-nx "\|]"
.RB "[\|" \-q "\|]"
.RB "[\|" \-batch "\|]"
.RB "[\|" \-cd=\c
.I dir\c
\|]
.RB "[\|" \-f "\|]"
.RB "[\|" \-k "\|]"
.RB "[\|" \-wcore "\|]"
.RB "[\|" "\-b\ "\c
.IR bps "\|]"
.RB "[\|" "\-tty="\c
.IR dev "\|]"
.RB "[\|" "\-s "\c
.I symfile\c
\&\|]
.RB "[\|" "\-e "\c
.I prog\c
\&\|]
.RB "[\|" "\-se "\c
.I prog\c
\&\|]
.RB "[\|" "\-c "\c
.I core\c
\&\|]
.RB "[\|" "\-x "\c
.I cmds\c
\&\|]
.RB "[\|" "\-d "\c
.I dir\c
\&\|]
.RB "[\|" \c
.I prog\c
.RB "[\|" \c
.IR core \||\| procID\c
\&\|]\&\|]
.ad b
.SH DESCRIPTION
The purpose of a debugger such as GDB is to allow you to see what is
going on ``inside'' another program while it executes\(em\&or what another
program was doing at the moment it crashed.
GDB can do four main kinds of things (plus other things in support of
these) to help you catch bugs in the act:
.TP
\ \ \ \(bu
Start your program, specifying anything that might affect its behavior.
.TP
\ \ \ \(bu
Make your program stop on specified conditions.
.TP
\ \ \ \(bu
Examine what has happened, when your program has stopped.
.TP
\ \ \ \(bu
Change things in your program, so you can experiment with correcting the
effects of one bug and go on to learn about another.
.PP
You can use GDB to debug programs written in C, C++, and Modula-2.
Fortran support will be added when a GNU Fortran compiler is ready.
GDB is invoked with the shell command \c
.B gdb\c
\&. Once started, it reads
commands from the terminal until you tell it to exit with the GDB
command \c
.B quit\c
\&. You can get online help from \c
.B gdb\c
\& itself
by using the command \c
.B help\c
\&.
You can run \c
.B gdb\c
\& with no arguments or options; but the most
usual way to start GDB is with one argument or two, specifying an
executable program as the argument:
.sp
.br
gdb\ program
.br
.sp
You can also start with both an executable program and a core file specified:
.sp
.br
gdb\ program\ core
.br
.sp
You can, instead, specify a process ID as a second argument, if you want
to debug a running process:
.sp
.br
gdb\ program\ 1234
.br
.sp
would attach GDB to process \c
.B 1234\c
\& (unless you also have a file
named `\|\c
.B 1234\c
\&\|'; GDB does check for a core file first).
Here are some of the most frequently needed GDB commands:
.TP
.B break \fR[\|\fIfile\fB:\fR\|]\fIfunction
\&
Set a breakpoint at \c
.I function\c
\& (in \c
.I file\c
\&).
.TP
.B run \fR[\|\fIarglist\fR\|]
Start your program (with \c
.I arglist\c
\&, if specified).
.TP
.B bt
Backtrace: display the program stack.
.TP
.BI print " expr"\c
\&
Display the value of an expression.
.TP
.B c
Continue running your program (after stopping, e.g. at a breakpoint).
.TP
.B next
Execute next program line (after stopping); step \c
.I over\c
\& any
function calls in the line.
.TP
.B step
Execute next program line (after stopping); step \c
.I into\c
\& any
function calls in the line.
.TP
.B help \fR[\|\fIname\fR\|]
Show information about GDB command \c
.I name\c
\&, or general information
about using GDB.
.TP
.B quit
Exit from GDB.
.PP
For full details on GDB, see \c
.I
Using GDB: A Guide to the GNU Source-Level Debugger\c
\&, by Richard M. Stallman and Roland H. Pesch. The same text is available online
as the \c
.B gdb\c
\& entry in the \c
.B info\c
\& program.
.SH OPTIONS
Any arguments other than options specify an executable
file and core file (or process ID); that is, the first argument
encountered with no
associated option flag is equivalent to a `\|\c
.B \-se\c
\&\|' option, and the
second, if any, is equivalent to a `\|\c
.B \-c\c
\&\|' option if it's the name of a file. Many options have
both long and short forms; both are shown here. The long forms are also
recognized if you truncate them, so long as enough of the option is
present to be unambiguous. (If you prefer, you can flag option
arguments with `\|\c
.B +\c
\&\|' rather than `\|\c
.B \-\c
\&\|', though we illustrate the
more usual convention.)
All the options and command line arguments you give are processed
in sequential order. The order makes a difference when the
`\|\c
.B \-x\c
\&\|' option is used.
.TP
.B \-help
.TP
.B \-h
List all options, with brief explanations.
.TP
.BI "\-symbols=" "file"\c
.TP
.BI "\-s " "file"\c
\&
Read symbol table from file \c
.I file\c
\&.
.TP
.BI "\-exec=" "file"\c
.TP
.BI "\-e " "file"\c
\&
Use file \c
.I file\c
\& as the executable file to execute when
appropriate, and for examining pure data in conjunction with a core
dump.
.TP
.BI "\-se=" "file"\c
\&
Read symbol table from file \c
.I file\c
\& and use it as the executable
file.
.TP
.BI "\-core=" "file"\c
.TP
.BI "\-c " "file"\c
\&
Use file \c
.I file\c
\& as a core dump to examine.
.TP
.BI "\-command=" "file"\c
.TP
.BI "\-x " "file"\c
\&
Execute GDB commands from file \c
.I file\c
\&.
.TP
.BI "\-directory=" "directory"\c
.TP
.BI "\-d " "directory"\c
\&
Add \c
.I directory\c
\& to the path to search for source files.
.PP
.TP
.B \-nx
.TP
.B \-n
Do not execute commands from any `\|\c
.B .gdbinit\c
\&\|' initialization files.
Normally, the commands in these files are executed after all the
command options and arguments have been processed.
.TP
.B \-quiet
.TP
.B \-q
``Quiet''. Do not print the introductory and copyright messages. These
messages are also suppressed in batch mode.
.TP
.B \-batch
Run in batch mode. Exit with status \c
.B 0\c
\& after processing all the command
files specified with `\|\c
.B \-x\c
\&\|' (and `\|\c
.B .gdbinit\c
\&\|', if not inhibited).
Exit with nonzero status if an error occurs in executing the GDB
commands in the command files.
Batch mode may be useful for running GDB as a filter, for example to
download and run a program on another computer; in order to make this
more useful, the message
.sp
.br
Program\ exited\ normally.
.br
.sp
(which is ordinarily issued whenever a program running under GDB control
terminates) is not issued when running in batch mode.
.TP
.BI "\-cd=" "directory"\c
\&
Run GDB using \c
.I directory\c
\& as its working directory,
instead of the current directory.
.TP
.B \-fullname
.TP
.B \-f
Emacs sets this option when it runs GDB as a subprocess. It tells GDB
to output the full file name and line number in a standard,
recognizable fashion each time a stack frame is displayed (which
includes each time the program stops). This recognizable format looks
like two `\|\c
.B \032\c
\&\|' characters, followed by the file name, line number
and character position separated by colons, and a newline. The
Emacs-to-GDB interface program uses the two `\|\c
.B \032\c
\&\|' characters as
a signal to display the source code for the frame.
.TP
.B \-kernel
.TP
.B \-k
Use gdb in kernel debugging mode. The prompt is set to ``(kgdb)''.
.TP
.B \-wcore
This option may only be used in kernel debugging mode while
debugging a ``live'' kernel and makes the corefile (/dev/mem)
writable.
.TP
.BI "\-b " "bps"\c
\&
Set the line speed (baud rate or bits per second) of any serial
interface used by GDB for remote debugging.
.TP
.BI "\-tty=" "device"\c
\&
Run using \c
.I device\c
\& for your program's standard input and output.
.PP
.SH "SEE ALSO"
.RB "`\|" gdb "\|'"
entry in
.B info\c
\&;
.I
Using GDB: A Guide to the GNU Source-Level Debugger\c
, Richard M. Stallman and Roland H. Pesch, July 1991.
.SH COPYING
Copyright (c) 1991 Free Software Foundation, Inc.
.PP
Permission is granted to make and distribute verbatim copies of
this manual provided the copyright notice and this permission notice
are preserved on all copies.
.PP
Permission is granted to copy and distribute modified versions of this
manual under the conditions for verbatim copying, provided that the
entire resulting derived work is distributed under the terms of a
permission notice identical to this one.
.PP
Permission is granted to copy and distribute translations of this
manual into another language, under the above conditions for modified
versions, except that this permission notice may be included in
translations approved by the Free Software Foundation instead of in
the original English.

View File

@ -1,77 +0,0 @@
/* Kernel core dump functions below target vector, for GDB on FreeBSD/Alpha.
Copyright 1986, 1987, 1989, 1991, 1992, 1993, 1994, 1995
Free Software Foundation, Inc.
This file is part of GDB.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
__FBSDID("$FreeBSD$");
#include "alpha/tm-alpha.h"
#ifndef S0_REGNUM
#define S0_REGNUM (T7_REGNUM+1)
#endif
static void
fetch_kcore_registers (struct pcb *pcbp)
{
/* First clear out any garbage. */
memset (registers, '\0', REGISTER_BYTES);
/* SP */
*(long *) &registers[REGISTER_BYTE (SP_REGNUM)] =
pcbp->pcb_hw.apcb_ksp;
/* S0 through S6 */
memcpy (&registers[REGISTER_BYTE (S0_REGNUM)],
&pcbp->pcb_context[0], 7 * sizeof (long));
/* PC */
*(long *) &registers[REGISTER_BYTE (PC_REGNUM)] =
pcbp->pcb_context[7];
registers_fetched ();
}
CORE_ADDR
fbsd_kern_frame_saved_pc (struct frame_info *fi)
{
struct minimal_symbol *sym;
CORE_ADDR this_saved_pc;
this_saved_pc = alpha_frame_saved_pc (fi);
sym = lookup_minimal_symbol_by_pc (this_saved_pc);
if (sym != NULL &&
(strcmp (SYMBOL_NAME (sym), "XentArith") == 0 ||
strcmp (SYMBOL_NAME (sym), "XentIF") == 0 ||
strcmp (SYMBOL_NAME (sym), "XentInt") == 0 ||
strcmp (SYMBOL_NAME (sym), "XentMM") == 0 ||
strcmp (SYMBOL_NAME (sym), "XentSys") == 0 ||
strcmp (SYMBOL_NAME (sym), "XentUna") == 0 ||
strcmp (SYMBOL_NAME (sym), "XentRestart") == 0))
{
return (read_memory_integer (fi->frame + 32 * 8, 8));
}
else
{
return (this_saved_pc);
}
}

View File

@ -1,131 +0,0 @@
/* Kernel core dump functions below target vector, for GDB on FreeBSD/i386.
Copyright 1986, 1987, 1989, 1991, 1992, 1993, 1994, 1995
Free Software Foundation, Inc.
This file is part of GDB.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
__FBSDID("$FreeBSD$");
#include <machine/frame.h>
static CORE_ADDR
ksym_maxuseraddr (void)
{
static CORE_ADDR maxuseraddr;
struct minimal_symbol *sym;
if (maxuseraddr == 0)
{
sym = lookup_minimal_symbol ("PTmap", NULL, NULL);
if (sym == NULL) {
maxuseraddr = VM_MAXUSER_ADDRESS;
} else {
maxuseraddr = SYMBOL_VALUE_ADDRESS (sym);
}
}
return maxuseraddr;
}
/* Symbol names of kernel entry points. Use special frames. */
#define KSYM_TRAP "calltrap"
#define KSYM_INTR "Xintr"
#define KSYM_FASTINTR "Xfastintr"
#define KSYM_OLDSYSCALL "Xlcall_syscall"
#define KSYM_SYSCALL "Xint0x80_syscall"
/* The following is FreeBSD-specific hackery to decode special frames
and elide the assembly-language stub. This could be made faster by
defining a frame_type field in the machine-dependent frame information,
but we don't think that's too important right now. */
enum frametype { tf_normal, tf_trap, tf_interrupt, tf_syscall };
CORE_ADDR
fbsd_kern_frame_saved_pc (struct frame_info *fi)
{
struct minimal_symbol *sym;
CORE_ADDR this_saved_pc;
enum frametype frametype;
this_saved_pc = read_memory_integer (fi->frame + 4, 4);
sym = lookup_minimal_symbol_by_pc (this_saved_pc);
frametype = tf_normal;
if (sym != NULL)
{
if (strcmp (SYMBOL_NAME (sym), KSYM_TRAP) == 0)
frametype = tf_trap;
else
if (strncmp (SYMBOL_NAME (sym), KSYM_INTR,
strlen (KSYM_INTR)) == 0 || strncmp (SYMBOL_NAME(sym),
KSYM_FASTINTR, strlen (KSYM_FASTINTR)) == 0)
frametype = tf_interrupt;
else
if (strcmp (SYMBOL_NAME (sym), KSYM_SYSCALL) == 0 ||
strcmp (SYMBOL_NAME (sym), KSYM_OLDSYSCALL) == 0)
frametype = tf_syscall;
}
switch (frametype)
{
case tf_normal:
return (this_saved_pc);
#define oEIP offsetof (struct trapframe, tf_eip)
case tf_trap:
return (read_memory_integer (fi->frame + 8 + oEIP, 4));
case tf_interrupt:
return (read_memory_integer (fi->frame + 12 + oEIP, 4));
case tf_syscall:
return (read_memory_integer (fi->frame + 8 + oEIP, 4));
#undef oEIP
}
}
static void
fetch_kcore_registers (struct pcb *pcb)
{
int i;
int noreg;
/* Get the register values out of the sys pcb and store them where
`read_register' will find them. */
/*
* XXX many registers aren't available.
* XXX for the non-core case, the registers are stale - they are for
* the last context switch to the debugger.
* XXX gcc's register numbers aren't all #defined in tm-i386.h.
*/
noreg = 0;
for (i = 0; i < 3; ++i) /* eax,ecx,edx */
supply_register (i, (char *)&noreg);
supply_register (3, (char *) &pcb->pcb_ebx);
supply_register (SP_REGNUM, (char *) &pcb->pcb_esp);
supply_register (FP_REGNUM, (char *) &pcb->pcb_ebp);
supply_register (6, (char *) &pcb->pcb_esi);
supply_register (7, (char *) &pcb->pcb_edi);
supply_register (PC_REGNUM, (char *) &pcb->pcb_eip);
for (i = 9; i < 14; ++i) /* eflags, cs, ss, ds, es, fs */
supply_register (i, (char *) &noreg);
supply_register (15, (char *) &pcb->pcb_gs);
/* XXX 80387 registers? */
}

View File

@ -1,96 +0,0 @@
/* Kernel core dump functions below target vector, for GDB on FreeBSD/sparc64.
Copyright 1986, 1987, 1989, 1991, 1992, 1993, 1994, 1995
Free Software Foundation, Inc.
This file is part of GDB.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
__FBSDID("$FreeBSD$");
#define SPARC_INTREG_SIZE 8
static void
fetch_kcore_registers (struct pcb *pcbp)
{
static struct frame top;
CORE_ADDR f_addr;
int i;
/* Get the register values out of the sys pcb and store them where
`read_register' will find them. */
/*
* XXX many registers aren't available.
* XXX for the non-core case, the registers are stale - they are for
* the last context switch to the debugger.
* XXX do something with the floating-point registers?
*/
supply_register (SP_REGNUM, (char *)&pcbp->pcb_ufp);
supply_register (PC_REGNUM, (char *)&pcbp->pcb_pc);
f_addr = extract_address (&pcbp->pcb_ufp, SPARC_INTREG_SIZE);
/* Load the previous frame by hand (XXX) and supply it. */
read_memory (f_addr + SPOFF, (char *)&top, sizeof (top));
for (i = 0; i < 8; i++)
supply_register (i + L0_REGNUM, (char *)&top.fr_local[i]);
for (i = 0; i < 8; i++)
supply_register (i + I0_REGNUM, (char *)&top.fr_in[i]);
}
CORE_ADDR
fbsd_kern_frame_saved_pc (struct frame_info *fi)
{
struct minimal_symbol *sym;
CORE_ADDR frame, pc_addr, pc;
char *buf;
buf = alloca (MAX_REGISTER_RAW_SIZE);
/* XXX: duplicates fi->extra_info->bottom. */
frame = (fi->next != NULL) ? fi->next->frame : read_sp ();
pc_addr = frame + offsetof (struct frame, fr_in[7]);
#define READ_PC(pc, a, b) do { \
read_memory (a, b, SPARC_INTREG_SIZE); \
pc = extract_address (b, SPARC_INTREG_SIZE); \
} while (0)
READ_PC (pc, pc_addr, buf);
sym = lookup_minimal_symbol_by_pc (pc);
if (sym != NULL)
{
if (strncmp (SYMBOL_NAME (sym), "tl0_", 4) == 0 ||
strcmp (SYMBOL_NAME (sym), "btext") == 0 ||
strcmp (SYMBOL_NAME (sym), "mp_startup") == 0 ||
strcmp (SYMBOL_NAME (sym), "fork_trampoline") == 0)
{
/*
* Ugly kluge: user space addresses aren't separated from kernel
* ones by range; if encountering a trap from user space, just
* return a 0 to stop the trace.
* Do the same for entry points of kernel processes to avoid
* printing garbage.
*/
pc = 0;
}
if (strncmp (SYMBOL_NAME (sym), "tl1_", 4) == 0)
{
pc_addr = fi->frame + sizeof (struct frame) +
offsetof (struct trapframe, tf_tpc);
READ_PC (pc, pc_addr, buf);
}
}
return (pc);
}

View File

@ -1,502 +0,0 @@
/* Kernel core dump functions below target vector, for GDB.
Copyright 1986, 1987, 1989, 1991, 1992, 1993, 1994, 1995
Free Software Foundation, Inc.
This file is part of GDB.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#include <sys/cdefs.h>
__FBSDID("$FreeBSD$");
/*
* This works like "remote" but, you use it like this:
* target kcore /dev/mem
* or
* target kcore /var/crash/host/core.0
*
* This way makes it easy to short-circut the whole bfd monster,
* and direct the inferior stuff to our libkvm implementation.
*
*/
#include <sys/param.h>
#include <sys/user.h>
#include <ctype.h>
#include <fcntl.h>
#include <kvm.h>
#include <sys/sysctl.h>
#include <paths.h>
#include "defs.h"
#include <readline/tilde.h>
#include "gdb_string.h"
#include "frame.h" /* required by inferior.h */
#include "inferior.h"
#include "symfile.h"
#include "objfiles.h"
#include "command.h"
#include "bfd.h"
#include "gdbcore.h"
#include "solist.h"
#include "kvm-fbsd-machine.h"
static void
kcore_files_info (struct target_ops *);
static void
kcore_close (int);
static void
get_kcore_registers (int);
static int
xfer_umem (CORE_ADDR, char *, int, int);
#ifdef SOLIB_ADD
static int kcore_solib_add_stub (PTR);
#endif
static char *core_file;
static kvm_t *core_kd;
static struct pcb cur_pcb;
static struct kinfo_proc *cur_proc;
static struct target_ops kcore_ops;
int kernel_debugging;
int kernel_writablecore;
/* Read the "thing" at kernel address 'addr' into the space pointed to
by point. The length of the "thing" is determined by the type of p.
Result is non-zero if transfer fails. */
#define kvread(addr, p) \
(target_read_memory ((CORE_ADDR) (addr), (char *) (p), sizeof (*(p))))
static CORE_ADDR
ksym_kernbase (void)
{
static CORE_ADDR kernbase;
struct minimal_symbol *sym;
if (kernbase == 0)
{
sym = lookup_minimal_symbol ("kernbase", NULL, NULL);
if (sym == NULL) {
kernbase = KERNBASE;
} else {
kernbase = SYMBOL_VALUE_ADDRESS (sym);
}
}
return kernbase;
}
#define KERNOFF (ksym_kernbase ())
#define INKERNEL(x) ((x) >= KERNOFF)
static CORE_ADDR
ksym_lookup(const char *name)
{
struct minimal_symbol *sym;
sym = lookup_minimal_symbol (name, NULL, NULL);
if (sym == NULL)
error ("kernel symbol `%s' not found.", name);
return SYMBOL_VALUE_ADDRESS (sym);
}
/* Provide the address of an initial PCB to use.
If this is a crash dump, try for "dumppcb".
If no "dumppcb" or it's /dev/mem, use proc0.
Return the core address of the PCB we found. */
static CORE_ADDR
initial_pcb (void)
{
struct minimal_symbol *sym;
CORE_ADDR addr;
void *val;
/* Make sure things are open... */
if (!core_kd || !core_file)
return (0);
/* If this is NOT /dev/mem try for dumppcb. */
if (strncmp (core_file, _PATH_DEV, sizeof _PATH_DEV - 1))
{
sym = lookup_minimal_symbol ("dumppcb", NULL, NULL);
if (sym != NULL)
{
addr = SYMBOL_VALUE_ADDRESS (sym);
return (addr);
}
}
/* OK, just use thread0's pcb. Note that curproc might
not exist, and if it does, it will point to gdb.
Therefore, just use proc0 and let the user set
some other context if they care about it. */
addr = ksym_lookup ("thread0");
if (kvread (addr, &val))
{
error ("cannot read thread0 pointer at %x\n", addr);
val = 0;
}
else
{
/* Read the PCB address in thread structure. */
addr += offsetof (struct thread, td_pcb);
if (kvread (addr, &val))
{
error ("cannot read thread0->td_pcb pointer at %x\n", addr);
val = 0;
}
}
/* thread0 is wholly in the kernel and cur_proc is only used for
reading user mem, so no point in setting this up. */
cur_proc = 0;
return ((CORE_ADDR)val);
}
/* Set the current context to that of the PCB struct at the system address
passed. */
static int
set_context (CORE_ADDR addr)
{
if (kvread (addr, &cur_pcb))
error ("cannot read pcb at %#x", addr);
/* Fetch all registers from core file. */
target_fetch_registers (-1);
/* Now, set up the frame cache, and print the top of stack. */
flush_cached_frames ();
set_current_frame (create_new_frame (read_fp (), read_pc ()));
select_frame (get_current_frame (), 0);
return (0);
}
/* Discard all vestiges of any previous core file and mark data and stack
spaces as empty. */
/* ARGSUSED */
static void
kcore_close (int quitting)
{
inferior_ptid = null_ptid; /* Avoid confusion from thread stuff. */
/* Clear out solib state while the bfd is still open. See
comments in clear_solib in solib.c. */
#ifdef CLEAR_SOLIB
CLEAR_SOLIB ();
#endif
if (core_kd)
{
kvm_close (core_kd);
free (core_file);
core_file = NULL;
core_kd = NULL;
}
}
/* This routine opens and sets up the core file bfd. */
static void
kcore_open (char *filename /* the core file */, int from_tty)
{
kvm_t *kd;
const char *p;
struct cleanup *old_chain;
char buf[256], *cp;
int ontop;
CORE_ADDR addr;
target_preopen (from_tty);
/* The exec file is required for symbols. */
if (exec_bfd == NULL)
error ("No kernel exec file specified");
if (core_kd)
{
error ("No core file specified."
" (Use `detach' to stop debugging a core file.)");
return;
}
if (!filename)
{
error ("No core file specified.");
return;
}
filename = tilde_expand (filename);
if (filename[0] != '/')
{
cp = concat (current_directory, "/", filename, NULL);
free (filename);
filename = cp;
}
old_chain = make_cleanup (free, filename);
kd = kvm_open (bfd_get_filename(exec_bfd), filename, NULL,
kernel_writablecore ? O_RDWR: O_RDONLY, 0);
if (kd == NULL)
{
perror_with_name (filename);
return;
}
/* Looks semi-reasonable. Toss the old core file and work on the new. */
discard_cleanups (old_chain); /* Don't free filename any more. */
core_file = filename;
unpush_target (&kcore_ops);
ontop = !push_target (&kcore_ops);
/* Note unpush_target (above) calls kcore_close. */
core_kd = kd;
/* Print out the panic string if there is one. */
if (kvread (ksym_lookup ("panicstr"), &addr) == 0 &&
addr != 0 &&
target_read_memory (addr, buf, sizeof(buf)) == 0)
{
for (cp = buf; cp < &buf[sizeof(buf)] && *cp; cp++)
if (!isascii (*cp) || (!isprint (*cp) && !isspace (*cp)))
*cp = '?';
*cp = '\0';
if (buf[0] != '\0')
printf_filtered ("panic: %s\n", buf);
}
/* Print all the panic messages if possible. */
if (symfile_objfile != NULL)
{
printf ("panic messages:\n---\n");
snprintf (buf, sizeof buf,
"/sbin/dmesg -N %s -M %s | \
/usr/bin/awk '/^(panic:|Fatal trap) / { printing = 1 } \
{ if (printing) print $0 }'",
symfile_objfile->name, filename);
fflush (stdout);
system (buf);
printf ("---\n");
}
if (ontop)
{
/* Add symbols and section mappings for any kernel modules. */
#ifdef SOLIB_ADD
current_target_so_ops = &kgdb_so_ops;
catch_errors (kcore_solib_add_stub, &from_tty, (char *) 0,
RETURN_MASK_ALL);
#endif
}
else
{
warning ("you won't be able to access this core file until you terminate\n"
"your %s; do ``info files''", target_longname);
return;
}
/* Now, set up process context, and print the top of stack. */
(void)set_context (initial_pcb());
print_stack_frame (selected_frame, selected_frame_level, 1);
}
static void
kcore_detach (char *args, int from_tty)
{
if (args)
error ("Too many arguments");
unpush_target (&kcore_ops);
reinit_frame_cache ();
if (from_tty)
printf_filtered ("No kernel core file now.\n");
}
/* Get the registers out of a core file. This is the machine-
independent part. Fetch_core_registers is the machine-dependent
part, typically implemented in the xm-file for each architecture. */
/* We just get all the registers, so we don't use regno. */
/* ARGSUSED */
static void
get_kcore_registers (int regno)
{
/* XXX - Only read the pcb when set_context() is called.
When looking at a live kernel this may be a problem,
but the user can do another "proc" or "pcb" command to
grab a new copy of the pcb... */
/* Zero out register set then fill in the ones we know about. */
fetch_kcore_registers (&cur_pcb);
}
static void
kcore_files_info (t)
struct target_ops *t;
{
printf_filtered ("\t`%s'\n", core_file);
}
static int
xfer_kmem (CORE_ADDR memaddr, char *myaddr, int len, int write,
struct mem_attrib *attrib, struct target_ops *target)
{
int n;
if (!INKERNEL (memaddr))
return xfer_umem (memaddr, myaddr, len, write);
if (core_kd == NULL)
return 0;
if (write)
n = kvm_write (core_kd, memaddr, myaddr, len);
else
n = kvm_read (core_kd, memaddr, myaddr, len) ;
if (n < 0) {
fprintf_unfiltered (gdb_stderr, "can not access 0x%x, %s\n",
(unsigned)memaddr, kvm_geterr (core_kd));
n = 0;
}
return n;
}
static int
xfer_umem (CORE_ADDR memaddr, char *myaddr, int len, int write /* ignored */)
{
int n = 0;
if (cur_proc == 0)
{
error ("---Can't read userspace from dump, or kernel process---\n");
return 0;
}
if (write)
error ("kvm_uwrite unimplemented\n");
else
n = kvm_uread (core_kd, cur_proc, memaddr, myaddr, len) ;
if (n < 0)
return 0;
return n;
}
static void
set_proc_cmd (char *arg, int from_tty)
{
CORE_ADDR addr, pid_addr, first_td;
void *val;
struct kinfo_proc *kp;
int cnt;
pid_t pid;
if (!arg)
error_no_arg ("proc address for the new context");
if (core_kd == NULL)
error ("no kernel core file");
addr = (CORE_ADDR) parse_and_eval_address (arg);
if (!INKERNEL (addr))
{
kp = kvm_getprocs (core_kd, KERN_PROC_PID, addr, &cnt);
if (!cnt)
error ("invalid pid");
addr = (CORE_ADDR)kp->ki_paddr;
cur_proc = kp;
}
else
{
/* Update cur_proc. */
pid_addr = addr + offsetof (struct proc, p_pid);
if (kvread (pid_addr, &pid))
error ("cannot read pid ptr");
cur_proc = kvm_getprocs (core_kd, KERN_PROC_PID, pid, &cnt);
if (!cnt)
error("invalid pid");
}
/* Find the first thread in the process. XXXKSE */
addr += offsetof (struct proc, p_threads.tqh_first);
if (kvread (addr, &first_td))
error ("cannot read thread ptr");
/* Read the PCB address in thread structure. */
addr = first_td + offsetof (struct thread, td_pcb);
if (kvread (addr, &val))
error("cannot read pcb ptr");
/* Read the PCB address in proc structure. */
if (set_context ((CORE_ADDR) val))
error ("invalid proc address");
}
#ifdef SOLIB_ADD
static int
kcore_solib_add_stub (PTR from_ttyp)
{
SOLIB_ADD (NULL, *(int *) from_ttyp, &current_target, auto_solib_add);
return 0;
}
#endif /* SOLIB_ADD */
void
_initialize_kcorelow (void)
{
kcore_ops.to_shortname = "kcore";
kcore_ops.to_longname = "Kernel core dump file";
kcore_ops.to_doc =
"Use a core file as a target. Specify the filename of the core file.";
kcore_ops.to_open = kcore_open;
kcore_ops.to_close = kcore_close;
kcore_ops.to_attach = find_default_attach;
kcore_ops.to_detach = kcore_detach;
kcore_ops.to_fetch_registers = get_kcore_registers;
kcore_ops.to_xfer_memory = xfer_kmem;
kcore_ops.to_files_info = kcore_files_info;
kcore_ops.to_create_inferior = find_default_create_inferior;
kcore_ops.to_stratum = kcore_stratum;
kcore_ops.to_has_memory = 1;
kcore_ops.to_has_stack = 1;
kcore_ops.to_has_registers = 1;
kcore_ops.to_magic = OPS_MAGIC;
add_target (&kcore_ops);
add_com ("proc", class_obscure, set_proc_cmd, "Set current process context");
}

View File

@ -1,304 +0,0 @@
/* Handle FreeBSD kernel modules as shared libraries.
Copyright 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000,
2001
Free Software Foundation, Inc.
This file is part of GDB.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA. */
/* $FreeBSD$ */
#include <sys/param.h>
#include <sys/queue.h>
#include <sys/stat.h>
#define _KERNEL
#include <sys/linker.h>
#undef _KERNEL
/* XXX, kludge to avoid duplicate definitions while sys/linker.h is used. */
#define _ELF_COMMON_H
#include "defs.h"
#include "symtab.h"
#include "bfd.h"
#include "symfile.h"
#include "objfiles.h"
#include "gdbcore.h"
#include "target.h"
#include "inferior.h"
#include "solist.h"
struct lm_info
{
CORE_ADDR address;
};
static int try_modpath (char *buf, int buflen, char *fmt, ...);
static char *guess_modpath (char *modname);
static void
kgdb_relocate_section_addresses (struct so_list *so,
struct section_table *sec)
{
sec->addr += so->lm_info->address;
sec->endaddr += so->lm_info->address;
}
static int
kgdb_open_symbol_file_object (void *from_ttyp)
{
warning ("kgdb_open_symbol_file_object called\n");
return 0;
}
static struct so_list *
kgdb_current_sos (void)
{
linker_file_list_t linker_files;
struct linker_file lfile;
struct minimal_symbol *msymbol;
struct linker_file *lfilek;
struct so_list *head = NULL;
struct so_list **link_ptr = &head;
CORE_ADDR lfiles_addr;
msymbol = lookup_minimal_symbol ("linker_files", NULL, symfile_objfile);
if (msymbol == NULL || SYMBOL_VALUE_ADDRESS (msymbol) == 0)
{
warning ("failed to find linker_files symbol\n");
return 0;
}
lfiles_addr = SYMBOL_VALUE_ADDRESS (msymbol);
if (target_read_memory (lfiles_addr, (char *)&linker_files,
sizeof (linker_files)))
{
warning ("failed to read linker_files data\n");
return 0;
}
for (lfilek = TAILQ_FIRST (&linker_files); lfilek != NULL;
lfilek = TAILQ_NEXT (&lfile, link))
{
struct so_list *new;
struct cleanup *old_chain;
char *buf;
int errcode;
if (target_read_memory ((CORE_ADDR) lfilek, (char *) &lfile,
sizeof (lfile)))
{
warning ("failed to read linker file data at %p\n", lfilek);
return 0;
}
target_read_string ((CORE_ADDR) lfile.filename, &buf,
SO_NAME_MAX_PATH_SIZE - 1, &errcode);
if (errcode != 0)
{
warning ("cannot read linker file pathname: %s\n",
safe_strerror (errcode));
return 0;
}
if (strlen (buf) < 3 || strcmp (&buf[strlen (buf) - 3], ".ko") != 0)
{
xfree (buf);
continue;
}
new = (struct so_list *) xmalloc (sizeof (struct so_list));
old_chain = make_cleanup (xfree, new);
memset (new, 0, sizeof (*new));
new->lm_info = xmalloc (sizeof (struct lm_info));
make_cleanup (xfree, new->lm_info);
new->lm_info->address = (CORE_ADDR) lfile.address;
strncpy (new->so_original_name, buf, SO_NAME_MAX_PATH_SIZE - 1);
new->so_original_name[SO_NAME_MAX_PATH_SIZE - 1] = '\0';
xfree (buf);
snprintf (new->so_name, SO_NAME_MAX_PATH_SIZE, "%s",
guess_modpath (new->so_original_name));
new->next = NULL;
*link_ptr = new;
link_ptr = &new->next;
discard_cleanups (old_chain);
}
return head;
}
static int
kgdb_in_dynsym_resolve_code (CORE_ADDR pc)
{
warning ("kgdb_in_dynsym_resolve_code called\n");
return 0;
}
static void
kgdb_special_symbol_handling (void)
{
}
static void
kgdb_solib_create_inferior_hook (void)
{
struct so_list *inferior_sos;
inferior_sos = kgdb_current_sos ();
if (inferior_sos)
{
solib_add (NULL, /*from_tty*/0, NULL, auto_solib_add);
}
}
static void
kgdb_clear_solib (void)
{
}
static void
kgdb_free_so (struct so_list *so)
{
xfree (so->lm_info);
}
static int
try_modpath (char *buf, int buflen, char *fmt, ...)
{
struct stat sb;
va_list ap;
va_start (ap, fmt);
vsnprintf (buf, buflen, fmt, ap);
va_end(ap);
return (stat (buf, &sb) == 0);
}
static char *
guess_modpath (char *modname)
{
static char buf[2048], moddir[128], syspath[1024];
struct minimal_symbol *msymbol;
char *kernpath, *objpath, *p, *version;
int errcode, n, syspathlen;
/* Set default module location */
snprintf (buf, sizeof (buf), "/boot/kernel/%s", modname);
/* Guess at the subdirectory off sys/modules. XXX, only sometimes correct */
n = strlen (modname);
if (n > 3 && strcmp (&modname[n - 3], ".ko") == 0)
n -= 3;
snprintf (moddir, sizeof (moddir), "%.*s", n, modname);
/* Try to locate the kernel compile location from version[] */
msymbol = lookup_minimal_symbol ("version", NULL, symfile_objfile);
if (msymbol == NULL || SYMBOL_VALUE_ADDRESS (msymbol) == 0)
{
warning("cannot find `version' symbol; using default module path\n");
return buf;
}
target_read_string (SYMBOL_VALUE_ADDRESS (msymbol), &version, 2048, &errcode);
if (errcode != 0)
{
warning ("cannot read `version' string; using default module path: %s\n",
safe_strerror (errcode));
return buf;
}
/* Find the kernel build path after user@host: on the second line. */
if ((p = strchr (version, '\n')) == NULL ||
(kernpath = strchr (p, ':')) == NULL ||
(p = strchr (kernpath, '\n')) == NULL)
{
warning ("cannot parse version[]; using default module path\n");
xfree (version);
return buf;
}
kernpath++;
*p = '\0';
/*
* Find the absolute path to src/sys by skipping back over path
* components until we find a "/sys/".
*/
syspathlen = 0;
while (p > kernpath && syspathlen == 0)
{
while (p > kernpath && *p != '/')
p--;
if (strncmp (p, "/sys/", 5) == 0)
syspathlen = p - kernpath + 4;
else if (p > kernpath)
p--;
}
if (syspathlen == 0)
{
warning ("cannot find /sys/ in `%s'; using default module path\n",
kernpath);
xfree (version);
return buf;
}
/*
* For kernels compiled with buildkernel, the object path will have
* been prepended to the /sys/ path in `kernpath'.
*/
objpath = getenv ("MAKEOBJDIRPREFIX");
if (objpath == NULL)
objpath = "/usr/obj";
n = strlen (objpath);
if (syspathlen > n + 1 && strncmp (kernpath, objpath, n) == 0 &&
kernpath[n] == '/')
snprintf (syspath, sizeof (syspath), "%.*s", syspathlen - n, kernpath + n);
else
snprintf (syspath, sizeof (syspath), "%.*s", syspathlen, kernpath);
/* Now try to find the module file */
if (!try_modpath (buf, sizeof (buf), "./%s.debug", modname) &&
!try_modpath (buf, sizeof (buf), "./%s", modname) && !try_modpath (buf,
sizeof (buf), "%s/modules%s/modules/%s/%s.debug", kernpath, syspath,
moddir, modname) && !try_modpath (buf, sizeof (buf),
"%s/modules%s/modules/%s/%s", kernpath, syspath, moddir, modname) &&
!try_modpath (buf, sizeof (buf), "/boot/kernel/%s.debug", modname) &&
!try_modpath (buf, sizeof (buf), "/boot/kernel/%s", modname))
{
warning ("cannot find file for module %s\n", modname);
snprintf (buf, sizeof (buf), "%s", modname);
}
xfree (version);
return buf;
}
struct target_so_ops kgdb_so_ops;
void
_initialize_kgdb_solib (void)
{
kgdb_so_ops.relocate_section_addresses = kgdb_relocate_section_addresses;
kgdb_so_ops.free_so = kgdb_free_so;
kgdb_so_ops.clear_solib = kgdb_clear_solib;
kgdb_so_ops.solib_create_inferior_hook = kgdb_solib_create_inferior_hook;
kgdb_so_ops.special_symbol_handling = kgdb_special_symbol_handling;
kgdb_so_ops.current_sos = kgdb_current_sos;
kgdb_so_ops.open_symbol_file_object = kgdb_open_symbol_file_object;
kgdb_so_ops.in_dynsym_resolve_code = kgdb_in_dynsym_resolve_code;
}

View File

@ -1,23 +0,0 @@
# $FreeBSD$
.include "../Makefile.inc0"
# Not elf specific so don't install in /usr/libexec/elf
BINDIR=/usr/bin
GDBDIR= ${.CURDIR}/../../../../contrib/gdb
.PATH: ${GDBDIR}/gdb/gdbserver
.PATH: ${GDBDIR}/gdb
PROG= gdbreplay
NO_MAN=
SRCS= gdbreplay.c
CFLAGS+= -I${.CURDIR}/../gdb
CFLAGS+= -I${GDBDIR}/gdb
CFLAGS+= -I${GDBDIR}/gdb/config
CFLAGS+= -I${GDBDIR}/gdb/gdbserver
CFLAGS+= -DNO_MMALLOC
.include <bsd.prog.mk>