============================================= (cd /usr/src && patch -p6) < diff_to_current ============================================= --- //depot/vendor/freebsd/src/gnu/usr.bin/binutils/gdb/solib-fbsd-kld.c 2003/10/29 16:38:10 +++ //depot/user/simokawa/firewire/gnu/usr.bin/binutils/gdb/solib-fbsd-kld.c 2007/05/31 13:27:50 @@ -99,13 +99,13 @@ char *buf; int errcode; - if (target_read_memory ((CORE_ADDR) lfilek, (char *) &lfile, + if (target_read_memory ((CORE_ADDR)(uintptr_t) lfilek, (char *) &lfile, sizeof (lfile))) { warning ("failed to read linker file data at %p\n", lfilek); return 0; } - target_read_string ((CORE_ADDR) lfile.filename, &buf, + target_read_string ((CORE_ADDR)(uintptr_t) lfile.filename, &buf, SO_NAME_MAX_PATH_SIZE - 1, &errcode); if (errcode != 0) { @@ -127,7 +127,7 @@ new->lm_info = xmalloc (sizeof (struct lm_info)); make_cleanup (xfree, new->lm_info); - new->lm_info->address = (CORE_ADDR) lfile.address; + new->lm_info->address = (CORE_ADDR)(uintptr_t) lfile.address; strncpy (new->so_original_name, buf, SO_NAME_MAX_PATH_SIZE - 1); new->so_original_name[SO_NAME_MAX_PATH_SIZE - 1] = '\0'; @@ -164,7 +164,7 @@ inferior_sos = kgdb_current_sos (); if (inferior_sos) { - solib_add (NULL, /*from_tty*/0, NULL, auto_solib_add); + solib_add (NULL, /*from_tty*/1, NULL, auto_solib_add); } } @@ -250,6 +250,7 @@ else if (p > kernpath) p--; } +#if 0 /* try current directory later */ if (syspathlen == 0) { warning ("cannot find /sys/ in `%s'; using default module path\n", @@ -257,6 +258,7 @@ xfree (version); return buf; } +#endif /* * For kernels compiled with buildkernel, the object path will have * been prepended to the /sys/ path in `kernpath'. @@ -273,11 +275,13 @@ /* Now try to find the module file */ if (!try_modpath (buf, sizeof (buf), "./%s.debug", modname) && + !try_modpath (buf, sizeof (buf), "./%s.symbols", modname) && !try_modpath (buf, sizeof (buf), "./%s", modname) && !try_modpath (buf, sizeof (buf), "%s/modules%s/modules/%s/%s.debug", kernpath, syspath, moddir, modname) && !try_modpath (buf, sizeof (buf), "%s/modules%s/modules/%s/%s", kernpath, syspath, moddir, modname) && !try_modpath (buf, sizeof (buf), "/boot/kernel/%s.debug", modname) && + !try_modpath (buf, sizeof (buf), "/boot/kernel/%s.symbols", modname) && !try_modpath (buf, sizeof (buf), "/boot/kernel/%s", modname)) { warning ("cannot find file for module %s\n", modname); @@ -301,4 +305,6 @@ kgdb_so_ops.current_sos = kgdb_current_sos; kgdb_so_ops.open_symbol_file_object = kgdb_open_symbol_file_object; kgdb_so_ops.in_dynsym_resolve_code = kgdb_in_dynsym_resolve_code; + + current_target_so_ops = &kgdb_so_ops; } --- //depot/vendor/freebsd/src/gnu/usr.bin/gdb/kgdb/Makefile 2005/02/20 23:37:48 +++ //depot/user/simokawa/firewire/gnu/usr.bin/gdb/kgdb/Makefile 2007/05/30 13:03:26 @@ -1,7 +1,9 @@ # $FreeBSD: src/gnu/usr.bin/gdb/kgdb/Makefile,v 1.6 2005/02/20 23:06:03 kan Exp $ +.PATH: ${.CURDIR}/../../binutils/gdb + PROG= kgdb${GDB_SUFFIX} -SRCS= main.c kthr.c trgt.c trgt_${TARGET_ARCH}.c +SRCS= main.c kthr.c trgt.c trgt_${TARGET_ARCH}.c solib-fbsd-kld.c WARNS?= 2 BULIBS= ${OBJ_BU}/libbfd/libbfd.a ${OBJ_BU}/libopcodes/libopcodes.a \ --- //depot/vendor/freebsd/src/gnu/usr.bin/gdb/kgdb/main.c 2006/01/04 23:35:51 +++ //depot/user/simokawa/firewire/gnu/usr.bin/gdb/kgdb/main.c 2007/05/31 12:34:09 @@ -53,6 +53,7 @@ #include #include #include +#include #include #include #include @@ -66,6 +67,8 @@ extern void symbol_file_add_main (char *args, int from_tty); +extern initialize_file_ftype _initialize_kgdb_solib; + #include "kgdb.h" kvm_t *kvm; @@ -203,31 +206,30 @@ kgdb_init_target(void) { CORE_ADDR bufp; - bfd *kern_bfd; int size, rseq, wseq; int kern_desc; char c; + _initialize_kgdb_solib (); 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) { + exec_bfd = bfd_fdopenr(kernel, gnutarget, kern_desc); + if (exec_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); + bfd_set_cacheable(exec_bfd, 1); - if (!bfd_check_format (kern_bfd, bfd_object)) { - bfd_close(kern_bfd); + if (!bfd_check_format (exec_bfd, bfd_object)) { + bfd_close(exec_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); + set_gdbarch_from_file (exec_bfd); symbol_file_add_main (kernel, 0); if (remote) @@ -235,6 +237,8 @@ else kgdb_target(); + bfd_close(exec_bfd); + /* * Display the unread portion of the message buffer. This gives the * user a some initial data to work from. @@ -261,6 +265,13 @@ putchar('\n'); } +static int +kgdb_interpreter_resume (void *data) +{ + gdb_setup_readline(); + return 1; +} + static void kgdb_interp_command_loop(void *data) { @@ -280,10 +291,10 @@ { static struct interp_procs procs = { NULL, + kgdb_interpreter_resume, NULL, NULL, NULL, - NULL, kgdb_interp_command_loop }; struct interp *kgdb; @@ -407,6 +418,7 @@ if (!S_ISREG(st.st_mode)) errx(1, "%s: not a regular file", path); vmcore = strdup(path); +#if 0 } else if (remote != NULL && remote[0] != ':' && remote[0] != '|') { if (stat(remote, &st) != 0) { snprintf(path, sizeof(path), "/dev/%s", remote); @@ -422,6 +434,7 @@ remote); /* NOTREACHED */ } +#endif } else if (argc > optind) { if (vmcore == NULL) vmcore = strdup(argv[optind++]);