From 38f4846ec58a54cd980398707558803ff33c63ff Mon Sep 17 00:00:00 2001 From: "Jordan K. Hubbard" Date: Wed, 26 Apr 1995 01:01:20 +0000 Subject: [PATCH] Gary J's patches to make gdb -w work properly. Submitted by: gj --- gnu/usr.bin/binutils/gdb/i386/freebsd-nat.c | 6 +++--- gnu/usr.bin/gdb/gdb/defs.h | 1 + gnu/usr.bin/gdb/gdb/freebsd-nat.c | 6 +++--- gnu/usr.bin/gdb/gdb/kcorelow.c | 4 ++-- gnu/usr.bin/gdb/gdb/main.c | 12 ++++++++++++ gnu/usr.bin/gdb/gdb/top.c | 1 + 6 files changed, 22 insertions(+), 8 deletions(-) diff --git a/gnu/usr.bin/binutils/gdb/i386/freebsd-nat.c b/gnu/usr.bin/binutils/gdb/i386/freebsd-nat.c index bc58924996d..6679060cfa6 100644 --- a/gnu/usr.bin/binutils/gdb/i386/freebsd-nat.c +++ b/gnu/usr.bin/binutils/gdb/i386/freebsd-nat.c @@ -17,7 +17,7 @@ You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - $Id: freebsd-nat.c,v 1.3 1994/12/31 17:00:09 bde Exp $ + $Id: freebsd-nat.c,v 1.1.1.1 1995/04/23 18:35:38 garyj Exp $ */ #include @@ -344,9 +344,9 @@ extern CORE_ADDR ksym_lookup(const char *); kvm_open (efile, cfile, sfile, perm, errout) char *efile; char *cfile; -void *sfile; +char *sfile; /* makes this kvm_open more compatible to the one in libkvm */ int perm; -int errout; +char *errout; /* makes this kvm_open more compatible to the one in libkvm */ { struct stat stb; CORE_ADDR addr; diff --git a/gnu/usr.bin/gdb/gdb/defs.h b/gnu/usr.bin/gdb/gdb/defs.h index 37631ba1ed3..00043ee2e92 100644 --- a/gnu/usr.bin/gdb/gdb/defs.h +++ b/gnu/usr.bin/gdb/gdb/defs.h @@ -434,6 +434,7 @@ enum val_prettyprint #ifdef KERNEL_DEBUG extern int kernel_debugging; +extern int kernel_writablecore; #endif /* If the xm.h file did not define the mode string used to open the diff --git a/gnu/usr.bin/gdb/gdb/freebsd-nat.c b/gnu/usr.bin/gdb/gdb/freebsd-nat.c index bc58924996d..6679060cfa6 100644 --- a/gnu/usr.bin/gdb/gdb/freebsd-nat.c +++ b/gnu/usr.bin/gdb/gdb/freebsd-nat.c @@ -17,7 +17,7 @@ You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - $Id: freebsd-nat.c,v 1.3 1994/12/31 17:00:09 bde Exp $ + $Id: freebsd-nat.c,v 1.1.1.1 1995/04/23 18:35:38 garyj Exp $ */ #include @@ -344,9 +344,9 @@ extern CORE_ADDR ksym_lookup(const char *); kvm_open (efile, cfile, sfile, perm, errout) char *efile; char *cfile; -void *sfile; +char *sfile; /* makes this kvm_open more compatible to the one in libkvm */ int perm; -int errout; +char *errout; /* makes this kvm_open more compatible to the one in libkvm */ { struct stat stb; CORE_ADDR addr; diff --git a/gnu/usr.bin/gdb/gdb/kcorelow.c b/gnu/usr.bin/gdb/gdb/kcorelow.c index debd7d6114b..ccf27c978f6 100644 --- a/gnu/usr.bin/gdb/gdb/kcorelow.c +++ b/gnu/usr.bin/gdb/gdb/kcorelow.c @@ -17,7 +17,7 @@ You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - $Id: kcorelow.c,v 1.1 1994/12/30 23:32:56 jkh Exp $ + $Id: kcorelow.c,v 1.1.1.1 1995/04/23 18:35:48 garyj Exp $ */ #include "defs.h" @@ -181,7 +181,7 @@ kcore_open (filename, from_tty) error ("kgdb could not open the exec-file, please check the name you used !"); core_kd = kvm_open (exec_bfd->filename, filename, NULL, - write_files? O_RDWR: O_RDONLY, "kgdb: "); + kernel_writablecore? O_RDWR: O_RDONLY, "kgdb: "); if (core_kd < 0) perror_with_name (filename); diff --git a/gnu/usr.bin/gdb/gdb/main.c b/gnu/usr.bin/gdb/gdb/main.c index 5b5b10a580a..8445b3a0681 100644 --- a/gnu/usr.bin/gdb/gdb/main.c +++ b/gnu/usr.bin/gdb/gdb/main.c @@ -173,6 +173,8 @@ main (argc, argv) #ifdef KERNEL_DEBUG {"kernel", no_argument, &kernel_debugging, 1}, {"k", no_argument, &kernel_debugging, 1}, + {"wcore", no_argument, &kernel_writablecore, 1}, + {"w", no_argument, &kernel_writablecore, 1}, #endif /* Allow machine descriptions to add more options... */ #ifdef ADDITIONAL_OPTIONS @@ -268,6 +270,9 @@ main (argc, argv) case 'k': kernel_debugging = 1; break; + case 'w': + kernel_writablecore = 1; + break; #endif #ifdef ADDITIONAL_OPTION_CASES @@ -350,6 +355,13 @@ Options:\n\ --mapped Use mapped symbol files if supported on this system.\n\ --readnow Fully read symbol files on first access.\n\ ", gdb_stdout); +#ifdef KERNEL_DEBUG + fputs_unfiltered ("\ + --kernel Enable kernel debugging.\n\ + --wcore Make core file writable (only works for /dev/mem).\n\ + This option only works while debugging a kernel !!\n\ +", gdb_stdout); +#endif /* KERNEL_DEBUGGING */ #ifdef ADDITIONAL_OPTION_HELP fputs_unfiltered (ADDITIONAL_OPTION_HELP, gdb_stdout); #endif diff --git a/gnu/usr.bin/gdb/gdb/top.c b/gnu/usr.bin/gdb/gdb/top.c index 0c693feff3c..a38e639661f 100644 --- a/gnu/usr.bin/gdb/gdb/top.c +++ b/gnu/usr.bin/gdb/gdb/top.c @@ -322,6 +322,7 @@ jmp_buf quit_return; #ifdef KERNEL_DEBUG /* Non-zero means we are debugging a kernel core file */ int kernel_debugging = 0; +int kernel_writablecore = 0; #endif /* Return for reason REASON. This generally gets back to the command