From: Simon Schubert Date: Mon, 19 Oct 2009 10:47:47 +0000 (+0200) Subject: gdb: update build infrastructure for gdb-7 X-Git-Url: https://gitweb.dragonflybsd.org/~syl/dragonfly.git/commitdiff_plain/f17ea84b2dd5112ca5026b7331e4b0131fe2aff5 gdb: update build infrastructure for gdb-7 --- diff --git a/gnu/usr.bin/gdb/Makefile b/gnu/usr.bin/gdb/Makefile index 4a2828681b..a219d82a2e 100644 --- a/gnu/usr.bin/gdb/Makefile +++ b/gnu/usr.bin/gdb/Makefile @@ -1,5 +1,3 @@ -# $DragonFly: src/gnu/usr.bin/gdb/Makefile,v 1.3 2008/01/14 21:36:38 corecode Exp $ - -SUBDIR= libbfd libiberty libopcodes libgdb gdb kgdb gdbtui +SUBDIR= libbfd libiberty libopcodes libdecnumber libgdb gdb kgdb gdbtui .include diff --git a/gnu/usr.bin/gdb/Makefile.inc b/gnu/usr.bin/gdb/Makefile.inc index 494df1a6ec..055232b6d0 100644 --- a/gnu/usr.bin/gdb/Makefile.inc +++ b/gnu/usr.bin/gdb/Makefile.inc @@ -1,6 +1,4 @@ -# $DragonFly: src/gnu/usr.bin/gdb/Makefile.inc,v 1.4 2008/01/14 21:36:38 corecode Exp $ - -BASEDIR= ${.CURDIR}/${RELATIVE}../../../../contrib/gdb-6 +BASEDIR= ${.CURDIR}/${RELATIVE}../../../../contrib/gdb-7 GDBLIBS+= ${.OBJDIR}/../libopcodes/libopcodes.a GDBLIBS+= ${.OBJDIR}/../libgdb/libgdb.a diff --git a/gnu/usr.bin/gdb/gdb/Makefile b/gnu/usr.bin/gdb/gdb/Makefile index 06afd7e9f5..bc2a7ba432 100644 --- a/gnu/usr.bin/gdb/gdb/Makefile +++ b/gnu/usr.bin/gdb/gdb/Makefile @@ -1,5 +1,3 @@ -# $DragonFly: src/gnu/usr.bin/gdb/gdb/Makefile,v 1.12 2008/07/30 01:48:14 corecode Exp $ - PROG= gdb SRCS= gdb.c @@ -8,9 +6,10 @@ CFLAGS+= -I${BASEDIR}/bfd -I${BASEDIR}/gdb -I${BASEDIR}/gdb/config -I${.CURDIR}/ CFLAGS+= -I${.OBJDIR}/../libbfd DPADD= ${GDBLIBS} -DPADD+= ${LIBEDIT} ${LIBKVM} ${LIBTERMCAP} ${LIBM} +DPADD+= ${LIBEDIT} ${LIBTERMCAP} ${LIBM} ${LIBZ} LDADD= -L../libgdb -lgdb -L../libbfd -lbfd -L../libopcodes -lopcodes -L../libiberty -liberty -LDADD+= -ledit -lkvm -ltermcap -lm +LDADD+= -L../libdecnumber -ldecnumber +LDADD+= -ledit -ltermcap -lm -lz SUBDIR= doc diff --git a/gnu/usr.bin/gdb/gdb/doc/Makefile b/gnu/usr.bin/gdb/gdb/doc/Makefile index 29356328d3..899a7bb054 100644 --- a/gnu/usr.bin/gdb/gdb/doc/Makefile +++ b/gnu/usr.bin/gdb/gdb/doc/Makefile @@ -1,5 +1,3 @@ -# $DragonFly: src/gnu/usr.bin/gdb/gdb/doc/Makefile,v 1.2 2008/01/14 21:36:38 corecode Exp $ - RELATIVE= ../ .include "../../Makefile.inc" diff --git a/gnu/usr.bin/gdb/gdbtui/Makefile b/gnu/usr.bin/gdb/gdbtui/Makefile index 8ecad27062..27e2a61e70 100644 --- a/gnu/usr.bin/gdb/gdbtui/Makefile +++ b/gnu/usr.bin/gdb/gdbtui/Makefile @@ -1,5 +1,3 @@ -# $DragonFly: src/gnu/usr.bin/gdb/gdbtui/Makefile,v 1.2 2008/07/30 01:48:14 corecode Exp $ - PROG= gdbtui SRCS= tui-main.c @@ -8,9 +6,10 @@ CFLAGS+= -I${BASEDIR}/bfd -I${BASEDIR}/gdb -I${BASEDIR}/gdb/config -I${.CURDIR}/ CFLAGS+= -I${.OBJDIR}/../libbfd DPADD= ${GDBLIBS} -DPADD+= ${LIBEDIT} ${LIBKVM} ${LIBTERMCAP} ${LIBM} +DPADD+= ${LIBEDIT} ${LIBKVM} ${LIBTERMCAP} ${LIBM} ${LIBZ} LDADD= -L../libgdb -lgdb -L../libbfd -lbfd -L../libopcodes -lopcodes -L../libiberty -liberty -LDADD+= -ledit -lkvm -ltermcap -lm +LDADD+= -L../libdecnumber -ldecnumber +LDADD+= -ledit -ltermcap -lm -lz NOMAN= # diff --git a/gnu/usr.bin/gdb/kgdb/Makefile b/gnu/usr.bin/gdb/kgdb/Makefile index ee7f047883..904d674c67 100644 --- a/gnu/usr.bin/gdb/kgdb/Makefile +++ b/gnu/usr.bin/gdb/kgdb/Makefile @@ -1,18 +1,18 @@ -# $DragonFly: src/gnu/usr.bin/gdb/kgdb/Makefile,v 1.4 2008/07/30 01:48:14 corecode Exp $ - PROG= kgdb -SRCS= kgdb.c kthr.c trgt.c trgt_${MACHINE_ARCH}.c +SRCS= kgdb.c kthr.c kld.c trgt.c trgt_${MACHINE_ARCH}.c CFLAGS+= -I${.OBJDIR}/../libgdb -I${.CURDIR}/../libgdb -I${BASEDIR}/include CFLAGS+= -I${BASEDIR}/bfd -I${BASEDIR}/gdb -I${BASEDIR}/gdb/config -I${.CURDIR}/../libbfd -CFLAGS+= -I${.OBJDIR}/../libbfd +CFLAGS+= -I${.OBJDIR}/../libbfd -I${BASEDIR}/gdb/common CFLAGS+= -D_KERNEL_STRUCTURES -DPADD= ${LIBEDIT} ${LIBKVM} ${LIBTERMCAP} ${LIBM} +DPADD= ${LIBEDIT} ${LIBKVM} ${LIBTERMCAP} ${LIBM} ${LIBZ} DPADD+= ${GDBLIBS} LDADD= -L../libgdb -lgdb -L../libbfd -lbfd -L../libopcodes -lopcodes -LDADD+= -L../libiberty -liberty -LDADD+= -ledit -lkvm -ltermcap -lm +LDADD+= -L../libiberty -liberty -L../libdecnumber -ldecnumber +LDADD+= -ledit -lkvm -ltermcap -lm -lz + +WARNS?= 2 .include diff --git a/gnu/usr.bin/gdb/kgdb/kgdb.1 b/gnu/usr.bin/gdb/kgdb/kgdb.1 index 332a1b48c1..4165dd3ac2 100644 --- a/gnu/usr.bin/gdb/kgdb/kgdb.1 +++ b/gnu/usr.bin/gdb/kgdb/kgdb.1 @@ -22,9 +22,9 @@ .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" SUCH DAMAGE. .\" -.\" $FreeBSD: src/gnu/usr.bin/gdb/kgdb/kgdb.1,v 1.8 2005/07/28 15:59:52 keramida Exp $ -.\" $DragonFly: src/gnu/usr.bin/gdb/kgdb/kgdb.1,v 1.2 2006/03/08 09:53:30 swildner Exp $ -.Dd March 2, 2005 +.\" $FreeBSD: src/gnu/usr.bin/gdb/kgdb/kgdb.1,v 1.10 2006/10/21 17:39:35 ru Exp $ +.\" +.Dd October 11, 2006 .Os .Dt KGDB 1 .Sh NAME @@ -35,6 +35,7 @@ .Op Fl a | Fl f | Fl fullname .Op Fl q | Fl quiet .Op Fl v +.Op Fl w .Op Fl d Ar crashdir .Op Fl c Ar core | Fl n Ar dumpnr | Fl r Ar device .Op Ar kernel Op Ar core @@ -68,6 +69,8 @@ The form is supported for compatibility as well. .It Fl v Increase verbosity. +.It Fl w +Opens kmem-based targets in read-write mode. .It Fl d Ar crashdir Use .Ar crashdir diff --git a/gnu/usr.bin/gdb/kgdb/kgdb.c b/gnu/usr.bin/gdb/kgdb/kgdb.c index 0c784fdc80..d38525f698 100644 --- a/gnu/usr.bin/gdb/kgdb/kgdb.c +++ b/gnu/usr.bin/gdb/kgdb/kgdb.c @@ -23,8 +23,7 @@ * (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: src/gnu/usr.bin/gdb/kgdb/main.c,v 1.11 2006/01/04 23:17:52 kan Exp $ - * $DragonFly: src/gnu/usr.bin/gdb/kgdb/kgdb.c,v 1.3 2008/01/14 21:36:38 corecode Exp $ + * $FreeBSD: src/gnu/usr.bin/gdb/kgdb/main.c,v 1.16 2008/04/29 20:32:45 jhb Exp $ */ #include @@ -37,10 +36,8 @@ #include #include #include -#include #include #include -#include #include #include #include @@ -49,7 +46,6 @@ #include #include #include -#include /* libgdb stuff. */ #include @@ -59,49 +55,27 @@ #include #include #include +#include +#include #include #include +#include #include #include -#include - -extern void symbol_file_add_main (char *args, int from_tty); +#include +#include #include "kgdb.h" -kvm_t *kvm; -static char kvm_err[_POSIX2_LINE_MAX]; - static int dumpnr; +static int quiet; static int verbose; static char crashdir[PATH_MAX]; static char *kernel; static char *remote; static char *vmcore; - -static void (*kgdb_new_objfile_chain)(struct objfile * objfile); - -uintptr_t -lookup(const char *sym) -{ - struct nlist nl[2]; - - nl[0].n_name = (char *)(uintptr_t)sym; - nl[1].n_name = NULL; - if (kvm_nlist(kvm, nl) != 0) { - warnx("kvm_nlist(%s): %s", sym, kvm_geterr(kvm)); - return (0); - } - return (nl[0].n_value); -} - -static void -kgdb_atexit(void) -{ - if (kvm != NULL) - kvm_close(kvm); -} +static struct ui_file *parse_gdberr; static void usage(void) @@ -181,116 +155,89 @@ kernel_from_dumpnr(int nr) static void kgdb_new_objfile(struct objfile *objfile) { -#if 0 - printf("XXX: %s(%p)\n", __func__, objfile); - if (objfile != NULL) { - goto out; - } + static int once = 1; + + if (once && objfile != NULL && objfile == symfile_objfile) { + char *buf; -out: -#endif - if (kgdb_new_objfile_chain != NULL) - kgdb_new_objfile_chain(objfile); + /* + * The initial kernel has just been loaded. Start the + * remote target if we have one or attach to the core. + */ + once = 0; + + if (remote != NULL) + asprintf(&buf, "target remote %s", remote); + else if (vmcore != NULL) + asprintf(&buf, "target kernel %s", vmcore); + + if (buf != NULL) { + execute_command(buf, 0); + free(buf); + } + } } -static CORE_ADDR -kgdb_parse(const char *exp) +/* + * Parse an expression and return its value. If 'quiet' is true, then + * any error messages from the parser are masked. + */ +CORE_ADDR +kgdb_parse_1(const char *exp, int quiet) { + struct ui_file *old_stderr; struct cleanup *old_chain; struct expression *expr; struct value *val; char *s; CORE_ADDR n; - s = strdup(exp); - old_chain = make_cleanup(free_current_contents, &expr); - expr = parse_expression(s); - val = (expr != NULL) ? evaluate_expression(expr) : NULL; - n = (val != NULL) ? value_as_address(val) : 0; + old_stderr = gdb_stderr; + if (quiet) + gdb_stderr = parse_gdberr; + n = 0; + s = xstrdup(exp); + old_chain = make_cleanup(xfree, s); + if (gdb_parse_exp_1(&s, NULL, 0, &expr) && *s == '\0') { + make_cleanup(free_current_contents, &expr); + if (gdb_evaluate_expression(expr, &val)) + n = value_as_address(val); + } do_cleanups(old_chain); - free(s); + gdb_stderr = old_stderr; return (n); } #define MSGBUF_SEQ_TO_POS(size, seq) ((seq) % (size)) -/* - * Fake-up because kernel may not have an ABI tag. - */ -static int -kgdb_dummy_sniffer(bfd *bfd) -{ - return(GDB_OSABI_DRAGONFLY_ELF); -} - - -static void -kgdb_init_target(void) +void +kgdb_dmesg(void) { - bfd *kern_bfd; - int kern_desc; - - gdbarch_register_osabi_sniffer(bfd_arch_i386, bfd_target_elf_flavour, - kgdb_dummy_sniffer); - - kern_desc = open(kernel, O_RDONLY); - if (kern_desc == -1) - errx(1, "couldn't open a kernel image"); - - kern_bfd = bfd_fdopenr(kernel, gnutarget, kern_desc); - if (kern_bfd == NULL) { - close(kern_desc); - errx(1, "\"%s\": can't open to probe ABI: %s.", kernel, - bfd_errmsg (bfd_get_error ())); - } - bfd_set_cacheable(kern_bfd, 1); - - if (!bfd_check_format (kern_bfd, bfd_object)) { - bfd_close(kern_bfd); - errx(1, "\"%s\": not in executable format: %s", kernel, - bfd_errmsg(bfd_get_error())); - } - - set_gdbarch_from_file (kern_bfd); - bfd_close(kern_bfd); - - frame_unwind_prepend_unwinder(current_gdbarch, &kgdb_trgt_trapframe_unwind); - - symbol_file_add_main (kernel, 0); - if (remote) - push_remote_target (remote, 0); - else - kgdb_target(); -} - -static void -kgdb_display_msgbuf(void) -{ - uintptr_t addr; - struct msgbuf *bufp, buf; - size_t rseq, wseq; + CORE_ADDR bufp; + int size, rseq, wseq; char c; /* * Display the unread portion of the message buffer. This gives the * user a some initial data to work from. */ - addr = lookup("_msgbufp"); - if (addr == 0) + if (quiet) return; - read_memory((CORE_ADDR)addr, (char *)&bufp, sizeof(bufp)); - read_memory((CORE_ADDR)bufp, (char *)&buf, sizeof(buf)); - if (buf.msg_size == 0 || buf.msg_bufr == buf.msg_bufx) + bufp = kgdb_parse("msgbufp->msg_ptr"); + size = (int)kgdb_parse("msgbufp->msg_size"); + rseq = (int)kgdb_parse("msgbufp->msg_bufr"); + wseq = (int)kgdb_parse("msgbufp->msg_bufx"); + rseq = MSGBUF_SEQ_TO_POS(size, rseq); + wseq = MSGBUF_SEQ_TO_POS(size, wseq); + if (bufp == 0 || size == 0 || rseq == wseq) return; - rseq = MSGBUF_SEQ_TO_POS(buf.msg_size, buf.msg_bufr); - wseq = MSGBUF_SEQ_TO_POS(buf.msg_size, buf.msg_bufx); printf("\nUnread portion of the kernel message buffer:\n"); while (rseq < wseq) { - read_memory((CORE_ADDR)buf.msg_ptr + rseq, &c, 1); + read_memory(bufp + rseq, &c, 1); putchar(c); rseq++; - if (rseq == buf.msg_size) + if (rseq == size) rseq = 0; } if (c != '\n') @@ -301,12 +248,51 @@ kgdb_display_msgbuf(void) static void kgdb_init(char *argv0 __unused) { - kgdb_init_target(); + parse_gdberr = mem_fileopen(); set_prompt("(kgdb) "); - kgdb_display_msgbuf(); - print_stack_frame(get_selected_frame(NULL), - frame_relative_level(get_selected_frame(NULL)), 1); + initialize_kgdb_target(); + initialize_kld_target(); + observer_attach_new_objfile(kgdb_new_objfile); +} + +/* + * Remote targets can support any number of syntaxes and we want to + * support them all with one addition: we support specifying a device + * node for a serial device without the "/dev/" prefix. + * + * What we do is to stat(2) the existing remote target first. If that + * fails, we try it with "/dev/" prepended. If that succeeds we use + * the resulting path, otherwise we use the original target. If + * either stat(2) succeeds make sure the file is either a character + * device or a FIFO. + */ +static void +verify_remote(void) +{ + char path[PATH_MAX]; + struct stat st; + + if (stat(remote, &st) != 0) { + snprintf(path, sizeof(path), "/dev/%s", remote); + if (stat(path, &st) != 0) + return; + free(remote); + remote = strdup(path); + } + if (!S_ISCHR(st.st_mode) && !S_ISFIFO(st.st_mode)) + errx(1, "%s: not a special file, FIFO or socket", remote); +} + +static void +add_arg(struct captured_main_args *args, char *arg) +{ + + args->argc++; + args->argv = reallocf(args->argv, (args->argc + 1) * sizeof(char *)); + if (args->argv == NULL) + err(1, "Out of memory building argument list"); + args->argv[args->argc] = arg; } int @@ -316,7 +302,7 @@ main(int argc, char *argv[]) struct stat st; struct captured_main_args args; char *s; - int a, ch, quiet, writecore; + int a, ch; dumpnr = -1; @@ -341,7 +327,11 @@ main(int argc, char *argv[]) } quiet = 0; - writecore = 0; + memset (&args, 0, sizeof args); + args.use_windows = 0; + args.interpreter_p = INTERP_CONSOLE; + args.argv = malloc(sizeof(char *)); + args.argv[0] = argv[0]; while ((ch = getopt(argc, argv, "ac:d:fn:qr:vw")) != -1) { switch (ch) { @@ -374,6 +364,7 @@ main(int argc, char *argv[]) break; case 'q': quiet = 1; + add_arg(&args, "-q"); break; case 'r': /* use given device for remote session. */ if (remote != NULL) { @@ -388,7 +379,7 @@ main(int argc, char *argv[]) verbose++; break; case 'w': /* core file is writeable. */ - writecore = 1; + add_arg(&args, "--write"); break; case '?': default: @@ -421,21 +412,8 @@ main(int argc, char *argv[]) if (!S_ISREG(st.st_mode)) errx(1, "%s: not a regular file", path); vmcore = strdup(path); - } else if (remote != NULL && remote[0] != ':' && remote[0] != '|') { - if (stat(remote, &st) != 0) { - snprintf(path, sizeof(path), "/dev/%s", remote); - if (stat(path, &st) != 0) { - err(1, "%s", remote); - /* NOTREACHED */ - } - free(remote); - remote = strdup(path); - } - if (!S_ISCHR(st.st_mode) && !S_ISFIFO(st.st_mode)) { - errx(1, "%s: not a special file, FIFO or socket", - remote); - /* NOTREACHED */ - } + } else if (remote != NULL) { + verify_remote(); } else if (argc > optind) { if (vmcore == NULL) vmcore = strdup(argv[optind++]); @@ -455,20 +433,12 @@ main(int argc, char *argv[]) warnx("kernel image: %s", kernel); } - /* - * At this point we must either have a core file or have a kernel - * with a remote target. - */ + /* A remote target requires an explicit kernel argument. */ if (remote != NULL && kernel == NULL) { warnx("remote debugging requires a kernel"); usage(); /* NOTREACHED */ } - if (vmcore == NULL && remote == NULL) { - warnx("need a core file or a device for remote debugging"); - usage(); - /* NOTREACHED */ - } /* If we don't have a kernel image yet, try to find one. */ if (kernel == NULL) { @@ -480,27 +450,18 @@ main(int argc, char *argv[]) if (verbose) warnx("kernel image: %s", kernel); } + add_arg(&args, kernel); - if (remote == NULL) { - kvm = kvm_openfiles(kernel, vmcore, NULL, - writecore ? O_RDWR : O_RDONLY, kvm_err); - if (kvm == NULL) - errx(1, kvm_err); - atexit(kgdb_atexit); - kgdb_thr_init(); - } + /* + if (vmcore != NULL) + add_arg(&args, vmcore); + */ /* The libgdb code uses optind too. Reset it... */ optind = 0; - memset (&args, 0, sizeof args); - args.argv = argv; - args.argc = 1 + quiet; - if (quiet) - argv[1] = "-q"; - argv[args.argc] = NULL; - args.use_windows = 0; - args.interpreter_p = INTERP_CONSOLE; + /* Terminate argv list. */ + add_arg(&args, NULL); deprecated_init_ui_hook = kgdb_init; diff --git a/gnu/usr.bin/gdb/kgdb/kgdb.h b/gnu/usr.bin/gdb/kgdb/kgdb.h index 927ea5076d..4b72303a23 100644 --- a/gnu/usr.bin/gdb/kgdb/kgdb.h +++ b/gnu/usr.bin/gdb/kgdb/kgdb.h @@ -23,8 +23,7 @@ * (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: src/gnu/usr.bin/gdb/kgdb/kgdb.h,v 1.3 2005/09/10 18:25:53 marcel Exp $ - * $DragonFly: src/gnu/usr.bin/gdb/kgdb/kgdb.h,v 1.4 2008/01/14 21:36:38 corecode Exp $ + * $FreeBSD: src/gnu/usr.bin/gdb/kgdb/kgdb.h,v 1.13 2008/04/29 20:32:45 jhb Exp $ */ #ifndef _KGDB_H_ @@ -40,19 +39,20 @@ struct kthr { uintptr_t kaddr; uintptr_t kstack; uintptr_t pcb; + uintptr_t gd; int tid; int pid; + int lwpid; }; extern struct kthr *curkthr; -uintptr_t lookup(const char *); - -void kgdb_target(void); -void kgdb_trgt_fetch_registers(struct regcache *, int); -void kgdb_trgt_store_registers(struct regcache *, int); - -extern const struct frame_unwind kgdb_trgt_trapframe_unwind; +void initialize_kld_target(void); +void initialize_kgdb_target(void); +void kgdb_dmesg(void); +void kgdb_trgt_fetch_registers(struct target_ops *, struct regcache *, int); +void kld_init(void); +void kld_new_objfile(struct objfile *); struct kthr *kgdb_thr_first(void); struct kthr *kgdb_thr_init(void); @@ -63,5 +63,12 @@ struct kthr *kgdb_thr_lookup_taddr(uintptr_t); struct kthr *kgdb_thr_next(struct kthr *); struct kthr *kgdb_thr_select(struct kthr *); char *kgdb_thr_extra_thread_info(int); +char *kgdb_thr_pid_to_str(ptid_t); + +uintptr_t kgdb_lookup(const char *sym); +CORE_ADDR kgdb_parse_1(const char *, int); + +#define kgdb_parse(exp) kgdb_parse_1((exp), 0) +#define kgdb_parse_quiet(exp) kgdb_parse_1((exp), 1) #endif /* _KGDB_H_ */ diff --git a/gnu/usr.bin/gdb/kgdb/kld.c b/gnu/usr.bin/gdb/kgdb/kld.c new file mode 100644 index 0000000000..70b31a9348 --- /dev/null +++ b/gnu/usr.bin/gdb/kgdb/kld.c @@ -0,0 +1,499 @@ +/* + * Copyright (c) 2004 Marcel Moolenaar + * All rights reserved. + * + * 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. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``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 AUTHOR 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: src/gnu/usr.bin/gdb/kgdb/kld.c,v 1.11 2008/10/02 20:42:10 jhb Exp $ + */ + +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "kgdb.h" + +struct lm_info { + CORE_ADDR base_address; +}; + +/* Offsets of fields in linker_file structure. */ +static CORE_ADDR off_address, off_filename, off_pathname, off_next; + +/* KVA of 'linker_path' which corresponds to the kern.module_path sysctl .*/ +static CORE_ADDR module_path_addr; +static CORE_ADDR linker_files_addr; +static CORE_ADDR kernel_file_addr; + +static struct target_so_ops kld_so_ops; + +static int +kld_ok (char *path) +{ + struct stat sb; + + if (stat(path, &sb) == 0 && S_ISREG(sb.st_mode)) + return (1); + return (0); +} + +/* + * Look for a matching file checking for debug suffixes before the raw file: + * - filename + ".debug" (e.g. foo.ko.debug) + * - filename (e.g. foo.ko) + */ +static const char *kld_suffixes[] = { + ".debug", + "", + NULL +}; + +static int +check_kld_path (char *path, size_t path_size) +{ + const char **suffix; + char *ep; + + ep = path + strlen(path); + suffix = kld_suffixes; + while (*suffix != NULL) { + if (strlcat(path, *suffix, path_size) < path_size) { + if (kld_ok(path)) + return (1); + } + + /* Restore original path to remove suffix. */ + *ep = '\0'; + suffix++; + } + return (0); +} + +/* + * Try to find the path for a kld by looking in the kernel's directory and + * in the various paths in the module path. + */ +static int +find_kld_path (char *filename, char *path, size_t path_size) +{ + char *module_path; + char *kernel_dir, *module_dir, *cp; + int error; + + if (exec_bfd) { + kernel_dir = dirname(bfd_get_filename(exec_bfd)); + if (kernel_dir != NULL) { + snprintf(path, path_size, "%s/%s", kernel_dir, + filename); + if (check_kld_path(path, path_size)) + return (1); + } + } + if (module_path_addr != 0) { + target_read_string(module_path_addr, &module_path, PATH_MAX, + &error); + if (error == 0) { + make_cleanup(xfree, module_path); + cp = module_path; + while ((module_dir = strsep(&cp, ";")) != NULL) { + snprintf(path, path_size, "%s/%s", module_dir, + filename); + if (check_kld_path(path, path_size)) + return (1); + } + } + } + return (0); +} + +/* + * Read a kernel pointer given a KVA in 'address'. + */ +static CORE_ADDR +read_pointer (CORE_ADDR address) +{ + struct gdbarch *arch = get_current_arch(); + enum bfd_endian byte_order = gdbarch_byte_order(arch); + gdb_byte buf[sizeof(ULONGEST)]; + int ptrsz; + + ptrsz = gdbarch_ptr_bit(arch) / 8; + + if (target_read_memory(address, buf, ptrsz) != 0) + return (0); + return (extract_unsigned_integer(buf, ptrsz, byte_order)); +} + +/* + * Try to find this kld in the kernel linker's list of linker files. + */ +static int +find_kld_address (char *arg, CORE_ADDR *address) +{ + CORE_ADDR kld; + char *kld_filename; + char *filename; + int error; + + if (linker_files_addr == 0 || off_address == 0 || off_filename == 0 || + off_next == 0) + return (0); + + filename = basename(arg); + for (kld = read_pointer(linker_files_addr); kld != 0; + kld = read_pointer(kld + off_next)) { + /* Try to read this linker file's filename. */ + target_read_string(read_pointer(kld + off_filename), + &kld_filename, PATH_MAX, &error); + if (error) + continue; + + /* Compare this kld's filename against our passed in name. */ + if (strcmp(kld_filename, filename) != 0) { + xfree(kld_filename); + continue; + } + xfree(kld_filename); + + /* + * We found a match, use its address as the base + * address if we can read it. + */ + *address = read_pointer(kld + off_address); + if (*address == 0) + return (0); + return (1); + } + return (0); +} + +static void +load_kld (char *path, CORE_ADDR base_addr, int from_tty) +{ + struct section_addr_info *sap; + struct target_section *sections = NULL, *sections_end = NULL, *s; + struct cleanup *cleanup; + bfd *bfd; + int i; + + /* Open the kld. */ + bfd = bfd_openr(path, gnutarget); + if (bfd == NULL) + error("\"%s\": can't open: %s", path, + bfd_errmsg(bfd_get_error())); + cleanup = make_cleanup_bfd_close(bfd); + + if (!bfd_check_format(bfd, bfd_object)) + error("\%s\": not an object file", path); + + /* Make sure we have a .text section. */ + if (bfd_get_section_by_name (bfd, ".text") == NULL) + error("\"%s\": can't find text section", path); + + /* Build a section table from the bfd and relocate the sections. */ + if (build_section_table (bfd, §ions, §ions_end)) + error("\"%s\": can't find file sections", path); + cleanup = make_cleanup(xfree, sections); + for (s = sections; s < sections_end; s++) { + s->addr += base_addr; + s->endaddr += base_addr; + } + + /* Build a section addr info to pass to symbol_file_add(). */ + sap = build_section_addr_info_from_section_table (sections, + sections_end); + cleanup = make_cleanup((make_cleanup_ftype *)free_section_addr_info, + sap); + + printf_unfiltered("add symbol table from file \"%s\" at\n", path); + for (i = 0; i < sap->num_sections; i++) + printf_unfiltered("\t%s_addr = %s\n", sap->other[i].name, + hex_string(sap->other[i].addr)); + + if (from_tty && (!query("%s", ""))) + error("Not confirmed."); + + symbol_file_add(path, from_tty ? SYMFILE_VERBOSE : 0, sap, OBJF_USERLOADED); + + do_cleanups(cleanup); +} + +static void +kgdb_add_kld_cmd (char *arg, int from_tty) +{ + char path[PATH_MAX]; + CORE_ADDR base_addr; + + if (!exec_bfd) + error("No kernel symbol file"); + + /* Try to open the raw path to handle absolute paths first. */ + snprintf(path, sizeof(path), "%s", arg); + if (!check_kld_path(path, sizeof(path))) { + + /* + * If that didn't work, look in the various possible + * paths for the module. + */ + if (!find_kld_path(arg, path, sizeof(path))) { + error("Unable to locate kld"); + return; + } + } + + if (!find_kld_address(arg, &base_addr)) { + error("Unable to find kld in kernel"); + return; + } + + load_kld(path, base_addr, from_tty); + + reinit_frame_cache(); +} + +static void +kld_relocate_section_addresses (struct so_list *so, struct target_section *sec) +{ + + sec->addr += so->lm_info->base_address; + sec->endaddr += so->lm_info->base_address; +} + +static void +kld_free_so (struct so_list *so) +{ + + xfree(so->lm_info); +} + +static void +kld_clear_solib (void) +{ +} + +static void +kld_solib_create_inferior_hook (void) +{ +} + +static void +kld_special_symbol_handling (void) +{ +} + +static struct so_list * +kld_current_sos (void) +{ + struct so_list *head, **prev, *new; + CORE_ADDR kld, kernel; + char *path; + int error; + + if (linker_files_addr == 0 || kernel_file_addr == 0 || + off_address == 0 || off_filename == 0 || off_next == 0) + return (NULL); + + head = NULL; + prev = &head; + + /* + * Walk the list of linker files creating so_list entries for + * each non-kernel file. + */ + kernel = read_pointer(kernel_file_addr); + for (kld = read_pointer(linker_files_addr); kld != 0; + kld = read_pointer(kld + off_next)) { + /* Skip the main kernel file. */ + if (kld == kernel) + continue; + + new = xmalloc(sizeof(*new)); + memset(new, 0, sizeof(*new)); + + new->lm_info = xmalloc(sizeof(*new->lm_info)); + new->lm_info->base_address = 0; + + /* Read the base filename and store it in so_original_name. */ + target_read_string(read_pointer(kld + off_filename), + &path, sizeof(new->so_original_name), &error); + if (error != 0) { + warning("kld_current_sos: Can't read filename: %s\n", + safe_strerror(error)); + free_so(new); + continue; + } + strlcpy(new->so_original_name, path, + sizeof(new->so_original_name)); + xfree(path); + + /* + * Try to read the pathname (if it exists) and store + * it in so_name. + */ + if (off_pathname != 0) { + target_read_string(read_pointer(kld + off_pathname), + &path, sizeof(new->so_name), &error); + if (error != 0) { + warning( + "kld_current_sos: Can't read pathname for \"%s\": %s\n", + new->so_original_name, + safe_strerror(error)); + strlcpy(new->so_name, new->so_original_name, + sizeof(new->so_name)); + } else { + strlcpy(new->so_name, path, + sizeof(new->so_name)); + xfree(path); + } + } else + strlcpy(new->so_name, new->so_original_name, + sizeof(new->so_name)); + + /* Read this kld's base address. */ + new->lm_info->base_address = read_pointer(kld + off_address); + if (new->lm_info->base_address == 0) { + warning( + "kld_current_sos: Invalid address for kld \"%s\"", + new->so_original_name); + free_so(new); + continue; + } + + /* Append to the list. */ + *prev = new; + prev = &new->next; + } + + return (head); +} + +static int +kld_open_symbol_file_object (void *from_ttyp) +{ + + return (0); +} + +static int +kld_in_dynsym_resolve_code (CORE_ADDR pc) +{ + + return (0); +} + +static int +kld_find_and_open_solib (char *solib, unsigned o_flags, char **temp_pathname) +{ + char path[PATH_MAX]; + int fd; + + *temp_pathname = NULL; + if (!find_kld_path(solib, path, sizeof(path))) { + errno = ENOENT; + return (-1); + } + fd = open(path, o_flags, 0); + if (fd >= 0) + *temp_pathname = xstrdup(path); + return (fd); +} + +void +kld_new_objfile (struct objfile *objfile) +{ + + if (!have_partial_symbols()) + return; + + /* + * Compute offsets of relevant members in struct linker_file + * and the addresses of global variables. Don't warn about + * kernels that don't have 'pathname' in the linker_file + * struct since 6.x kernels don't have it. + */ + off_address = kgdb_parse("&((struct linker_file *)0)->address"); + off_filename = kgdb_parse("&((struct linker_file *)0)->filename"); + off_pathname = kgdb_parse_quiet("&((struct linker_file *)0)->pathname"); + off_next = kgdb_parse("&((struct linker_file *)0)->link.tqe_next"); + module_path_addr = kgdb_parse("linker_path"); + linker_files_addr = kgdb_parse("&linker_files.tqh_first"); + kernel_file_addr = kgdb_parse("&linker_kernel_file"); +} + +static int +load_klds_stub (void *arg) +{ + + solib_add(NULL, 1, ¤t_target, auto_solib_add); + return (0); +} + +void +kld_init (void) +{ + /* XXX hack, needs to go into an abi init function */ + set_solib_ops(get_current_arch(), &kld_so_ops); + + kld_new_objfile(NULL); + catch_errors(load_klds_stub, NULL, NULL, RETURN_MASK_ALL); + observer_attach_new_objfile(kld_new_objfile); +} + +void +initialize_kld_target(void) +{ + struct cmd_list_element *c; + + kld_so_ops.relocate_section_addresses = kld_relocate_section_addresses; + kld_so_ops.free_so = kld_free_so; + kld_so_ops.clear_solib = kld_clear_solib; + kld_so_ops.solib_create_inferior_hook = kld_solib_create_inferior_hook; + kld_so_ops.special_symbol_handling = kld_special_symbol_handling; + kld_so_ops.current_sos = kld_current_sos; + kld_so_ops.open_symbol_file_object = kld_open_symbol_file_object; + kld_so_ops.in_dynsym_resolve_code = kld_in_dynsym_resolve_code; + kld_so_ops.find_and_open_solib = kld_find_and_open_solib; + kld_so_ops.bfd_open = solib_bfd_open; + + c = add_com("add-kld", class_files, kgdb_add_kld_cmd, + "Usage: add-kld FILE\n\ +Load the symbols from the kernel loadable module FILE."); + set_cmd_completer(c, filename_completer); +} diff --git a/gnu/usr.bin/gdb/kgdb/kthr.c b/gnu/usr.bin/gdb/kgdb/kthr.c index 90347811f5..c8e3337b46 100644 --- a/gnu/usr.bin/gdb/kgdb/kthr.c +++ b/gnu/usr.bin/gdb/kgdb/kthr.c @@ -23,8 +23,7 @@ * (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: src/gnu/usr.bin/gdb/kgdb/kthr.c,v 1.3 2005/09/10 18:25:53 marcel Exp $ - * $DragonFly: src/gnu/usr.bin/gdb/kgdb/kthr.c,v 1.5 2008/01/14 21:36:38 corecode Exp $ + * $FreeBSD: src/gnu/usr.bin/gdb/kgdb/kthr.c,v 1.12 2008/05/01 20:36:48 jhb Exp $ */ #include @@ -39,9 +38,11 @@ #include #include #include +#include #include #include +#include #include "kgdb.h" @@ -51,6 +52,18 @@ static int dumptid; static struct kthr *first; struct kthr *curkthr; +uintptr_t +kgdb_lookup(const char *sym) +{ + struct nlist nl[2]; + + nl[0].n_name = (char *)(uintptr_t)sym; + nl[1].n_name = NULL; + if (kvm_nlist(kvm, nl) != 0) + return (0); + return (nl[0].n_value); +} + struct kthr * kgdb_thr_first(void) { @@ -61,27 +74,33 @@ struct kthr * kgdb_thr_init(void) { struct proc p; - struct lwp lwp; struct thread td; + struct lwp lwp; struct mdglobaldata gd; struct kthr *kt; uintptr_t addr, paddr, prvspace; int cpu, ncpus; - addr = lookup("_ncpus"); + while (first != NULL) { + kt = first; + first = kt->next; + free(kt); + } + + addr = kgdb_lookup("_ncpus"); if (addr == 0) return (NULL); kvm_read(kvm, addr, &ncpus, sizeof(ncpus)); - dumppcb = lookup("_dumppcb"); + dumppcb = kgdb_lookup("_dumppcb"); if (dumppcb == 0) return (NULL); - prvspace = lookup("CPU_prvspace"); + prvspace = kgdb_lookup("_CPU_prvspace"); if (prvspace == 0) return (NULL); - addr = lookup("_dumpthread"); + addr = kgdb_lookup("_dumpthread"); if (addr != 0) { kvm_read(kvm, addr, &dumptid, sizeof(dumptid)); } else { @@ -96,7 +115,7 @@ kgdb_thr_init(void) */ int dumping = 0; - addr = lookup("_dumping"); + addr = kgdb_lookup("_dumping"); kvm_read(kvm, addr, &dumping, sizeof(dumping)); if (dumping) { kvm_read(kvm, prvspace + @@ -135,6 +154,10 @@ kgdb_thr_init(void) warnx("kvm_read: %s", kvm_geterr(kvm)); kt->pid = p.p_pid; kt->paddr = paddr; + addr = (uintptr_t)td.td_lwp; + if (kvm_read(kvm, addr, &lwp, sizeof(lwp)) != sizeof(lwp)) + warnx("kvm_read: %s", kvm_geterr(kvm)); + kt->lwpid = lwp.lwp_tid; } else { /* * XXX for some stupid reason, gdb uses pid == -1 @@ -228,14 +251,64 @@ char * kgdb_thr_extra_thread_info(int tid) { struct kthr *kt; - static char comm[MAXCOMLEN + 1]; + static char buf[64]; kt = kgdb_thr_lookup_tid(tid); if (kt == NULL) return (NULL); - if (kvm_read(kvm, kt->kaddr + offsetof(struct thread, td_comm), &comm, - sizeof(comm)) != sizeof(comm)) + + buf[0] = 0; + + return (NULL); +} + +char * +kgdb_thr_pid_to_str(ptid_t ptid) +{ + char comm[MAXCOMLEN + 1]; + struct kthr *kt; + struct proc *p; + struct thread *t; + static char buf[64]; + int tid; + + tid = ptid_get_tid(ptid); + if (tid == 0) + kt = kgdb_thr_lookup_pid(ptid_get_pid(ptid)); + else + kt = kgdb_thr_lookup_tid(tid); + + if (kt == NULL) return (NULL); - return (comm); + buf[0] = 0; + + if (kt->pid != -2) { + snprintf(buf, sizeof(buf), "pid %d", kt->pid); + + if (tid != 0) + snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf), + "/%d", kt->lwpid); + + p = (struct proc *)kt->paddr; + if (kvm_read(kvm, (uintptr_t)&p->p_comm[0], &comm, sizeof(comm)) != + sizeof(comm)) + return (buf); + + strlcat(buf, ", ", sizeof(buf)); + strlcat(buf, comm, sizeof(buf)); + } else { + strcpy(buf, "kernel"); + + if (tid != 0) { + t = (struct thread *)kt->kaddr; + if (kvm_read(kvm, (uintptr_t)&t->td_comm[0], &comm, + sizeof(comm)) == sizeof(comm)) { + strlcat(buf, " ", sizeof(buf)); + strlcat(buf, comm, sizeof(buf)); + } + } + } + + return (buf); } diff --git a/gnu/usr.bin/gdb/kgdb/trgt.c b/gnu/usr.bin/gdb/kgdb/trgt.c index c73a0c32f7..a884005f85 100644 --- a/gnu/usr.bin/gdb/kgdb/trgt.c +++ b/gnu/usr.bin/gdb/kgdb/trgt.c @@ -23,77 +23,204 @@ * (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: src/gnu/usr.bin/gdb/kgdb/trgt.c,v 1.4 2005/09/10 18:25:53 marcel Exp $ - * $DragonFly: src/gnu/usr.bin/gdb/kgdb/trgt.c,v 1.2 2008/01/14 21:36:38 corecode Exp $ + * $FreeBSD: src/gnu/usr.bin/gdb/kgdb/trgt.c,v 1.12 2008/05/01 20:36:48 jhb Exp $ */ #include #include -/*#include */ #include #include +#include +#include #include #include +#include +#include #include +#include #include +#include +#include #include #include +#include #include +#include #include +#include +#include #include "kgdb.h" +static void kgdb_core_cleanup(void *); + +static char *vmcore; static struct target_ops kgdb_trgt_ops; +kvm_t *kvm; +static char kvm_err[_POSIX2_LINE_MAX]; + +#define KERNOFF (kgdb_kernbase ()) +#define INKERNEL(x) ((x) >= KERNOFF) + +static CORE_ADDR +kgdb_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; +} + +static void +kgdb_trgt_open(char *filename, int from_tty) +{ + struct cleanup *old_chain; + struct thread_info *ti; + struct kthr *kt; + kvm_t *nkvm; + char *temp; + int ontop; + + target_preopen (from_tty); + if (!filename) + error ("No vmcore file specified."); + if (!exec_bfd) + error ("Can't open a vmcore without a kernel"); + + filename = tilde_expand (filename); + if (filename[0] != '/') { + temp = concat (current_directory, "/", filename, NULL); + xfree(filename); + filename = temp; + } + + old_chain = make_cleanup (xfree, filename); + + nkvm = kvm_openfiles(bfd_get_filename(exec_bfd), filename, NULL, + write_files ? O_RDWR : O_RDONLY, kvm_err); + if (nkvm == NULL) + error ("Failed to open vmcore: %s", kvm_err); + + /* Don't free the filename now and close any previous vmcore. */ + discard_cleanups(old_chain); + unpush_target(&kgdb_trgt_ops); + + kvm = nkvm; + vmcore = filename; + old_chain = make_cleanup(kgdb_core_cleanup, NULL); + + ontop = !push_target (&kgdb_trgt_ops); + discard_cleanups (old_chain); + + kgdb_dmesg(); + + init_thread_list(); + kt = kgdb_thr_init(); + while (kt != NULL) { + if (!in_inferior_list(kt->pid)) + add_inferior(kt->pid); + ti = add_thread_silent(ptid_build(kt->pid, 0, kt->tid)); + kt = kgdb_thr_next(kt); + } + if (curkthr != 0) + inferior_ptid = ptid_build(curkthr->pid, 0, curkthr->tid); + + if (ontop) { + /* XXX: fetch registers? */ + kld_init(); + reinit_frame_cache(); + select_frame (get_current_frame()); + print_stack_frame(get_selected_frame(NULL), + frame_relative_level(get_selected_frame(NULL)), 1); + } else + warning( + "you won't be able to access this vmcore until you terminate\n\ +your %s; do ``info files''", target_longname); +} + +static void +kgdb_trgt_close(int quitting) +{ + + if (kvm != NULL) { + inferior_ptid = null_ptid; + clear_solib(); + if (kvm_close(kvm) != 0) + warning("cannot close \"%s\": %s", vmcore, + kvm_geterr(kvm)); + kvm = NULL; + xfree(vmcore); + vmcore = NULL; + } +} + +static void +kgdb_core_cleanup(void *arg) +{ + + kgdb_trgt_close(0); +} + +static void +kgdb_trgt_detach(struct target_ops *target, char *args, int from_tty) +{ + + if (args) + error ("Too many arguments"); + unpush_target(target); + reinit_frame_cache(); + if (from_tty) + printf_filtered("No vmcore file now.\n"); +} + static char * kgdb_trgt_extra_thread_info(struct thread_info *ti) { - static char buf[64]; - char *p, *s; - - p = buf + snprintf(buf, sizeof(buf), "PID=%d", ptid_get_pid(ti->ptid)); - s = kgdb_thr_extra_thread_info(ptid_get_tid(ti->ptid)); - if (s != NULL) - snprintf(p, sizeof(buf) - (p - buf), ": %s", s); - return (buf); + + return (kgdb_thr_extra_thread_info(ptid_get_tid(ti->ptid))); } static void kgdb_trgt_files_info(struct target_ops *target) { - struct target_ops *tb; - tb = find_target_beneath(target); - if (tb->to_files_info != NULL) - tb->to_files_info(tb); + printf_filtered ("\t`%s', ", vmcore); + wrap_here (" "); + printf_filtered ("file type %s.\n", "DragonFly kernel vmcore"); } static void -kgdb_trgt_find_new_threads(void) +kgdb_trgt_find_new_threads(struct target_ops *target_ops) { struct target_ops *tb; if (kvm != NULL) return; - tb = find_target_beneath(&kgdb_trgt_ops); + tb = find_target_beneath(target_ops); if (tb->to_find_new_threads != NULL) - tb->to_find_new_threads(); + tb->to_find_new_threads(target_ops); } static char * -kgdb_trgt_pid_to_str(ptid_t ptid) +kgdb_trgt_pid_to_str(struct target_ops *target_ops __unused, ptid_t ptid) { - static char buf[33]; - - snprintf(buf, sizeof(buf), "Thread %#lx", ptid_get_tid(ptid)); - return (buf); + return (kgdb_thr_pid_to_str(ptid)); } static int -kgdb_trgt_thread_alive(ptid_t ptid) +kgdb_trgt_thread_alive(struct target_ops *target_ops __unused, ptid_t ptid) { return (kgdb_thr_lookup_tid(ptid_get_tid(ptid)) != NULL); } @@ -116,37 +243,98 @@ kgdb_trgt_xfer_partial(struct target_ops *ops, enum target_object object, readbuf, writebuf, offset, len)); } -void -kgdb_target(void) +static void +kgdb_switch_to_thread(struct kthr *thr) { - struct kthr *kt; - struct thread_info *ti; + char buf[16]; + int thread_id; + char *err; + + thread_id = pid_to_thread_id(ptid_build(thr->pid, 0, thr->tid)); + if (thread_id == 0) + error ("invalid tid"); + snprintf(buf, sizeof(buf), "%d", thread_id); + if (!gdb_thread_select(uiout, buf, &err)) + error ("%s", err); +} + +static void +kgdb_set_proc_cmd (char *arg, int from_tty) +{ + CORE_ADDR addr; + struct kthr *thr; + + if (!arg) + error_no_arg ("proc address for the new context"); + + if (kvm == NULL) + error ("only supported for core file target"); + addr = (CORE_ADDR) parse_and_eval_address (arg); + + if (!INKERNEL (addr)) { + thr = kgdb_thr_lookup_pid((int)addr); + if (thr == NULL) + error ("invalid pid"); + } else { + thr = kgdb_thr_lookup_paddr(addr); + if (thr == NULL) + error("invalid proc address"); + } + kgdb_switch_to_thread(thr); +} + +static void +kgdb_set_tid_cmd (char *arg, int from_tty) +{ + CORE_ADDR addr; + struct kthr *thr; + + if (!arg) + error_no_arg ("Thread address for the new context"); + + addr = (CORE_ADDR) parse_and_eval_address (arg); + thr = kgdb_thr_lookup_taddr(addr); + + if (thr == NULL) + error("invalid thread address"); + + kgdb_switch_to_thread(thr); +} + +int fbsdcoreops_suppress_target = 1; + +void +initialize_kgdb_target(void) +{ kgdb_trgt_ops.to_magic = OPS_MAGIC; kgdb_trgt_ops.to_shortname = "kernel"; - kgdb_trgt_ops.to_longname = "kernel core files."; - kgdb_trgt_ops.to_doc = "Kernel core files."; - kgdb_trgt_ops.to_stratum = thread_stratum; - kgdb_trgt_ops.to_has_memory = 1; - kgdb_trgt_ops.to_has_registers = 1; - kgdb_trgt_ops.to_has_stack = 1; + kgdb_trgt_ops.to_longname = "kernel core dump file"; + kgdb_trgt_ops.to_doc = + "Use a vmcore file as a target. Specify the filename of the vmcore file."; + kgdb_trgt_ops.to_stratum = core_stratum; + kgdb_trgt_ops.to_has_registers = default_child_has_registers; + kgdb_trgt_ops.to_has_memory = default_child_has_memory; + kgdb_trgt_ops.to_has_stack = default_child_has_stack; + kgdb_trgt_ops.to_open = kgdb_trgt_open; + kgdb_trgt_ops.to_close = kgdb_trgt_close; + kgdb_trgt_ops.to_attach = find_default_attach; + kgdb_trgt_ops.to_detach = kgdb_trgt_detach; kgdb_trgt_ops.to_extra_thread_info = kgdb_trgt_extra_thread_info; kgdb_trgt_ops.to_fetch_registers = kgdb_trgt_fetch_registers; kgdb_trgt_ops.to_files_info = kgdb_trgt_files_info; kgdb_trgt_ops.to_find_new_threads = kgdb_trgt_find_new_threads; kgdb_trgt_ops.to_pid_to_str = kgdb_trgt_pid_to_str; - kgdb_trgt_ops.to_store_registers = kgdb_trgt_store_registers; + /* + kgdb_trgt_ops.to_store_registers = NULL; + */ kgdb_trgt_ops.to_thread_alive = kgdb_trgt_thread_alive; kgdb_trgt_ops.to_xfer_partial = kgdb_trgt_xfer_partial; add_target(&kgdb_trgt_ops); - push_target(&kgdb_trgt_ops); - kt = kgdb_thr_first(); - while (kt != NULL) { - ti = add_thread(ptid_build(kt->pid, 0, kt->tid)); - kt = kgdb_thr_next(kt); - } - if (curkthr != 0) - inferior_ptid = ptid_build(curkthr->pid, 0, curkthr->tid); + add_com ("proc", class_obscure, kgdb_set_proc_cmd, + "Set current process context"); + add_com ("tid", class_obscure, kgdb_set_tid_cmd, + "Set current thread context"); } diff --git a/gnu/usr.bin/gdb/kgdb/trgt_amd64.c b/gnu/usr.bin/gdb/kgdb/trgt_amd64.c index 788951a6e7..7f4b0a56f3 100644 --- a/gnu/usr.bin/gdb/kgdb/trgt_amd64.c +++ b/gnu/usr.bin/gdb/kgdb/trgt_amd64.c @@ -23,8 +23,7 @@ * (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: src/gnu/usr.bin/gdb/kgdb/trgt_amd64.c,v 1.6 2005/09/28 07:40:27 peter Exp $ - * $DragonFly: src/gnu/usr.bin/gdb/kgdb/trgt_amd64.c,v 1.2 2008/01/31 14:30:52 corecode Exp $ + * $FreeBSD: src/gnu/usr.bin/gdb/kgdb/trgt_amd64.c,v 1.10 2008/05/01 20:36:48 jhb Exp $ */ #include @@ -47,8 +46,13 @@ #include "kgdb.h" +static int +kgdb_trgt_trapframe_sniffer(const struct frame_unwind *self, + struct frame_info *next_frame, + void **this_prologue_cache); + void -kgdb_trgt_fetch_registers(struct regcache *regcache, int regno) +kgdb_trgt_fetch_registers(struct target_ops *target_ops, struct regcache *regcache, int regno) { struct kthr *kt; struct pcb pcb; @@ -112,12 +116,6 @@ kgdb_trgt_fetch_registers(struct regcache *regcache, int regno) regcache_raw_supply(regcache, AMD64_RIP_REGNUM, (char *)&pcb.pcb_rip); } -void -kgdb_trgt_store_registers(struct regcache *regcache, int regno __unused) -{ - fprintf_unfiltered(gdb_stderr, "XXX: %s\n", __func__); -} - struct kgdb_frame_cache { CORE_ADDR pc; CORE_ADDR sp; @@ -149,6 +147,7 @@ static int kgdb_trgt_frame_offset[20] = { static struct kgdb_frame_cache * kgdb_trgt_frame_cache(struct frame_info *next_frame, void **this_cache) { + enum bfd_endian byte_order = gdbarch_byte_order(get_frame_arch(next_frame)); char buf[MAX_REGISTER_SIZE]; struct kgdb_frame_cache *cache; @@ -159,7 +158,8 @@ kgdb_trgt_frame_cache(struct frame_info *next_frame, void **this_cache) cache->pc = get_frame_address_in_block(next_frame); frame_unwind_register(next_frame, AMD64_RSP_REGNUM, buf); cache->sp = extract_unsigned_integer(buf, - register_size(current_gdbarch, AMD64_RSP_REGNUM)); + register_size(get_frame_arch(next_frame), AMD64_RSP_REGNUM), + byte_order); } return (cache); } @@ -174,40 +174,33 @@ kgdb_trgt_trapframe_this_id(struct frame_info *next_frame, void **this_cache, *this_id = frame_id_build(cache->sp, cache->pc); } -static void +static struct value * kgdb_trgt_trapframe_prev_register(struct frame_info *next_frame, - void **this_cache, int regnum, int *optimizedp, enum lval_type *lvalp, - CORE_ADDR *addrp, int *realnump, void *valuep) + void **this_cache, int regnum) { - char dummy_valuep[MAX_REGISTER_SIZE]; + CORE_ADDR addrp; struct kgdb_frame_cache *cache; - int ofs, regsz; + int ofs; - regsz = register_size(current_gdbarch, regnum); + if (regnum < AMD64_RAX_REGNUM || regnum > AMD64_EFLAGS_REGNUM + 2) + return frame_unwind_got_register(next_frame, regnum, regnum); - if (valuep == NULL) - valuep = dummy_valuep; - memset(valuep, 0, regsz); - *optimizedp = 0; - *addrp = 0; - *lvalp = not_lval; - *realnump = -1; + ofs = kgdb_trgt_frame_offset[regnum]; cache = kgdb_trgt_frame_cache(next_frame, this_cache); - if (cache->pc == 0) - return; - - ofs = (regnum >= AMD64_RAX_REGNUM && regnum <= AMD64_EFLAGS_REGNUM + 2) - ? kgdb_trgt_frame_offset[regnum] : -1; - if (ofs == -1) - return; - *addrp = cache->sp + ofs; - *lvalp = lval_memory; - target_read_memory(*addrp, valuep, regsz); + addrp = cache->sp + ofs; + return frame_unwind_got_memory(next_frame, regnum, addrp); } -int +const struct frame_unwind kgdb_trgt_trapframe_unwind = { + NORMAL_FRAME, + &kgdb_trgt_trapframe_this_id, + &kgdb_trgt_trapframe_prev_register, + .sniffer = kgdb_trgt_trapframe_sniffer +}; + +static int kgdb_trgt_trapframe_sniffer(const struct frame_unwind *self, struct frame_info *next_frame, void **this_prologue_cache) @@ -215,21 +208,15 @@ kgdb_trgt_trapframe_sniffer(const struct frame_unwind *self, char *pname; CORE_ADDR pc; - pc = frame_unwind_address_in_block(next_frame, NORMAL_FRAME); + pc = get_frame_address_in_block(next_frame); pname = NULL; find_pc_partial_function(pc, &pname, NULL, NULL); if (pname == NULL) return (0); if (strcmp(pname, "calltrap") == 0 || strcmp(pname, "dblfault_handler") == 0 || - (pname[0] == 'X' && pname[1] == '_')) + strcmp(pname, "nmi_calltrap") == 0 || + (pname[0] == 'X' && pname[1] != '_')) return (1); return (0); } - -const struct frame_unwind kgdb_trgt_trapframe_unwind = { - NORMAL_FRAME, - &kgdb_trgt_trapframe_this_id, - &kgdb_trgt_trapframe_prev_register, - .sniffer = kgdb_trgt_trapframe_sniffer -}; diff --git a/gnu/usr.bin/gdb/kgdb/trgt_i386.c b/gnu/usr.bin/gdb/kgdb/trgt_i386.c index febd216686..f9dd0af1e9 100644 --- a/gnu/usr.bin/gdb/kgdb/trgt_i386.c +++ b/gnu/usr.bin/gdb/kgdb/trgt_i386.c @@ -23,8 +23,7 @@ * (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: src/gnu/usr.bin/gdb/kgdb/trgt_i386.c,v 1.5 2005/09/11 05:36:30 marcel Exp $ - * $DragonFly: src/gnu/usr.bin/gdb/kgdb/trgt_i386.c,v 1.6 2008/06/05 18:06:30 swildner Exp $ + * $FreeBSD: src/gnu/usr.bin/gdb/kgdb/trgt_i386.c,v 1.13 2008/09/27 15:58:37 kib Exp $ */ #include @@ -32,8 +31,11 @@ #include #include #include +#include #include #include +#include +#include #include #include #include @@ -48,8 +50,13 @@ #include "kgdb.h" +static int +kgdb_trgt_trapframe_sniffer(const struct frame_unwind *self, + struct frame_info *next_frame, + void **this_prologue_cache); + void -kgdb_trgt_fetch_registers(struct regcache *regcache, int regno) +kgdb_trgt_fetch_registers(struct target_ops *target_ops, struct regcache *regcache, int regno) { struct kthr *kt; struct pcb pcb; @@ -106,17 +113,132 @@ kgdb_trgt_fetch_registers(struct regcache *regcache, int regno) regcache_raw_supply(regcache, I386_EIP_REGNUM, (char *)&pcb.pcb_eip); } -void -kgdb_trgt_store_registers(struct regcache *regcache, int regno __unused) +struct kgdb_tss_cache { + CORE_ADDR pc; + CORE_ADDR sp; + CORE_ADDR tss; +}; + +static int kgdb_trgt_tss_offset[15] = { + offsetof(struct i386tss, tss_eax), + offsetof(struct i386tss, tss_ecx), + offsetof(struct i386tss, tss_edx), + offsetof(struct i386tss, tss_ebx), + offsetof(struct i386tss, tss_esp), + offsetof(struct i386tss, tss_ebp), + offsetof(struct i386tss, tss_esi), + offsetof(struct i386tss, tss_edi), + offsetof(struct i386tss, tss_eip), + offsetof(struct i386tss, tss_eflags), + offsetof(struct i386tss, tss_cs), + offsetof(struct i386tss, tss_ss), + offsetof(struct i386tss, tss_ds), + offsetof(struct i386tss, tss_es), + offsetof(struct i386tss, tss_fs) +}; + +/* + * If the current thread is executing on a CPU, fetch the common_tss + * for that CPU. + * + * This is painful because 'struct pcpu' is variant sized, so we can't + * use it. Instead, we lookup the GDT selector for this CPU and + * extract the base of the TSS from there. + */ +static CORE_ADDR +kgdb_trgt_fetch_tss(void) +{ + struct kthr *kt; + struct segment_descriptor sd; + uintptr_t addr, tss; + + kt = kgdb_thr_lookup_tid(ptid_get_tid(inferior_ptid)); + if (kt == NULL || kt->gd == 0) + return (0); + + addr = kt->gd + offsetof(struct mdglobaldata, gd_common_tssd); + if (kvm_read(kvm, addr, &sd, sizeof(sd)) != sizeof(sd)) { + warnx("kvm_read: %s", kvm_geterr(kvm)); + return (0); + } + if (sd.sd_type != SDT_SYS386BSY) { + warnx("descriptor is not a busy TSS"); + return (0); + } + tss = kt->gd + offsetof(struct mdglobaldata, gd_common_tss); + + return ((CORE_ADDR)tss); +} + +static struct kgdb_tss_cache * +kgdb_trgt_tss_cache(struct frame_info *next_frame, void **this_cache) +{ + struct gdbarch *gdbarch = get_frame_arch(next_frame); + enum bfd_endian byte_order = gdbarch_byte_order(gdbarch); + char buf[MAX_REGISTER_SIZE]; + struct kgdb_tss_cache *cache; + + cache = *this_cache; + if (cache == NULL) { + cache = FRAME_OBSTACK_ZALLOC(struct kgdb_tss_cache); + *this_cache = cache; + cache->pc = get_frame_address_in_block(next_frame); + frame_unwind_register(next_frame, I386_ESP_REGNUM, buf); + cache->sp = extract_unsigned_integer(buf, + register_size(gdbarch, I386_ESP_REGNUM), + byte_order); + cache->tss = kgdb_trgt_fetch_tss(); + } + return (cache); +} + +static void +kgdb_trgt_dblfault_this_id(struct frame_info *next_frame, void **this_cache, + struct frame_id *this_id) +{ + struct kgdb_tss_cache *cache; + + cache = kgdb_trgt_tss_cache(next_frame, this_cache); + *this_id = frame_id_build(cache->sp, cache->pc); +} + +static struct value * +kgdb_trgt_dblfault_prev_register(struct frame_info *next_frame, + void **this_cache, int regnum) { - fprintf_unfiltered(gdb_stderr, "XXX: %s\n", __func__); + CORE_ADDR addrp; + struct kgdb_tss_cache *cache; + int ofs; + + if (regnum < I386_EAX_REGNUM || regnum > I386_FS_REGNUM) + return frame_unwind_got_register(next_frame, regnum, regnum); + + ofs = kgdb_trgt_tss_offset[regnum]; + + cache = kgdb_trgt_tss_cache(next_frame, this_cache); + if (cache->tss == 0) + return frame_unwind_got_register(next_frame, regnum, regnum); + + addrp = cache->tss + ofs; + return frame_unwind_got_memory(next_frame, regnum, addrp); } +static const struct frame_unwind kgdb_trgt_dblfault_unwind = { + NORMAL_FRAME, + &kgdb_trgt_dblfault_this_id, + &kgdb_trgt_dblfault_prev_register, + .sniffer = kgdb_trgt_trapframe_sniffer +}; + struct kgdb_frame_cache { - int intrframe; + int frame_type; CORE_ADDR pc; CORE_ADDR sp; }; +#define FT_NORMAL 1 +#define FT_INTRFRAME 2 +/*#define FT_INTRTRAPFRAME 3*/ +#define FT_TIMERFRAME 4 static int kgdb_trgt_frame_offset[15] = { offsetof(struct trapframe, tf_eax), @@ -139,6 +261,7 @@ static int kgdb_trgt_frame_offset[15] = { static struct kgdb_frame_cache * kgdb_trgt_frame_cache(struct frame_info *next_frame, void **this_cache) { + enum bfd_endian byte_order = gdbarch_byte_order(get_frame_arch(next_frame)); char buf[MAX_REGISTER_SIZE]; struct kgdb_frame_cache *cache; char *pname; @@ -150,20 +273,23 @@ kgdb_trgt_frame_cache(struct frame_info *next_frame, void **this_cache) cache->pc = get_frame_address_in_block(next_frame); find_pc_partial_function(cache->pc, &pname, NULL, NULL); - /* - * Handle weird trapframe cases: - * - * 4 for pushed esp (IN the function!) - * + 8 for cpl/intno (IN the function, only intrs) - */ - cache->intrframe = 4; - if (pname[0] == 'X') - cache->intrframe += offsetof(struct intrframe, if_esp) - - offsetof(struct trapframe, tf_esp); + if (pname[0] != 'X') + cache->frame_type = FT_NORMAL; + else if (strcmp(pname, "Xtimerint") == 0) + cache->frame_type = FT_TIMERFRAME; + /* else if (strcmp(pname, "Xcpustop") == 0 || + strcmp(pname, "Xrendezvous") == 0 || + strcmp(pname, "Xipi_intr_bitmap_handler") == 0 || + strcmp(pname, "Xlazypmap") == 0) + cache->frame_type = FT_INTRTRAPFRAME; + */ + else + cache->frame_type = FT_INTRFRAME; frame_unwind_register(next_frame, I386_ESP_REGNUM, buf); cache->sp = extract_unsigned_integer(buf, - register_size(current_gdbarch, I386_ESP_REGNUM)); + register_size(get_frame_arch(next_frame), I386_ESP_REGNUM), + byte_order); } return (cache); } @@ -178,33 +304,42 @@ kgdb_trgt_trapframe_this_id(struct frame_info *next_frame, void **this_cache, *this_id = frame_id_build(cache->sp, cache->pc); } -static void +static struct value * kgdb_trgt_trapframe_prev_register(struct frame_info *next_frame, - void **this_cache, int regnum, int *optimizedp, enum lval_type *lvalp, - CORE_ADDR *addrp, int *realnump, gdb_byte *valuep) + void **this_cache, int regnum) { - char dummy_valuep[MAX_REGISTER_SIZE]; + CORE_ADDR addrp; struct kgdb_frame_cache *cache; - int ofs, regsz; - - regsz = register_size(current_gdbarch, regnum); - - if (valuep == NULL) - valuep = dummy_valuep; - memset(valuep, 0, regsz); - *optimizedp = 0; - *addrp = 0; - *lvalp = not_lval; - *realnump = -1; + int ofs; if (regnum < I386_EAX_REGNUM || regnum > I386_FS_REGNUM) - return; + return frame_unwind_got_register(next_frame, regnum, regnum); + + ofs = kgdb_trgt_frame_offset[regnum] + 4; cache = kgdb_trgt_frame_cache(next_frame, this_cache); + switch (cache->frame_type) { + case FT_NORMAL: + break; + case FT_INTRFRAME: + ofs += 4; + break; + case FT_TIMERFRAME: + break; + /* + case FT_INTRTRAPFRAME: + ofs -= ofs_fix; + break; + */ + default: + fprintf_unfiltered(gdb_stderr, "Correct FT_XXX frame offsets " + "for %d\n", cache->frame_type); + break; + } - ofs = kgdb_trgt_frame_offset[regnum]; - *addrp = cache->sp + ofs + cache->intrframe; + addrp = cache->sp + ofs; +#if 0 /* * If we are in the kernel, we don't have esp stored in the * trapframe, but we can calculate it simply by subtracting @@ -214,16 +349,22 @@ kgdb_trgt_trapframe_prev_register(struct frame_info *next_frame, char buf[4]; frame_unwind_register(next_frame, I386_CS_REGNUM, buf); - if (extract_unsigned_integer(buf, 4) != SEL_UPL) { - store_unsigned_integer(valuep, regsz, *addrp); - return; - } - /* FALLTHROUGH */ + if (extract_unsigned_integer(buf, 4, byte_order) != SEL_UPL) + return frame_unwind_got_address(next_frame, regnum, addrp); + /* else FALLTHROUGH */ } - *lvalp = lval_memory; - target_read_memory(*addrp, valuep, regsz); +#endif + + return frame_unwind_got_memory(next_frame, regnum, addrp); } +const struct frame_unwind kgdb_trgt_trapframe_unwind = { + NORMAL_FRAME, + &kgdb_trgt_trapframe_this_id, + &kgdb_trgt_trapframe_prev_register, + .sniffer = kgdb_trgt_trapframe_sniffer +}; + static int kgdb_trgt_trapframe_sniffer(const struct frame_unwind *self, struct frame_info *next_frame, @@ -232,22 +373,34 @@ kgdb_trgt_trapframe_sniffer(const struct frame_unwind *self, char *pname; CORE_ADDR pc; - pc = frame_unwind_address_in_block(next_frame, NORMAL_FRAME); + pc = get_frame_address_in_block(next_frame); pname = NULL; find_pc_partial_function(pc, &pname, NULL, NULL); if (pname == NULL) return (0); - if (strcmp(pname, "calltrap") == 0 || - strcmp(pname, "dblfault_handler") == 0 || - (pname[0] == 'X' && pname[1] != '_')) - return 1; + + /* + * This is a combined sniffer, since only the + * function names change. + */ + + /* + * If we're the sniffer for a trapframe, deal with + * all these function names. + */ + if (self == &kgdb_trgt_trapframe_unwind && + (strcmp(pname, "calltrap") == 0 || + (pname[0] == 'X' && pname[1] != '_'))) + return (1); + + /* + * If we're a double fault sniffer, only look for + * the double fault name. + */ + if(self == &kgdb_trgt_dblfault_unwind && + strcmp(pname, "dblfault_handler") == 0) + return (1); + /* printf("%s: %llx =%s\n", __func__, pc, pname); */ - return 0; + return (0); } - -const struct frame_unwind kgdb_trgt_trapframe_unwind = { - NORMAL_FRAME, - &kgdb_trgt_trapframe_this_id, - &kgdb_trgt_trapframe_prev_register, - .sniffer = kgdb_trgt_trapframe_sniffer -}; diff --git a/gnu/usr.bin/gdb/libbfd/Makefile b/gnu/usr.bin/gdb/libbfd/Makefile index fb759a64eb..bfbfafb29e 100644 --- a/gnu/usr.bin/gdb/libbfd/Makefile +++ b/gnu/usr.bin/gdb/libbfd/Makefile @@ -1,5 +1,3 @@ -# $DragonFly: src/gnu/usr.bin/gdb/libbfd/Makefile,v 1.4 2008/08/02 15:29:53 corecode Exp $ - .include "../Makefile.inc" LIB= bfd @@ -12,14 +10,14 @@ CFLAGS+= -I${BASEDIR}/include -I${CONTRIBDIR} -I${.CURDIR} -I${.OBJDIR} # XXX no clue what DEBUGDIR is for CFLAGS+= -DDEBUGDIR='"/usr/lib/debug"' -SRCS= archive.c archive64.c archures.c bfd.c bfdio.c bfdwin.c binary.c -SRCS+= cache.c coffgen.c cofflink.c corefile.c dwarf1.c dwarf2.c -SRCS+= elf-eh-frame.c elf-strtab.c elf.c elflink.c elf-attrs.c -SRCS+= format.c hash.c ihex.c init.c libbfd.c linker.c merge.c opncls.c -SRCS+= reloc.c section.c simple.c srec.c stab-syms.c stabs.c syms.c -SRCS+= targets.c tekhex.c +SRCS= archive.c archures.c bfd.c bfdio.c bfdwin.c \ + cache.c coffgen.c corefile.c format.c init.c libbfd.c \ + opncls.c reloc.c section.c syms.c targets.c hash.c \ + linker.c srec.c binary.c tekhex.c ihex.c stabs.c \ + stab-syms.c merge.c dwarf2.c simple.c compress.c \ + verilog.c -SRCS+= targmatch.h +SRCS+= targmatch.h elf32-target.h elf64-target.h CLEANFILES+= elf64-target.h elf32-target.h targmatch.h targmatch.h: config.bfd targmatch.sed @@ -35,10 +33,9 @@ TARGET_ARCH?= ${MACHINE_ARCH} .for _v in ${VECTORS} CFLAGS+= -DHAVE_${_v} -_select+= &${_v}, .endfor -CFLAGS+= -DSELECT_VECS='${_select}NULL' -CFLAGS+= -DSELECT_ARCHITECTURES='&${ARCHITECTURE}' +CFLAGS+= -DSELECT_VECS='${VECTORS:S/^/\&/:S/$/,/} NULL' +CFLAGS+= -DSELECT_ARCHITECTURES='${ARCHITECTURES:S/^/\&/:S/$/,/} NULL' CFLAGS+= -DDEFAULT_VECTOR=${DEFAULT_VECTOR} @@ -47,7 +44,6 @@ CLEANFILES+= bfd.h bfdver.h # Used to do keyword replacement in bfd-X.h # -BFD_ARCH_SIZE?=64 BFD_HOST_64_BIT_DEFINED?=1 BFD_HOST_LONG_LONG?=1 .include "Makefile.host.${MACHINE_ARCH}" @@ -67,9 +63,9 @@ bfd.h: ${CONTRIBDIR}/bfd-in2.h mv -f bfd.h.new bfd.h bfdver.h: ${CONTRIBDIR}/version.h - sed -e "s/@bfd_version_string@/\"2.18.50.20070907\"/g" \ + sed -e "s/@bfd_version_string@/\"2.20.51\"/g" \ -e "s/@bfd_version_package@/\"(GNU Binutils, GDB packaged)\"/g" \ - -e "s/@bfd_version@/218500000/g" \ + -e "s/@bfd_version@/220510000/g" \ < ${CONTRIBDIR}/version.h > bfdver.h.new mv -f bfdver.h.new bfdver.h diff --git a/gnu/usr.bin/gdb/libbfd/Makefile.amd64 b/gnu/usr.bin/gdb/libbfd/Makefile.amd64 index 8c568505ba..0116283f5d 100644 --- a/gnu/usr.bin/gdb/libbfd/Makefile.amd64 +++ b/gnu/usr.bin/gdb/libbfd/Makefile.amd64 @@ -1,16 +1,23 @@ -# $DragonFly: src/gnu/usr.bin/gdb/libbfd/Makefile.amd64,v 1.4 2008/08/02 15:29:53 corecode Exp $ +# from Makefile, BFD_BACKENDS/BFD_MACHINES +SRCS+= elf64-x86-64.c elf-ifunc.c elf64.c elf.c elflink.c elf-attrs.c \ + elf-strtab.c elf-eh-frame.c dwarf1.c elf32-i386.c elf-vxworks.c \ + elf32.c elf64-gen.c elf32-gen.c +SRCS+= cpu-i386.c cpu-l1om.c -.include "${.CURDIR}/Makefile.i386" - -SRCS+= elf32-gen.c elf32.c elf32-target.h -SRCS+= coff-i386.c cpu-i386.c elf32-i386.c -SRCS+= elf64-gen.c elf64.c elf64-x86-64.c elf64-target.h +# BFD64_LIBS +SRCS+= archive64.c VECTORS= bfd_elf64_x86_64_vec \ + bfd_elf32_i386_vec \ + bfd_elf64_l1om_vec \ bfd_elf64_little_generic_vec \ bfd_elf64_big_generic_vec \ - ${DEFAULT_VECTOR} + bfd_elf32_little_generic_vec \ + bfd_elf32_big_generic_vec DEFAULT_VECTOR= bfd_elf64_x86_64_vec +ARCHITECTURES= bfd_i386_arch bfd_l1om_arch + BFD_DEFAULT_TARGET_SIZE?= 64 +BFD_ARCH_SIZE= 64 diff --git a/gnu/usr.bin/gdb/libbfd/Makefile.host.amd64 b/gnu/usr.bin/gdb/libbfd/Makefile.host.amd64 index c5c9362382..0604dde437 100644 --- a/gnu/usr.bin/gdb/libbfd/Makefile.host.amd64 +++ b/gnu/usr.bin/gdb/libbfd/Makefile.host.amd64 @@ -1,9 +1,8 @@ -# $DragonFly: src/gnu/usr.bin/gdb/libbfd/Makefile.host.amd64,v 1.1 2008/07/28 22:33:21 corecode Exp $ - # Used to do keyword replacement in bfd-X.h # BFD_HOST_64BIT_LONG?=1 BFD_HOST_64BIT_LONG_LONG?=0 -BFD_HOST_64_BIT?=long long -BFD_HOST_U_64_BIT?=unsigned long long +BFD_HOST_64_BIT?=long +BFD_HOST_U_64_BIT?=unsigned long BFD_HOSTPTR_T?=unsigned long +BFD_ARCH_SIZE=64 diff --git a/gnu/usr.bin/gdb/libbfd/Makefile.host.i386 b/gnu/usr.bin/gdb/libbfd/Makefile.host.i386 index e2869326e9..044ae550b5 100644 --- a/gnu/usr.bin/gdb/libbfd/Makefile.host.i386 +++ b/gnu/usr.bin/gdb/libbfd/Makefile.host.i386 @@ -1,11 +1,7 @@ -# $DragonFly: src/gnu/usr.bin/gdb/libbfd/Makefile.host.i386,v 1.1 2008/07/28 22:33:21 corecode Exp $ - # Used to do keyword replacement in bfd-X.h # BFD_HOST_64BIT_LONG?=0 -# While in theory long long is 64bit, the currently packaged bfd -# fails to use it properly. -BFD_HOST_64BIT_LONG_LONG?=0 +BFD_HOST_64BIT_LONG_LONG?=1 BFD_HOST_64_BIT?=long long BFD_HOST_U_64_BIT?=unsigned long long BFD_HOSTPTR_T?=unsigned long diff --git a/gnu/usr.bin/gdb/libbfd/Makefile.i386 b/gnu/usr.bin/gdb/libbfd/Makefile.i386 index ef98cb61a4..069ec5e082 100644 --- a/gnu/usr.bin/gdb/libbfd/Makefile.i386 +++ b/gnu/usr.bin/gdb/libbfd/Makefile.i386 @@ -1,15 +1,17 @@ -# $DragonFly: src/gnu/usr.bin/gdb/libbfd/Makefile.i386,v 1.4 2008/08/02 15:29:53 corecode Exp $ +# from Makefile, BFD_BACKENDS/BFD_MACHINES +SRCS+= elf32-i386.c elf-ifunc.c elf-vxworks.c elf32.c elf.c \ + elflink.c elf-attrs.c elf-strtab.c elf-eh-frame.c dwarf1.c elf32-gen.c +SRCS+= cpu-i386.c -SRCS+= elf32-gen.c elf32.c elf32-target.h -SRCS+= coff-i386.c cpu-i386.c elf32-i386.c +SRCS+= elf32-target.h VECTORS= bfd_elf32_i386_vec \ - i386coff_vec \ bfd_elf32_little_generic_vec \ bfd_elf32_big_generic_vec DEFAULT_VECTOR= bfd_elf32_i386_vec -ARCHITECTURE= bfd_i386_arch +ARCHITECTURES= bfd_i386_arch BFD_DEFAULT_TARGET_SIZE?= 32 +BFD_ARCH_SIZE?= 32 diff --git a/gnu/usr.bin/gdb/libbfd/config.h b/gnu/usr.bin/gdb/libbfd/config.h index ac123cbea6..f6e896c874 100644 --- a/gnu/usr.bin/gdb/libbfd/config.h +++ b/gnu/usr.bin/gdb/libbfd/config.h @@ -1,11 +1,13 @@ -/* $DragonFly: src/gnu/usr.bin/gdb/libbfd/config.h,v 1.2 2008/01/14 21:36:38 corecode Exp $ */ -/* config.h. Generated by configure. */ +/* config.h. Generated from config.in by configure. */ /* config.in. Generated from configure.in by autoheader. */ /* Define to 1 if translation of program messages to the user's native language is requested. */ /* #undef ENABLE_NLS */ +/* Define to 1 if you have the header file. */ +/* #undef HAVE_ALLOCA_H */ + /* Define to 1 if you have the declaration of `basename', and to 0 if you don't. */ #define HAVE_DECL_BASENAME 0 @@ -51,7 +53,7 @@ /* Define to 1 if you have the declaration of `stpcpy', and to 0 if you don't. */ -#define HAVE_DECL_STPCPY 0 +#define HAVE_DECL_STPCPY 1 /* Define to 1 if you have the declaration of `strstr', and to 0 if you don't. */ @@ -77,6 +79,9 @@ /* Define to 1 if you have the `fdopen' function. */ #define HAVE_FDOPEN 1 +/* Define to 1 if you have the `fileno' function. */ +#define HAVE_FILENO 1 + /* Define to 1 if you have the `fopen64' function. */ /* #undef HAVE_FOPEN64 */ @@ -223,6 +228,9 @@ /* Define if has win32_pstatus_t. */ /* #undef HAVE_WIN32_PSTATUS_T */ +/* Define to 1 if you have the header file. */ +#define HAVE_ZLIB_H 1 + /* Define to the sub-directory in which libtool stores uninstalled libraries. */ #define LT_OBJDIR ".libs/" @@ -242,32 +250,44 @@ /* Define to the one symbol short name of this package. */ #define PACKAGE_TARNAME "" +/* Define to the home page for this package. */ +#define PACKAGE_URL "" + /* Define to the version of this package. */ #define PACKAGE_VERSION "" -/* The size of a `char', as computed by sizeof. */ +/* The size of `char', as computed by sizeof. */ /* #undef SIZEOF_CHAR */ -/* The size of a `int', as computed by sizeof. */ +/* The size of `int', as computed by sizeof. */ /* #undef SIZEOF_INT */ -/* The size of a `long', as computed by sizeof. */ +/* The size of `long', as computed by sizeof. */ +#if defined(__i386__) #define SIZEOF_LONG 4 +#elif defined(__amd64__) +#define SIZEOF_LONG 8 +#else +#error Unsupported platform +#endif -/* The size of a `long long', as computed by sizeof. */ +/* The size of `long long', as computed by sizeof. */ #define SIZEOF_LONG_LONG 8 -/* The size of a `off_t', as computed by sizeof. */ +/* The size of `off_t', as computed by sizeof. */ #define SIZEOF_OFF_T 8 -/* The size of a `short', as computed by sizeof. */ +/* The size of `short', as computed by sizeof. */ /* #undef SIZEOF_SHORT */ -/* The size of a `void *', as computed by sizeof. */ -/* #undef SIZEOF_VOID_P */ - -/* The sizeof of a 'void *', as computed by sizeof. */ -/* #undef SIZEOF_VOID_P */ +/* The size of `void *', as computed by sizeof. */ +#if defined(__i386__) +#define SIZEOF_VOID_P 4 +#elif defined(__amd64__) +#define SIZEOF_VOID_P 8 +#else +#error Unsupported platform +#endif /* Define to 1 if you have the ANSI C header files. */ #define STDC_HEADERS 1 @@ -290,10 +310,46 @@ /* Define if we should default to creating read-only plt entries */ /* #undef USE_SECUREPLT */ -/* Version number of package */ -#define VERSION "2.18.50" +/* Define if we may generate symbols with ELF's STT_COMMON type */ +/* #undef USE_STT_COMMON */ +/* Enable extensions on AIX 3, Interix. */ +#ifndef _ALL_SOURCE +# define _ALL_SOURCE 1 +#endif /* Enable GNU extensions on systems that have them. */ #ifndef _GNU_SOURCE # define _GNU_SOURCE 1 #endif +/* Enable threading extensions on Solaris. */ +#ifndef _POSIX_PTHREAD_SEMANTICS +# define _POSIX_PTHREAD_SEMANTICS 1 +#endif +/* Enable extensions on HP NonStop. */ +#ifndef _TANDEM_SOURCE +# define _TANDEM_SOURCE 1 +#endif +/* Enable general extensions on Solaris. */ +#ifndef __EXTENSIONS__ +# define __EXTENSIONS__ 1 +#endif + + +/* Version number of package */ +#define VERSION "2.20.51" + +/* Number of bits in a file offset, on hosts where this is settable. */ +/* #undef _FILE_OFFSET_BITS */ + +/* Define for large files, on AIX-style hosts. */ +/* #undef _LARGE_FILES */ + +/* Define to 1 if on MINIX. */ +/* #undef _MINIX */ + +/* Define to 2 if the system does not provide POSIX.1 features except with + this defined. */ +/* #undef _POSIX_1_SOURCE */ + +/* Define to 1 if you need to in order for `stat' and other things to work. */ +/* #undef _POSIX_SOURCE */ diff --git a/gnu/usr.bin/gdb/libdecnumber/Makefile b/gnu/usr.bin/gdb/libdecnumber/Makefile new file mode 100644 index 0000000000..145a3e864b --- /dev/null +++ b/gnu/usr.bin/gdb/libdecnumber/Makefile @@ -0,0 +1,18 @@ +.include "../Makefile.inc" + +LIB= decnumber +INTERNALLIB= YES + +SRCS= decNumber.c decContext.c decimal32.c decimal64.c decimal128.c + +.PATH: ${BASEDIR}/libdecnumber ${BASEDIR}/libdecnumber/dpd + +CFLAGS+= -I${.CURDIR} -I${.OBJDIR} -I${BASEDIR}/libdecnumber + +beforedepend: gstdint.h +gstdint.h: + echo "#include " > ${.TARGET} + +CLEANFILES+= gstdint.h + +.include diff --git a/gnu/usr.bin/gdb/libdecnumber/config.h b/gnu/usr.bin/gdb/libdecnumber/config.h new file mode 100644 index 0000000000..5286d3f984 --- /dev/null +++ b/gnu/usr.bin/gdb/libdecnumber/config.h @@ -0,0 +1,95 @@ +/* config.h. Generated from config.in by configure. */ +/* config.in. Generated from configure.ac by autoheader. */ + +/* Define if building universal (internal helper macro) */ +/* #undef AC_APPLE_UNIVERSAL_BUILD */ + +/* Define to 1 if you have the header file. */ +#define HAVE_CTYPE_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_INTTYPES_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_MEMORY_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_STDDEF_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_STDINT_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_STDIO_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_STDLIB_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_STRINGS_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_STRING_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_SYS_STAT_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_SYS_TYPES_H 1 + +/* Define to 1 if you have the header file. */ +#define HAVE_UNISTD_H 1 + +/* Define to the address where bug reports for this package should be sent. */ +#define PACKAGE_BUGREPORT "gcc-bugs@gcc.gnu.org" + +/* Define to the full name of this package. */ +#define PACKAGE_NAME "libdecnumber" + +/* Define to the full name and version of this package. */ +#define PACKAGE_STRING "libdecnumber " + +/* Define to the one symbol short name of this package. */ +#define PACKAGE_TARNAME "libdecnumber" + +/* Define to the home page for this package. */ +#define PACKAGE_URL "" + +/* Define to the version of this package. */ +#define PACKAGE_VERSION " " + +/* The size of `char', as computed by sizeof. */ +/* #undef SIZEOF_CHAR */ + +/* The size of `int', as computed by sizeof. */ +/* #define SIZEOF_INT 4 */ + +/* The size of `long', as computed by sizeof. */ +/* #define SIZEOF_LONG 4 */ + +/* The size of `short', as computed by sizeof. */ +/* #undef SIZEOF_SHORT */ + +/* The size of `void *', as computed by sizeof. */ +/* #undef SIZEOF_VOID_P */ + +/* Define to 1 if you have the ANSI C header files. */ +#define STDC_HEADERS 1 + +/* Define WORDS_BIGENDIAN to 1 if your processor stores words with the most + significant byte first (like Motorola and SPARC, unlike Intel). */ +#if defined AC_APPLE_UNIVERSAL_BUILD +# if defined __BIG_ENDIAN__ +# define WORDS_BIGENDIAN 1 +# endif +#else +# ifndef WORDS_BIGENDIAN +/* # undef WORDS_BIGENDIAN */ +# endif +#endif + +/* Define to empty if `const' does not conform to ANSI C. */ +/* #undef const */ + +/* Define to `long int' if does not define. */ +/* #undef off_t */ diff --git a/gnu/usr.bin/gdb/libgdb/Makefile b/gnu/usr.bin/gdb/libgdb/Makefile index 9083c200bf..7167e658c8 100644 --- a/gnu/usr.bin/gdb/libgdb/Makefile +++ b/gnu/usr.bin/gdb/libgdb/Makefile @@ -1,5 +1,3 @@ -# $DragonFly: src/gnu/usr.bin/gdb/libgdb/Makefile,v 1.9 2008/07/30 01:48:14 corecode Exp $ - .include "../Makefile.inc" TARGET_ARCH?= ${MACHINE_ARCH} @@ -8,31 +6,38 @@ LIB= gdb INTERNALLIB= # yes CONTRIBDIR= ${BASEDIR}/gdb -.PATH: ${CONTRIBDIR} ${CONTRIBDIR}/cli ${CONTRIBDIR}/mi ${CONTRIBDIR}/signals +.PATH: ${CONTRIBDIR} ${CONTRIBDIR}/cli ${CONTRIBDIR}/mi +.PATH: ${CONTRIBDIR}/common ${CONTRIBDIR}/python ${CONTRIBDIR}/features .PATH: ${CONTRIBDIR}/tui +VERSION!= cat ${CONTRIBDIR}/version.in + CFLAGS+= -I${.OBJDIR} -I${.CURDIR} -I${BASEDIR}/include -I${BASEDIR}/bfd -CFLAGS+= -I${CONTRIBDIR} -I${CONTRIBDIR}/config -I${.CURDIR}/../libbfd -I${.OBJDIR}/../libbfd +CFLAGS+= -I${CONTRIBDIR} -I${CONTRIBDIR}/config -I${CONTRIBDIR}/common +CFLAGS+= -I${BASEDIR}/libdecnumber +CFLAGS+= -I${.CURDIR}/../libbfd -I${.OBJDIR}/../libbfd CFLAGS+= -I${BASEDIR} -CFLAGS+= -DTARGET_SYSTEM_ROOT='"/"' -DBINDIR='"/usr/bin"' +CFLAGS+= -DTARGET_SYSTEM_ROOT='"/"' -DTARGET_SYSTEM_ROOT_RELOCATABLE=0 +CFLAGS+= -DBINDIR='"/usr/bin"' CFLAGS+= -DMACHINE_ARCH='"${MACHINE_ARCH}"' CFLAGS+= -DTARGET_ARCH='"${TARGET_ARCH}"' +CFLAGS+= -DVERSION_STRING='"${VERSION}"' -CLEANFILES+= observer.h observer.inc gdb_stdint.h - -SRCS+= observer.h gdb_stdint.h +SRCS+= observer.h gdb_stdint.h gstdint.h # The order of these sources is important, # because init.c below needs to obey a certain ordering # of function calls. # COMMON_OBS -SRCS+= version.c \ +SRCS+= \ + version.c \ annotate.c \ + addrmap.c \ auxv.c \ bfd-target.c \ blockframe.c breakpoint.c findvar.c regcache.c \ - charset.c disasm.c dummy-frame.c \ + charset.c disasm.c dummy-frame.c dfp.c \ source.c value.c eval.c valops.c valarith.c valprint.c printcmd.c \ block.c symtab.c symfile.c symmisc.c linespec.c dictionary.c \ infcall.c \ @@ -46,14 +51,16 @@ SRCS+= version.c \ event-loop.c event-top.c inf-loop.c completer.c \ gdbarch.c arch-utils.c gdbtypes.c osabi.c copying.c \ memattr.c mem-break.c target.c parse.c language.c buildsym.c \ + findcmd.c \ std-regs.c \ signals.c \ - gdb-events.c \ - exec.c bcache.c objfiles.c observer.c minsyms.c maint.c demangle.c \ + exec.c reverse.c \ + bcache.c objfiles.c observer.c minsyms.c maint.c demangle.c \ dbxread.c coffread.c coff-pe-read.c \ dwarf2read.c mipsread.c stabsread.c corefile.c \ dwarf2expr.c dwarf2loc.c dwarf2-frame.c \ ada-lang.c c-lang.c f-lang.c objc-lang.c \ + ada-tasks.c \ ui-out.c cli-out.c \ varobj.c vec.c wrapper.c \ jv-lang.c jv-valprint.c jv-typeprint.c \ @@ -68,14 +75,17 @@ SRCS+= version.c \ user-regs.c \ frame.c frame-unwind.c doublest.c \ frame-base.c \ + inline-frame.c \ gnu-v2-abi.c gnu-v3-abi.c cp-abi.c cp-support.c \ cp-namespace.c \ reggroups.c regset.c \ trad-frame.c \ tramp-frame.c \ solib.c solib-null.c \ - prologue-value.c memory-map.c \ - target-descriptions.c target-memory.c xml-tdesc.c + prologue-value.c memory-map.c xml-support.c xml-syscall.c \ + target-descriptions.c target-memory.c xml-tdesc.c xml-builtin.c \ + inferior.c osdata.c gdb_usleep.c record.c \ + jit.c # TSOBS SRCS+= inflow.c @@ -83,30 +93,24 @@ SRCS+= inflow.c # SER_HARDWIRE SRCS+= ser-base.c ser-unix.c ser-pipe.c ser-tcp.c -# TDEPFILES (part 1, the other is in Makefile.ARCH) -SRCS+= bsd-uthread.c corelow.c solib-svr4.c - -# NATDEPFILES (part 1, the other is in Makefile.ARCH) -SRCS+= fork-child.c inf-ptrace.c gcore.c fbsd-nat.c - # REMOTE_OBS SRCS+= remote.c dcache.c tracepoint.c ax-general.c ax-gdb.c remote-fileio.c # SUBDIR_CLI_OBS SRCS+= cli-dump.c \ - cli-decode.c cli-script.c cli-cmds.c cli-setshow.c cli-utils.c \ + cli-decode.c cli-script.c cli-cmds.c cli-setshow.c \ cli-logging.c \ cli-interp.c # SUBDIR_MI_OBS SRCS+= mi-out.c mi-console.c \ mi-cmds.c mi-cmd-env.c mi-cmd-var.c mi-cmd-break.c mi-cmd-stack.c \ - mi-cmd-file.c mi-cmd-disas.c mi-symbol-cmds.c \ + mi-cmd-file.c mi-cmd-disas.c mi-symbol-cmds.c mi-cmd-target.c \ mi-interp.c \ mi-main.c mi-parse.c mi-getopt.c mi-common.c # CONFIG_OBS -SRCS+= elfread.c posix-hdep.c +SRCS+= python.c py-value.c py-prettyprint.c elfread.c posix-hdep.c # SUBDIR_TUI_OBS SRCS+= tui-command.c \ @@ -136,13 +140,15 @@ SRCS+= c-exp.y \ SRCS+= init.c +XMLFILES= gdb-target.dtd xinclude.dtd library-list.dtd osdata.dtd + # kernel-debugger #SRCS+= freebsd-uthread.c #SRCS+= kthr.c trgt.c trgt_${MACHINE_ARCH}.c DPADD= ${LIBEDIT} ${LIBKVM} ${LIBTERMCAP} ${LIBM} DPADD+= ../libbfd/libbfd.a ../libopcodes/libopcodes.a ../libiberty/libiberty.a -LDADD= -ledit -lkvm -ltermcap -lm +LDADD= -ledit -ltermcap -lm LDADD+= -L../libbfd -lbfd -L../libopcodes -lopcodes -L../libiberty -liberty .include "Makefile.${TARGET_ARCH}" @@ -159,6 +165,11 @@ init.c: ${SRCS:Ninit.c} Makefile CLEANFILES+= init.c +xml-builtin.c: feature_to_c.sh ${XMLFILES} + sh ${CONTRIBDIR}/features/feature_to_c.sh ${.TARGET} ${.ALLSRC:M*.dtd} + +CLEANFILES+= xml-builtin.c + # observer.inc can't be included in SRCS, it would duplicate the entry in OBJS observer.h: observer.sh observer.inc doc/observer.texi sh ${CONTRIBDIR}/observer.sh h ${CONTRIBDIR}/doc/observer.texi ${.TARGET} @@ -168,4 +179,10 @@ observer.inc: observer.sh doc/observer.texi gdb_stdint.h: touch ${.TARGET} +gstdint.h: + echo '#include ' > ${.TARGET} + +CLEANFILES+= observer.h observer.inc gdb_stdint.h gstdint.h + + .include diff --git a/gnu/usr.bin/gdb/libgdb/Makefile.amd64 b/gnu/usr.bin/gdb/libgdb/Makefile.amd64 index ede4d20bd2..d9b034d215 100644 --- a/gnu/usr.bin/gdb/libgdb/Makefile.amd64 +++ b/gnu/usr.bin/gdb/libgdb/Makefile.amd64 @@ -1,10 +1,10 @@ -# $DragonFly: src/gnu/usr.bin/gdb/libgdb/Makefile.amd64,v 1.6 2008/07/28 22:33:21 corecode Exp $ - -# TDEPFILES (part 2, cleaned) -SRCS+= amd64-tdep.c amd64fbsd-tdep.c \ - i386-tdep.c i387-tdep.c i386bsd-tdep.c i386fbsd-tdep.c +SRCS+= amd64-tdep.c amd64dfly-tdep.c i386-tdep.c i387-tdep.c i386bsd-tdep.c \ + i386fbsd-tdep.c i386dfly-tdep.c bsd-uthread.c corelow.c \ + solib.c solib-svr4.c .if ${TARGET_ARCH} == ${MACHINE_ARCH} -# NATDEPFILES (part 2) -SRCS+= amd64-nat.c amd64bsd-nat.c amd64fbsd-nat.c +# NATDEPFILES +SRCS+= fork-child.c inf-ptrace.c \ + fbsd-nat.c amd64-nat.c amd64bsd-nat.c amd64dfly-nat.c \ + gcore.c .endif diff --git a/gnu/usr.bin/gdb/libgdb/Makefile.i386 b/gnu/usr.bin/gdb/libgdb/Makefile.i386 index b0c34f4b86..b5a07a9077 100644 --- a/gnu/usr.bin/gdb/libgdb/Makefile.i386 +++ b/gnu/usr.bin/gdb/libgdb/Makefile.i386 @@ -1,15 +1,10 @@ -# $DragonFly: src/gnu/usr.bin/gdb/libgdb/Makefile.i386,v 1.7 2008/07/28 22:33:21 corecode Exp $ - -# TDEPFILES (part 2, cleaned) -SRCS+= i386-tdep.c i387-tdep.c i386bsd-tdep.c i386fbsd-tdep.c +# TARGET_OBS +SRCS+= i386-tdep.c i387-tdep.c i386bsd-tdep.c i386fbsd-tdep.c i386dfly-tdep.c \ + bsd-uthread.c corelow.c solib.c solib-svr4.c .if ${TARGET_ARCH} == ${MACHINE_ARCH} -# NATDEPFILES (part 2) -SRCS+= fbsd-nat.c i386-nat.c i386bsd-nat.c i386fbsd-nat.c +# NATDEPFILES +SRCS+= fork-child.c inf-ptrace.c \ + fbsd-nat.c i386-nat.c i386bsd-nat.c i386dfly-nat.c \ + gcore.c .endif - -SRCS+= nm.h -CLEANFILES+= nm.h -CFLAGS+= -DGDB_NM_FILE -nm.h: - echo '#include "i386/nm-fbsd.h"' > ${.TARGET} diff --git a/gnu/usr.bin/gdb/libgdb/config.h b/gnu/usr.bin/gdb/libgdb/config.h index 5987158f7b..e478c560a8 100644 --- a/gnu/usr.bin/gdb/libgdb/config.h +++ b/gnu/usr.bin/gdb/libgdb/config.h @@ -1,7 +1,24 @@ -/* $DragonFly: src/gnu/usr.bin/gdb/libgdb/config.h,v 1.4 2008/08/29 22:15:03 dillon Exp $ */ -/* config.h. Generated by configure. */ +/* config.h. Generated from config.in by configure. */ /* config.in. Generated from configure.ac by autoheader. */ +/* Define if building universal (internal helper macro) */ +/* #undef AC_APPLE_UNIVERSAL_BUILD */ + +/* Define to the number of bits in type 'ptrdiff_t'. */ +/* #undef BITSIZEOF_PTRDIFF_T */ + +/* Define to the number of bits in type 'sig_atomic_t'. */ +/* #undef BITSIZEOF_SIG_ATOMIC_T */ + +/* Define to the number of bits in type 'size_t'. */ +/* #undef BITSIZEOF_SIZE_T */ + +/* Define to the number of bits in type 'wchar_t'. */ +/* #undef BITSIZEOF_WCHAR_T */ + +/* Define to the number of bits in type 'wint_t'. */ +/* #undef BITSIZEOF_WINT_T */ + /* Define to 1 if the compiler supports long long. */ #define CC_HAS_LONG_LONG 1 @@ -13,10 +30,11 @@ /* Define to 1 if using `alloca.c'. */ /* #undef C_ALLOCA */ -/* Global directory for separate debug files. */ +/* look for global separate debug info in this path [LIBDIR/debug] */ #define DEBUGDIR "/usr/lib/debug" -/* Define if the debug directory should be relocated when GDB is moved. */ +/* Define if the separate-debug-dir directory should be relocated when GDB is + moved. */ #define DEBUGDIR_RELOCATABLE 1 /* Define to BFD's default architecture. */ @@ -31,8 +49,15 @@ language is requested. */ /* #undef ENABLE_NLS */ +/* look for global separate data files in this path [DATADIR/gdb] */ +#define GDB_DATADIR "/usr/share/gdb" + +/* Define if the gdb-datadir directory should be relocated when GDB is moved. + */ +#define GDB_DATADIR_RELOCATABLE 1 + /* Define to be a string naming the default host character set. */ -#define GDB_DEFAULT_HOST_CHARSET "ISO-8859-1" +#define GDB_DEFAULT_HOST_CHARSET "UTF-8" /* Host double floatformat */ #define GDB_HOST_DOUBLE_FORMAT &floatformat_ieee_double_little @@ -44,16 +69,10 @@ #define GDB_HOST_LONG_DOUBLE_FORMAT &floatformat_i387_ext /* nativefile */ -/* #define GDB_NM_FILE "config/i386/nm-fbsd.h" defined via CFLAGS! */ +/* #undef GDB_NM_FILE */ /* Define to the default OS ABI for this configuration. */ -/* #undef GDB_OSABI_DEFAULT */ - -/* targetfile */ -/* #undef GDB_TM_FILE */ - -/* hostfile */ -/* #undef GDB_XM_FILE */ +#define GDB_OSABI_DEFAULT GDB_OSABI_DRAGONFLY /* Define to 1 if you have `alloca', as a function or macro. */ #define HAVE_ALLOCA 1 @@ -62,6 +81,12 @@ */ /* #undef HAVE_ALLOCA_H */ +/* Define to 1 if you have the header file. */ +/* #undef HAVE_BP_SYM_H */ + +/* Define to 1 if you have the `btowc' function. */ +#define HAVE_BTOWC 1 + /* Define to 1 if you have the `canonicalize_file_name' function. */ /* #undef HAVE_CANONICALIZE_FILE_NAME */ @@ -74,6 +99,10 @@ /* Define to 1 if you have the header file. */ #define HAVE_CURSES_H 1 +/* Define to 1 if you have the declaration of `ADDR_NO_RANDOMIZE', and to 0 if + you don't. */ +#define HAVE_DECL_ADDR_NO_RANDOMIZE 0 + /* Define to 1 if you have the declaration of `free', and to 0 if you don't. */ #define HAVE_DECL_FREE 1 @@ -86,6 +115,10 @@ */ #define HAVE_DECL_MALLOC 1 +/* Define to 1 if you have the declaration of `memmem', and to 0 if you don't. + */ +#define HAVE_DECL_MEMMEM 1 + /* Define to 1 if you have the declaration of `ptrace', and to 0 if you don't. */ #define HAVE_DECL_PTRACE 1 @@ -117,6 +150,12 @@ /* Define if ELF support should be included. */ #define HAVE_ELF 1 +/* Define to 1 if you have the header file. */ +/* #undef HAVE_ELF_HP_H */ + +/* Define to 1 if your system has the etext variable. */ +#define HAVE_ETEXT 1 + /* Define to 1 if you have the `fork' function. */ #define HAVE_FORK 1 @@ -147,18 +186,42 @@ /* Define if you have the iconv() function. */ #define HAVE_ICONV 1 +/* Define to 1 if you have the `iconvlist' function. */ +/* #undef HAVE_ICONVLIST */ + +/* Define if your compiler supports the #include_next directive. */ +#define HAVE_INCLUDE_NEXT 1 + /* Define to 1 if you have the header file. */ #define HAVE_INTTYPES_H 1 +/* Define if you have and nl_langinfo(CODESET). */ +#define HAVE_LANGINFO_CODESET 1 + +/* Define if your file defines LC_MESSAGES. */ +#define HAVE_LC_MESSAGES 1 + /* Define to 1 if you have the `dl' library (-ldl). */ /* #undef HAVE_LIBDL */ /* Define if you have the expat library. */ /* #undef HAVE_LIBEXPAT */ +/* Define to 1 if you have the `libiconvlist' function. */ +/* #undef HAVE_LIBICONVLIST */ + /* Define to 1 if you have the `m' library (-lm). */ #define HAVE_LIBM 1 +/* Define if Python 2.4 is being used. */ +/* #undef HAVE_LIBPYTHON2_4 */ + +/* Define if Python 2.5 is being used. */ +/* #undef HAVE_LIBPYTHON2_5 */ + +/* Define if Python 2.6 is being used. */ +/* #undef HAVE_LIBPYTHON2_6 */ + /* Define if libunwind library is being used. */ /* #undef HAVE_LIBUNWIND */ @@ -174,15 +237,27 @@ /* Define to 1 if you have the header file. */ #define HAVE_LINK_H 1 +/* Define to 1 if you have the header file. */ +#define HAVE_LOCALE_H 1 + /* Define to 1 if the compiler supports long double. */ #define HAVE_LONG_DOUBLE 1 +/* Define to 1 if the system has the type `long long int'. */ +#define HAVE_LONG_LONG_INT 1 + /* Define if has lwpid_t. */ #define HAVE_LWPID_T 1 /* Define to 1 if you have the header file. */ #define HAVE_MACHINE_REG_H 1 +/* Define to 1 if you have the `memchr' function. */ +#define HAVE_MEMCHR 1 + +/* Define to 1 if you have the `memmem' function. */ +#define HAVE_MEMMEM 1 + /* Define to 1 if you have the header file. */ #define HAVE_MEMORY_H 1 @@ -207,6 +282,12 @@ /* Define to 1 if you have the header file. */ #define HAVE_NLIST_H 1 +/* Define if you support the personality syscall. */ +/* #undef HAVE_PERSONALITY */ + +/* Define to 1 if you have the `pipe' function. */ +#define HAVE_PIPE 1 + /* Define to 1 if you have the `poll' function. */ #define HAVE_POLL 1 @@ -270,18 +351,27 @@ /* Define if sys/ptrace.h defines the PT_GETXMMREGS request. */ /* #undef HAVE_PT_GETXMMREGS */ +/* Define if Python interpreter is being linked in. */ +/* #undef HAVE_PYTHON */ + /* Define to 1 if you have the `realpath' function. */ #define HAVE_REALPATH 1 /* Define to 1 if you have the `sbrk' function. */ #define HAVE_SBRK 1 +/* Define to 1 if you have the `setlocale' function. */ +#define HAVE_SETLOCALE 1 + /* Define to 1 if you have the `setpgid' function. */ #define HAVE_SETPGID 1 /* Define to 1 if you have the `setpgrp' function. */ #define HAVE_SETPGRP 1 +/* Define to 1 if you have the `setsid' function. */ +#define HAVE_SETSID 1 + /* Define to 1 if you have the header file. */ #define HAVE_SGTTY_H 1 @@ -291,6 +381,15 @@ /* Define to 1 if you have the header file. */ #define HAVE_SIGNAL_H 1 +/* Define to 1 if 'sig_atomic_t' is a signed integer type. */ +/* #undef HAVE_SIGNED_SIG_ATOMIC_T */ + +/* Define to 1 if 'wchar_t' is a signed integer type. */ +/* #undef HAVE_SIGNED_WCHAR_T */ + +/* Define to 1 if 'wint_t' is a signed integer type. */ +/* #undef HAVE_SIGNED_WINT_T */ + /* Define to 1 if you have the `sigprocmask' function. */ #define HAVE_SIGPROCMASK 1 @@ -334,33 +433,35 @@ /* Define to 1 if your system has struct lwp. */ /* #undef HAVE_STRUCT_LWP */ -#define HAVE_STRUCT_LWP 1 /* Define to 1 if your system has struct reg in . */ #define HAVE_STRUCT_REG 1 -/* Define to 1 if `r_fs' is member of `struct reg'. */ +/* Define to 1 if `struct reg' is a member of `r_fs'. */ #define HAVE_STRUCT_REG_R_FS 1 -/* Define to 1 if `r_gs' is member of `struct reg'. */ +/* Define to 1 if `struct reg' is a member of `r_gs'. */ #define HAVE_STRUCT_REG_R_GS 1 /* Define if 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 to 1 if `st_blksize' is member of `struct stat'. */ +/* Define to 1 if `struct stat' is a member of `st_blksize'. */ #define HAVE_STRUCT_STAT_ST_BLKSIZE 1 -/* Define to 1 if `st_blocks' is member of `struct stat'. */ +/* Define to 1 if `struct stat' is a member of `st_blocks'. */ #define HAVE_STRUCT_STAT_ST_BLOCKS 1 -/* Define to 1 if `td_pcb' is member of `struct thread'. */ +/* Define to 1 if `struct thread' is a member of `td_pcb'. */ /* #undef HAVE_STRUCT_THREAD_TD_PCB */ /* Define to 1 if you have the `syscall' function. */ #define HAVE_SYSCALL 1 +/* Define to 1 if you have the header file. */ +/* #undef HAVE_SYS_BITYPES_H */ + /* Define to 1 if you have the header file. */ /* #undef HAVE_SYS_DEBUGREG_H */ @@ -377,6 +478,9 @@ /* Define to 1 if you have the header file. */ #define HAVE_SYS_FILIO_H 1 +/* Define to 1 if you have the header file. */ +/* #undef HAVE_SYS_INTTYPES_H */ + /* Define to 1 if you have the header file. */ #define HAVE_SYS_IOCTL_H 1 @@ -447,12 +551,12 @@ /* Define to 1 if you have the `ttrace' function. */ /* #undef HAVE_TTRACE */ -/* Define to 1 if the system has the type `uintptr_t'. */ -#define HAVE_UINTPTR_T 1 - /* Define to 1 if you have the header file. */ #define HAVE_UNISTD_H 1 +/* Define to 1 if the system has the type `unsigned long long int'. */ +#define HAVE_UNSIGNED_LONG_LONG_INT 1 + /* Define to 1 if you have the `vfork' function. */ #define HAVE_VFORK 1 @@ -465,6 +569,9 @@ /* Define to 1 if you have the `wborder' function. */ #define HAVE_WBORDER 1 +/* Define to 1 if you have the header file. */ +#define HAVE_WCHAR_H 1 + /* Define to 1 if `fork' works. */ #define HAVE_WORKING_FORK 1 @@ -474,6 +581,9 @@ /* Define to 1 if you have the `XML_StopParser' function. */ /* #undef HAVE_XML_STOPPARSER */ +/* Define to 1 if you have the header file. */ +#define HAVE_ZLIB_H 1 + /* Define to 1 if your system has the _etext variable. */ #define HAVE__ETEXT 1 @@ -502,12 +612,21 @@ /* Define to the one symbol short name of this package. */ #define PACKAGE_TARNAME "" +/* Define to the home page for this package. */ +#define PACKAGE_URL "" + /* Define to the version of this package. */ #define PACKAGE_VERSION "" +/* Additional package description */ +#define PKGVERSION "(GDB) " + /* Define if the prfpregset_t type is broken. */ /* #undef PRFPREGSET_T_BROKEN */ +/* Define to 1 if the "%H, %D and %DD" formats work to print decfloats. */ +/* #undef PRINTF_HAS_DECFLOAT */ + /* Define to 1 if the "%Lg" format works to print long doubles. */ #define PRINTF_HAS_LONG_DOUBLE 1 @@ -527,6 +646,16 @@ /* Define as the return type of ptrace. */ #define PTRACE_TYPE_RET int +/* Define to l, ll, u, ul, ull, etc., as suitable for constants of type + 'ptrdiff_t'. */ +/* #undef PTRDIFF_T_SUFFIX */ + +/* Relocated directory for source files. */ +/* #undef RELOC_SRCDIR */ + +/* Bug reporting address */ +#define REPORT_BUGS_TO "" + /* Define as the return type of signal handlers (`int' or `void'). */ #define RETSIGTYPE void @@ -536,24 +665,20 @@ /* Define to 1 if the `setpgrp' function takes no argument. */ /* #undef SETPGRP_VOID */ -/* The size of a `char', as computed by sizeof. */ -/* #undef SIZEOF_CHAR */ - -/* The size of a `int', as computed by sizeof. */ -/* #undef SIZEOF_INT */ +/* Define to l, ll, u, ul, ull, etc., as suitable for constants of type + 'sig_atomic_t'. */ +/* #undef SIG_ATOMIC_T_SUFFIX */ -/* The size of a `long', as computed by sizeof. */ +/* The size of `long', as computed by sizeof. */ /* #undef SIZEOF_LONG */ -/* The size of a `short', as computed by sizeof. */ -/* #undef SIZEOF_SHORT */ - -/* The size of a `void *', as computed by sizeof. */ -/* #undef SIZEOF_VOID_P */ +/* Define to l, ll, u, ul, ull, etc., as suitable for constants of type + 'size_t'. */ +/* #undef SIZE_T_SUFFIX */ /* 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. + automatically deduced at runtime. STACK_DIRECTION > 0 => grows toward higher addresses STACK_DIRECTION < 0 => grows toward lower addresses STACK_DIRECTION = 0 => direction of growth unknown */ @@ -565,6 +690,13 @@ /* Define to 1 if you have the ANSI C header files. */ #define STDC_HEADERS 1 +/* automatically load a system-wide gdbinit file */ +#define SYSTEM_GDBINIT "" + +/* Define if the system-gdbinit directory should be relocated when GDB is + moved. */ +#define SYSTEM_GDBINIT_RELOCATABLE 0 + /* Define if has the TD_NOTALLOC error code. */ /* #undef THREAD_DB_HAS_TD_NOTALLOC */ @@ -582,32 +714,72 @@ when building for Cygwin. */ /* #undef USE_WIN32API */ -/* Define if the simulator is being linked in. */ -#define WITH_SIM 1 +/* Define to l, ll, u, ul, ull, etc., as suitable for constants of type + 'wchar_t'. */ +/* #undef WCHAR_T_SUFFIX */ -/* Define to 1 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 to l, ll, u, ul, ull, etc., as suitable for constants of type + 'wint_t'. */ +/* #undef WINT_T_SUFFIX */ -/* Enable GNU extensions on systems that have them. */ -#ifndef _GNU_SOURCE -# define _GNU_SOURCE 1 +/* Define if the simulator is being linked in. */ +/* #undef WITH_SIM */ + +/* Define WORDS_BIGENDIAN to 1 if your processor stores words with the most + significant byte first (like Motorola and SPARC, unlike Intel). */ +#if defined AC_APPLE_UNIVERSAL_BUILD +# if defined __BIG_ENDIAN__ +# define WORDS_BIGENDIAN 1 +# endif +#else +# ifndef WORDS_BIGENDIAN +/* # undef WORDS_BIGENDIAN */ +# endif #endif /* Define to 1 so gets a definition of anon_hdl. Works around a problem on IRIX 5. */ /* #undef _KMEMUSER */ +/* Define to 1 if on MINIX. */ +/* #undef _MINIX */ + /* Define to 1 to avoid a clash between and on Solaris 2.[789] when using GCC. */ /* #undef _MSE_INT_H */ +/* Define to 2 if the system does not provide POSIX.1 features except with + this defined. */ +/* #undef _POSIX_1_SOURCE */ + +/* Define to 1 if you need to in order for `stat' and other things to work. */ +/* #undef _POSIX_SOURCE */ + /* Define if has link_map32 (solaris sparc-64 target) */ /* #undef _SYSCALL32 */ +/* Enable extensions on AIX 3, Interix. */ +#ifndef _ALL_SOURCE +# define _ALL_SOURCE 1 +#endif +/* Enable GNU extensions on systems that have them. */ +#ifndef _GNU_SOURCE +# define _GNU_SOURCE 1 +#endif +/* Enable threading extensions on Solaris. */ +#ifndef _POSIX_PTHREAD_SEMANTICS +# define _POSIX_PTHREAD_SEMANTICS 1 +#endif +/* Enable extensions on HP NonStop. */ +#ifndef _TANDEM_SOURCE +# define _TANDEM_SOURCE 1 +#endif +/* Enable general extensions on Solaris. */ +#ifndef __EXTENSIONS__ +# define __EXTENSIONS__ 1 +#endif + + /* Define to empty if `const' does not conform to ANSI C. */ /* #undef const */ @@ -617,8 +789,24 @@ /* #undef inline */ #endif +/* Define to rpl_memcmp if the replacement function should be used. */ +/* #undef memcmp */ + /* Define to `int' if does not define. */ /* #undef pid_t */ +/* Define to the equivalent of the C99 'restrict' keyword, or to + nothing if this is not supported. Do not define if restrict is + supported directly. */ +#define restrict __restrict +/* Work around a bug in Sun C++: it does not support _Restrict, even + though the corresponding Sun C compiler does, which causes + "#define restrict _Restrict" in the previous line. Perhaps some future + version of Sun C++ will work with _Restrict; if so, it'll probably + define __RESTRICT, just as Sun C does. */ +#if defined __SUNPRO_CC && !defined __RESTRICT +# define _Restrict +#endif + /* Define as `fork' if `vfork' does not work. */ /* #undef vfork */ diff --git a/gnu/usr.bin/gdb/libgdb/freebsd-uthread.c b/gnu/usr.bin/gdb/libgdb/freebsd-uthread.c index d0376ba74f..6b75a2291f 100644 --- a/gnu/usr.bin/gdb/libgdb/freebsd-uthread.c +++ b/gnu/usr.bin/gdb/libgdb/freebsd-uthread.c @@ -18,7 +18,6 @@ along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ /* $FreeBSD: ports/devel/gdb6/files/freebsd-uthread.c,v 1.2 2004/06/20 18:45:36 obrien Exp $ */ -/* $DragonFly: src/gnu/usr.bin/gdb/libgdb/freebsd-uthread.c,v 1.4 2008/06/05 18:06:30 swildner Exp $ */ /* This module implements a sort of half target that sits between the machine-independent parts of GDB and the ptrace interface (infptrace.c) to diff --git a/gnu/usr.bin/gdb/libgdb/version.c b/gnu/usr.bin/gdb/libgdb/version.c index 34a55b16b4..e237116444 100644 --- a/gnu/usr.bin/gdb/libgdb/version.c +++ b/gnu/usr.bin/gdb/libgdb/version.c @@ -1,5 +1,4 @@ -/* $DragonFly: src/gnu/usr.bin/gdb/libgdb/version.c,v 1.3 2008/07/28 22:33:21 corecode Exp $ */ #include "version.h" -const char version[] = "6.7.1"; +const char version[] = VERSION_STRING; const char host_name[] = MACHINE_ARCH"-dragonfly"; const char target_name[] = TARGET_ARCH"-dragonfly"; diff --git a/gnu/usr.bin/gdb/libiberty/Makefile b/gnu/usr.bin/gdb/libiberty/Makefile index f225aac1ec..a0b9968eb2 100644 --- a/gnu/usr.bin/gdb/libiberty/Makefile +++ b/gnu/usr.bin/gdb/libiberty/Makefile @@ -1,5 +1,3 @@ -# $DragonFly: src/gnu/usr.bin/gdb/libiberty/Makefile,v 1.2 2008/01/14 21:36:39 corecode Exp $ - .include "../Makefile.inc" LIB= iberty @@ -16,5 +14,6 @@ SRCS+= regex.c safe-ctype.c splay-tree.c SRCS+= argv.c concat.c hex.c lbasename.c xexit.c xstrdup.c xstrerror.c SRCS+= lrealpath.c make-relative-prefix.c filename_cmp.c stpcpy.c unlink-if-ordinary.c +SRCS+= pexecute.c pex-common.c pex-one.c pex-unix.c make-temp-file.c .include diff --git a/gnu/usr.bin/gdb/libiberty/config.h b/gnu/usr.bin/gdb/libiberty/config.h index 09a266fe78..53dc1358a1 100644 --- a/gnu/usr.bin/gdb/libiberty/config.h +++ b/gnu/usr.bin/gdb/libiberty/config.h @@ -1,7 +1,9 @@ -/* $DragonFly: src/gnu/usr.bin/gdb/libiberty/config.h,v 1.2 2008/01/14 21:36:39 corecode Exp $ */ -/* config.h. Generated by configure. */ +/* config.h. Generated from config.in by configure. */ /* config.in. Generated from configure.ac by autoheader. */ +/* Define if building universal (internal helper macro) */ +/* #undef AC_APPLE_UNIVERSAL_BUILD */ + /* 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 */ @@ -118,7 +120,10 @@ #define HAVE_INDEX 1 /* Define to 1 if you have the `insque' function. */ -/* #undef HAVE_INSQUE */ +#define HAVE_INSQUE 1 + +/* Define to 1 if the system has the type `intptr_t'. */ +#define HAVE_INTPTR_T 1 /* Define to 1 if you have the header file. */ #define HAVE_INTTYPES_H 1 @@ -141,6 +146,9 @@ /* Define to 1 if you have the `memcpy' function. */ #define HAVE_MEMCPY 1 +/* Define to 1 if you have the `memmem' function. */ +#define HAVE_MEMMEM 1 + /* Define to 1 if you have the `memmove' function. */ #define HAVE_MEMMOVE 1 @@ -208,7 +216,7 @@ #define HAVE_STDLIB_H 1 /* Define to 1 if you have the `stpcpy' function. */ -/* #undef HAVE_STPCPY */ +#define HAVE_STPCPY 1 /* Define to 1 if you have the `stpncpy' function. */ /* #undef HAVE_STPNCPY */ @@ -402,11 +410,14 @@ /* Define to the one symbol short name of this package. */ #define PACKAGE_TARNAME "" +/* Define to the home page for this package. */ +#define PACKAGE_URL "" + /* Define to the version of this package. */ #define PACKAGE_VERSION "" -/* The size of a `int', as computed by sizeof. */ -/* #undef SIZEOF_INT */ +/* The size of `int', as computed by sizeof. */ +/* #define SIZEOF_INT 4 */ /* 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 @@ -423,9 +434,23 @@ /* Define to an unsigned 64-bit type available in the compiler. */ #define UNSIGNED_64BIT_TYPE uint64_t -/* Define to 1 if your processor stores words with the most significant byte - first (like Motorola and SPARC, unlike Intel and VAX). */ -/* #undef WORDS_BIGENDIAN */ +/* Define WORDS_BIGENDIAN to 1 if your processor stores words with the most + significant byte first (like Motorola and SPARC, unlike Intel). */ +#if defined AC_APPLE_UNIVERSAL_BUILD +# if defined __BIG_ENDIAN__ +# define WORDS_BIGENDIAN 1 +# endif +#else +# ifndef WORDS_BIGENDIAN +/* # undef WORDS_BIGENDIAN */ +# endif +#endif + +/* Number of bits in a file offset, on hosts where this is settable. */ +/* #undef _FILE_OFFSET_BITS */ + +/* Define for large files, on AIX-style hosts. */ +/* #undef _LARGE_FILES */ /* Define to empty if `const' does not conform to ANSI C. */ /* #undef const */ @@ -436,10 +461,15 @@ /* #undef inline */ #endif +/* Define to the type of a signed integer type wide enough to hold a pointer, + if such a type exists, and if the system does not define it. */ +/* #undef intptr_t */ + /* Define to `int' if does not define. */ /* #undef pid_t */ -/* Define to `unsigned long' if does not define. */ +/* Define to the type of an unsigned integer type wide enough to hold a + pointer, if such a type exists, and if the system does not define it. */ /* #undef uintptr_t */ /* Define as `fork' if `vfork' does not work. */ diff --git a/gnu/usr.bin/gdb/libopcodes/Makefile b/gnu/usr.bin/gdb/libopcodes/Makefile index cb9ba0e052..f4cdf46fb2 100644 --- a/gnu/usr.bin/gdb/libopcodes/Makefile +++ b/gnu/usr.bin/gdb/libopcodes/Makefile @@ -1,5 +1,3 @@ -# $DragonFly: src/gnu/usr.bin/gdb/libopcodes/Makefile,v 1.2 2008/07/30 01:48:14 corecode Exp $ - .include "../Makefile.inc" LIB= opcodes diff --git a/gnu/usr.bin/gdb/libopcodes/Makefile.amd64 b/gnu/usr.bin/gdb/libopcodes/Makefile.amd64 index a3f3b3a529..a1621b106b 100644 --- a/gnu/usr.bin/gdb/libopcodes/Makefile.amd64 +++ b/gnu/usr.bin/gdb/libopcodes/Makefile.amd64 @@ -1,4 +1,2 @@ -# $DragonFly: src/gnu/usr.bin/gdb/libopcodes/Makefile.amd64,v 1.1 2005/10/01 12:40:33 corecode Exp $ - -SRCS+= i386-dis.c +SRCS+= i386-dis.c i386-opc.c CFLAGS+= -DARCH_i386 diff --git a/gnu/usr.bin/gdb/libopcodes/Makefile.i386 b/gnu/usr.bin/gdb/libopcodes/Makefile.i386 index 15103b26db..a1621b106b 100644 --- a/gnu/usr.bin/gdb/libopcodes/Makefile.i386 +++ b/gnu/usr.bin/gdb/libopcodes/Makefile.i386 @@ -1,4 +1,2 @@ -# $DragonFly: src/gnu/usr.bin/gdb/libopcodes/Makefile.i386,v 1.1 2004/10/23 17:02:38 joerg Exp $ - -SRCS+= i386-dis.c -CFLAGS+= -DARCH_i386 \ No newline at end of file +SRCS+= i386-dis.c i386-opc.c +CFLAGS+= -DARCH_i386 diff --git a/gnu/usr.bin/gdb/libopcodes/config.h b/gnu/usr.bin/gdb/libopcodes/config.h index 643bb592ef..885e815eb3 100644 --- a/gnu/usr.bin/gdb/libopcodes/config.h +++ b/gnu/usr.bin/gdb/libopcodes/config.h @@ -1,5 +1,4 @@ -/* $DragonFly: src/gnu/usr.bin/gdb/libopcodes/config.h,v 1.2 2008/01/14 21:36:39 corecode Exp $ */ -/* config.h. Generated by configure. */ +/* config.h. Generated from config.in by configure. */ /* config.in. Generated from configure.in by autoheader. */ /* Define to 1 if translation of program messages to the user's native @@ -12,7 +11,7 @@ /* Define to 1 if you have the declaration of `stpcpy', and to 0 if you don't. */ -#define HAVE_DECL_STPCPY 0 +#define HAVE_DECL_STPCPY 1 /* Define to 1 if you have the header file. */ #define HAVE_DLFCN_H 1 @@ -20,6 +19,9 @@ /* Define to 1 if you have the header file. */ #define HAVE_INTTYPES_H 1 +/* Define to 1 if you have the header file. */ +#define HAVE_LIMITS_H 1 + /* Define to 1 if you have the header file. */ #define HAVE_MEMORY_H 1 @@ -63,16 +65,46 @@ /* Define to the one symbol short name of this package. */ #define PACKAGE_TARNAME "" +/* Define to the home page for this package. */ +#define PACKAGE_URL "" + /* Define to the version of this package. */ #define PACKAGE_VERSION "" /* Define to 1 if you have the ANSI C header files. */ #define STDC_HEADERS 1 -/* Version number of package */ -#define VERSION "2.18.50" - +/* Enable extensions on AIX 3, Interix. */ +#ifndef _ALL_SOURCE +# define _ALL_SOURCE 1 +#endif /* Enable GNU extensions on systems that have them. */ #ifndef _GNU_SOURCE # define _GNU_SOURCE 1 #endif +/* Enable threading extensions on Solaris. */ +#ifndef _POSIX_PTHREAD_SEMANTICS +# define _POSIX_PTHREAD_SEMANTICS 1 +#endif +/* Enable extensions on HP NonStop. */ +#ifndef _TANDEM_SOURCE +# define _TANDEM_SOURCE 1 +#endif +/* Enable general extensions on Solaris. */ +#ifndef __EXTENSIONS__ +# define __EXTENSIONS__ 1 +#endif + + +/* Version number of package */ +#define VERSION "2.20.51" + +/* Define to 1 if on MINIX. */ +/* #undef _MINIX */ + +/* Define to 2 if the system does not provide POSIX.1 features except with + this defined. */ +/* #undef _POSIX_1_SOURCE */ + +/* Define to 1 if you need to in order for `stat' and other things to work. */ +/* #undef _POSIX_SOURCE */