Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 25 Apr 95 11:15:30 GMT
From:      "gj%pcs.dec.com@inet-gw-1.pa.dec.com" <garyj@rks32.pcs.dec.com>
To:        current%freebsd.org@inet-gw-1.pa.dec.com
Subject:   patch to gdb
Message-ID:  <m0s3iaY-0005OqC@rks32.pcs.dec.com>

next in thread | raw e-mail | index | archive | help

Below are patches to add a '-w' option to gdb. This option is only effective
in conjunction with the '-k' flag.

While I was at it I added some code to show the kernel debugging options
when you do 'gdb --help'. I also did some other miscellaneous clean up.

Someone please apply these.

Thanx
Gary J.

------------------------------------ SNIP ---------------------------------

Index: main.c
===================================================================
RCS file: /u1/cvs/gdb/gdb/main.c,v
retrieving revision 1.1.1.1
diff -c -r1.1.1.1 main.c
*** 1.1.1.1	1995/04/23 18:35:40
- --- main.c	1995/04/24 21:43:19
***************
*** 173,178 ****
- --- 173,180 ----
  #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,273 ****
- --- 270,278 ----
  	  case 'k':
  	    kernel_debugging = 1;
  	    break;
+ 	  case 'w':
+ 	    kernel_writablecore = 1;
+ 	    break;
  #endif
  
  #ifdef ADDITIONAL_OPTION_CASES
***************
*** 350,355 ****
- --- 355,367 ----
    --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
Index: kcorelow.c
===================================================================
RCS file: /u1/cvs/gdb/gdb/kcorelow.c,v
retrieving revision 1.1.1.1
diff -c -r1.1.1.1 kcorelow.c
*** 1.1.1.1	1995/04/23 18:35:48
- --- kcorelow.c	1995/04/24 21:02:27
***************
*** 181,187 ****
                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: ");
  	if (core_kd < 0)
  		perror_with_name (filename);
  
- --- 181,187 ----
                error ("kgdb could not open the exec-file, please check the name you used !");
  
  	core_kd = kvm_open (exec_bfd->filename, filename, NULL,
!                           kernel_writablecore? O_RDWR: O_RDONLY, "kgdb: ");
  	if (core_kd < 0)
  		perror_with_name (filename);
  
Index: top.c
===================================================================
RCS file: /u1/cvs/gdb/gdb/top.c,v
retrieving revision 1.1.1.1
diff -c -r1.1.1.1 top.c
*** 1.1.1.1	1995/04/23 18:35:48
- --- top.c	1995/04/24 20:59:46
***************
*** 322,327 ****
- --- 322,328 ----
  #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
Index: freebsd-nat.c
===================================================================
RCS file: /u1/cvs/gdb/gdb/freebsd-nat.c,v
retrieving revision 1.1.1.1
diff -c -r1.1.1.1 freebsd-nat.c
*** 1.1.1.1	1995/04/23 18:35:38
- --- freebsd-nat.c	1995/04/24 21:25:41
***************
*** 344,352 ****
  kvm_open (efile, cfile, sfile, perm, errout)
  char *efile;
  char *cfile;
! void *sfile;
  int perm;
! int errout;
  {
  	struct stat stb;
  	CORE_ADDR addr;
- --- 344,352 ----
  kvm_open (efile, cfile, sfile, perm, errout)
  char *efile;
  char *cfile;
! char *sfile; /* makes this kvm_open more compatible to the one in libkvm */
  int perm;
! char *errout; /* makes this kvm_open more compatible to the one in libkvm */
  {
  	struct stat stb;
  	CORE_ADDR addr;
Index: defs.h
===================================================================
RCS file: /u1/cvs/gdb/gdb/defs.h,v
retrieving revision 1.1.1.1
diff -c -r1.1.1.1 defs.h
*** 1.1.1.1	1995/04/23 18:35:36
- --- defs.h	1995/04/24 21:05:17
***************
*** 434,439 ****
- --- 434,440 ----
  
  #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





Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?m0s3iaY-0005OqC>