glassner@cwruecmp.UUCP (Andrew Glassner) (10/22/83)
I've got a large C program that has some bugs. It often ends up dumping core, which can take upwards of a minute or so. I don't want that core: the problem's causes lie in a data structure that's wrong...I just need to insert some new diagnostics and get everything right. The core dump is annoying because I just have to sit and wait ... and I don't want the stuff! My first command afterwards is "rm core". We're running 4.1BSD - is there some way (a command to the shell, a compile-time flag, anything!) to disable this automatic dumping of core and just have my terminal come back? -Andrew Andrew Glassner decvax!cwruecmp!glassner
glassner@cwruecmp.UUCP (Andrew Glassner) (10/22/83)
I currently have a C program which has got some bugs. One set of bugs causes the program to dump core; it runs into a segmentation error and it's all over. I know that the cause of this problem is in the logic of some code that generates a data structure; there's nothing to learn from the core dump. The problem is that sometimes the core dump IS useful for fixing other errors; I compile with -g so that I can use sdb to examine variables, etc. Often though I don't want the core dump. Unfortunately, the C program is big and the core dump takes upwards of a minute or more, which I must spend sitting and waiting for my terminal to come back. Question: Is there some way to suppress a core dump, so that when the program bombs I just get the error message and my terminal comes back? Supporting info: We're running 4.1BSD on a VAX-11/780. Thanks! -Andrew Andrew Glassner decvax!cwruecmp!glassner
thomson@utcsrgv.UUCP (Brian Thomson) (10/23/83)
Using csh under 4.1bsd, type % limit core 0 With sh, or on a non-Berkeley system, create an empty core file and $ chmod 0 core -- Brian Thomson, CSRG Univ. of Toronto {linus,ihnp4,uw-beaver,floyd,utzoo}!utcsrgv!thomson
jgy@eagle.UUCP (John Young (sponsor blewett)) (10/23/83)
mkdir core
goldfarb@ucf-cs.UUCP (10/24/83)
All you have to do to disable core dumps is issue the following csh command: % limit coredumpsize 0 Of course, this is only implemented in Berkeley 4.x systems. Ben Goldfarb goldfarb.ucf-cs@Rand-Relay decvax!ucf-cs!goldfarb
dave@rlgvax.UUCP (Dave Maxey) (10/25/83)
There are at least three ways, two I have seen already here on the net, 1) "mkdir core" and 2) "limit coredumpsize 0" (which ONLY works if you type that from csh!) Another way is to create the file core and use "chmod -w core" to make it unwritable by everyone (including yourself). Pick the way that's easiest for you. - Dave Maxey (alias tbm) {seismo,mcnc,brl-bmd,allegra}!rlgvax!dave
lwa%mit-csr@sri-unix.UUCP (10/26/83)
Well, Ron's suggestion will work, but it seems a little inelegant (in
particular, if you forget to remove the 'core' file later, it will
prevent future programs from dumping core).
A slightly more elegant solution is to add a signal handler for the
signal you're getting (SIGSEG, I think?) which just causes the process
to exit. Like this:
/* at the beginning of main() */
extern int segflt();
signal(SIGSEG, segflt);
.
.
.
segflt()
{
exit(1);
}
-Larry Allen
-------
salex.rice%rand-relay@sri-unix.UUCP (10/26/83)
From: Scott Alexander <salex.rice@rand-relay> The other thing that you can do if you are running the csh, is to do a `limit core 0`. This command to the csh limits your cores to 0 Kbytes. `limit` will show the limits in force. It does have the disadvantage mentioned in one of the replies to you that if you forget to reset it it will disallow cores later but only for a login session. Scott Alexander Dept of Math Sci Rice University arpa/csnet: salex.rice@rand-relay uucp: ...!lbl-csam!rice!salex
gwyn%brl-vld@sri-unix.UUCP (10/26/83)
From: Doug Gwyn (VLD/VMB) <gwyn@brl-vld> If your executable binary image does not have read permission, e.g. mode 0111, then you should not get a "core dump" on abnormal termination.
hartwell%shasta@sri-unix.UUCP (10/26/83)
From: Steve Hartwell <hartwell@shasta> I think the best solution would be to set the vlimit "coredumpsize" to 0 before running the program when you don't want the core dump. You can set it back to "unlimited" when you want to reenable them. The csh has a "limit" builtin for this. -- Steve Hartwell Stanford
dbj.rice%rand-relay@sri-unix.UUCP (10/27/83)
From: Dave Johnson <dbj.rice@rand-relay> On 4.1, the easiest way to disable core dumps is to use vlimit() to set the maximum size of core dumps allowed to zero. You can do this from the C shell with the command limit coredumpsize 0 or from within the program with #include <sys/vlimit.h> vlimit(LIM_CORE, 0); Once you do this, you will never see another core dump from this process or any of its children. You can undo this effect with either unlimit coredumpsize from the shell, or vlimit(LIM_CORE, INFINITY); from the program. With the core dump disabled in this way, the shell still prints the "Segmentation Fault" message, but, of course, doesn't add "(core dumped)". Dave Johnson Dept. of Math Science Rice University dbj.rice@Rand-Relay
ron%brl-vgr@sri-unix.UUCP (10/27/83)
From: Ron Natalie <ron@brl-vgr> I tried that, but 4.1 does anyway. Opening up a slight security problem that other UNIX's (like BRL's) have fixed. -Ron
mark@umcp-cs.UUCP (11/01/83)
Disabling core dump is a cinch on 4.1bsd. Just say limit coredumpsize 0 which limits the amount of file space a coredump can take to 0blocks. (Of course, you can set this to other things as well.) Issuing the command 'limit' by itself shows you what all the limits are. On my terminal just now, limit says: % limit cputime unlimited filesize unlimited datasize 6112 kbytes stacksize 512 kbytes coredumpsize unlimited memoryuse unlimited % -- spoken: mark weiser UUCP: {seismo,allegra,brl-bmd}!umcp-cs!mark CSNet: mark@umcp-cs ARPA: mark.umcp-cs@CSNet-Relay