summaryrefslogtreecommitdiffstats
path: root/gnu
diff options
context:
space:
mode:
authorjoerg <joerg@FreeBSD.org>1995-04-19 22:59:33 +0000
committerjoerg <joerg@FreeBSD.org>1995-04-19 22:59:33 +0000
commit50062c9a78bb8a8cb4933ed9970babaebd9c8f00 (patch)
tree6fe5bbec343439ec0b672b7a39aaabbc5ab77909 /gnu
parent9b5928083cf68e939cb04082f230b78edd055d52 (diff)
downloadFreeBSD-src-50062c9a78bb8a8cb4933ed9970babaebd9c8f00.zip
FreeBSD-src-50062c9a78bb8a8cb4933ed9970babaebd9c8f00.tar.gz
Fix for the ``gdb -k /nonexistent /dev/mem'' core dump.
Submitted by: gj@freebsd.org (Gary Jennejohn)
Diffstat (limited to 'gnu')
-rw-r--r--gnu/usr.bin/gdb/gdb/kcorelow.c14
1 files changed, 12 insertions, 2 deletions
diff --git a/gnu/usr.bin/gdb/gdb/kcorelow.c b/gnu/usr.bin/gdb/gdb/kcorelow.c
index d97c594..debd7d6 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.2 1994/05/18 12:42:15 pk Exp $
+ $Id: kcorelow.c,v 1.1 1994/12/30 23:32:56 jkh Exp $
*/
#include "defs.h"
@@ -170,8 +170,18 @@ kcore_open (filename, from_tty)
old_chain = make_cleanup (free, filename);
+ /*
+ * gdb doesn't really do anything if the exec-file couldn't
+ * be opened (in that case exec_bfd is NULL). Usually that's
+ * no big deal, but kvm_open needs the exec-file's name,
+ * which results in dereferencing a NULL pointer, a real NO-NO !
+ * So, check here if the open of the exec-file succeeded.
+ */
+ if (exec_bfd == NULL) /* the open failed */
+ 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, 0);
+ write_files? O_RDWR: O_RDONLY, "kgdb: ");
if (core_kd < 0)
perror_with_name (filename);
OpenPOWER on IntegriCloud