Date: Wed, 19 Apr 95 21:40 MSZ From: garyj@rks32.pcs.dec.com (Gary Jennejohn) To: current%freebsd.org@inet-gw-1.pa.dec.com Subject: patch to gdb Message-ID: <m0s1fbi-0005OqC@rks32.pcs.dec.com>
next in thread | raw e-mail | index | archive | help
Reply-to: gj@freebsd.org [ had to add the Reply-to by hand, damned mailx ! ] The appended patch fixes the "when I do gdb -k /none_existent_file /dev/mem, gdb core dumps" bug which was recently reported. Can some kind soul apply it ? Maybe it's time for me to get commit privileges, Jordan ? Gary J. ------------------------------- SNIP ------------------------------ *** kcorelow.c~ Wed Apr 19 19:52:52 1995 --- kcorelow.c Wed Apr 19 20:42:48 1995 *************** *** 170,177 **** old_chain = make_cleanup (free, filename); core_kd = kvm_open (exec_bfd->filename, filename, NULL, ! write_files? O_RDWR: O_RDONLY, 0); if (core_kd < 0) perror_with_name (filename); --- 170,187 ---- 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, "kgdb: "); if (core_kd < 0) perror_with_name (filename);
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?m0s1fbi-0005OqC>