Re: Dumping Core on Purpose
Hi... I think there's a core file in /proc/ for each process. Alex On Fri, 17 Jul 1998, C.J.LAWSON wrote: > Date: Fri, 17 Jul 1998 16:29:17 +0100 (BST) > From: "C.J.LAWSON" <[EMAIL PROTECTED]> > To: Keith Beattie <[EMAIL PROTECTED]> > Cc: "C.J.LAWSON" <[EMAIL PROTECTED]>, [EMAIL PROTECTED], > [EMAIL PROTECTED], debian-user@lists.debian.org > Subject: Re: Dumping Core on Purpose > Resent-Date: 17 Jul 1998 15:29:25 - > Resent-From: debian-user@lists.debian.org > Resent-cc: recipient list not shown: ; > > > On Thu, 16 Jul 1998, Keith Beattie wrote: > > > C.J.LAWSON wrote: > > > > > I guess the next logical question would be how to get a program to > > > backtrack and reload the core file .. and then contiue executing > > > > > > > Here's a wild shot at it... > > > > Assuming that forking a "kamakazi" child is not an acceptable > > solution, is there some way of capturing the image of the process from > > the kernal? > > Not that I am aware of ... It sounds pretty tricky though > > --Jon. > > > -- > Unsubscribe? mail -s unsubscribe [EMAIL PROTECTED] < /dev/null > > -- Unsubscribe? mail -s unsubscribe [EMAIL PROTECTED] < /dev/null
Re: Dumping Core on Purpose
> > > On Thu, 16 Jul 1998, Brian White wrote: > > > > Assuming that forking a "kamakazi" child is not an acceptable > > > solution, is there some way of capturing the image of the process from > > > the kernal? > > > > Hmmm... That's interesting. Assuming there is no library/system call > > to force a core dump, I could fork a child and then make the child access > > mem at 0x to cause a segfault and dump core. Would that work? > > > There remains the issue of if one cannot fork a child process ... this > seems more likely than not being able do dump. What about the `files' in /proc/? Aren't any of those core images? Eric -- E.L. Meijer ([EMAIL PROTECTED]) | tel. office +31 40 2472189 Eindhoven Univ. of Technology | tel. lab. +31 40 2475032 Lab. for Catalysis and Inorg. Chem. (TAK) | tel. fax+31 40 2455054 -- Unsubscribe? mail -s unsubscribe [EMAIL PROTECTED] < /dev/null
Re: Dumping Core on Purpose
On Thu, 16 Jul 1998, Brian White wrote: > > Assuming that forking a "kamakazi" child is not an acceptable > > solution, is there some way of capturing the image of the process from > > the kernal? > > Hmmm... That's interesting. Assuming there is no library/system call > to force a core dump, I could fork a child and then make the child access > mem at 0x to cause a segfault and dump core. Would that work? > There remains the issue of if one cannot fork a child process ... this seems more likely than not being able do dump. --Jon. -- Unsubscribe? mail -s unsubscribe [EMAIL PROTECTED] < /dev/null
Re: Dumping Core on Purpose
On Thu, 16 Jul 1998, Keith Beattie wrote: > C.J.LAWSON wrote: > > > I guess the next logical question would be how to get a program to > > backtrack and reload the core file .. and then contiue executing > > > > Here's a wild shot at it... > > Assuming that forking a "kamakazi" child is not an acceptable > solution, is there some way of capturing the image of the process from > the kernal? Not that I am aware of ... It sounds pretty tricky though --Jon. -- Unsubscribe? mail -s unsubscribe [EMAIL PROTECTED] < /dev/null
Re: Dumping Core on Purpose
On Thu, 16 Jul 1998, Stephen J. Carpenter wrote: > On Thu, Jul 16, 1998 at 12:13:44PM -0400, Brian White wrote: > > > Yes. use CTRL-\ > > > > I've never heard of that. > > neither have II just tried it...it makes programs exit fast but > I have yet to produce a core dump with it I tried it when I was debugging some program with gdb ... it dumped (amongst other things much to my displeasure). -- Jon. -- Unsubscribe? mail -s unsubscribe [EMAIL PROTECTED] < /dev/null
Re: Dumping Core on Purpose
On Thu, 16 Jul 1998, Stephen J. Carpenter wrote: > On Thu, Jul 16, 1998 at 12:13:44PM -0400, Brian White wrote: > > > Yes. use CTRL-\ > > > > I've never heard of that. > > neither have II just tried it...it makes programs exit fast but > I have yet to produce a core dump with it > > > Actually, though... I was looking for the program to dump core when it > > wanted (rather than at user request) and then be able to keep executing. > > I already replied once...I suggested signals how about this: > if (fork() == 0) > signal(getpid(), SIGFPE); How about abort()?? From the Solaris manpages: Catching the signal is intended to provide the application writer with a portable means to abort processing, free from possible interference from any implementation-provided library functions. If SIGABRT is neither caught nor ignored, and the current directory is writable, a core dump may be produced. Maarten _ | TU Delft, The Netherlands, Faculty of Information Technology and Systems | | Department of Electrical Engineering| | Computer Architecture and Digital Technique section | | [EMAIL PROTECTED] | - -- Unsubscribe? mail -s unsubscribe [EMAIL PROTECTED] < /dev/null
Re: Dumping Core on Purpose
On Thu, 16 Jul 1998, Vassilii Khachaturov wrote: > Yes. use CTRL-\ Nope, that would kill the program... Maarten _ | TU Delft, The Netherlands, Faculty of Information Technology and Systems | | Department of Electrical Engineering| | Computer Architecture and Digital Technique section | | [EMAIL PROTECTED] | - -- Unsubscribe? mail -s unsubscribe [EMAIL PROTECTED] < /dev/null
Re: Dumping Core on Purpose
In article <[EMAIL PROTECTED]>, Stephen J. Carpenter <[EMAIL PROTECTED]> wrote: >On Thu, Jul 16, 1998 at 12:13:44PM -0400, Brian White wrote: >> > Yes. use CTRL-\ >> >> I've never heard of that. > >neither have II just tried it...it makes programs exit fast but >I have yet to produce a core dump with it CTRL-\ lets the keyboard driver send a SIGQUIT to the running process(group). Normally, that produces a coredump. However, coredumps default to "off" in Linux (the corelimit size is set to 0 by default for all processes). Try this: $ ulimit -c unlimited $ sleep 60 CTRL-\ zsh: quit (core dumped) sleep 60 $ ls -l core -rw--- 1 miquels staff 262144 Jul 17 00:42 core Mike. -- Miquel van Smoorenburg | Our vision is to speed up time, [EMAIL PROTECTED] | eventually eliminating it. -- Unsubscribe? mail -s unsubscribe [EMAIL PROTECTED] < /dev/null
Re: Dumping Core on Purpose
On Thu, 16 Jul 1998, Brian White wrote: : > Assuming that forking a "kamakazi" child is not an acceptable : > solution, is there some way of capturing the image of the process from : > the kernal? : : Hmmm... That's interesting. Assuming there is no library/system call : to force a core dump, I could fork a child and then make the child access : mem at 0x to cause a segfault and dump core. Would that work? Couldn't you send the child a SIGABRT? Stevens's APUE seems to indicate this is the way to go, or call the abort() functionB -- Nathan Norman MidcoNet - 410 South Phillips Avenue - Sioux Falls, SD 57104 mailto://[EMAIL PROTECTED] http://www.midco.net finger [EMAIL PROTECTED] for PGP Key: (0xA33B86E9) -- Unsubscribe? mail -s unsubscribe [EMAIL PROTECTED] < /dev/null
Re: Dumping Core on Purpose
Brian White wrote: > > Assuming that forking a "kamakazi" child is not an acceptable > > solution, is there some way of capturing the image of the process from > > the kernal? > > Hmmm... That's interesting. Assuming there is no library/system call > to force a core dump, I could fork a child and then make the child access > mem at 0x to cause a segfault and dump core. Would that work? There is a library call which forces a core dump, it's abort(). -- Jens B. Jorgensen [EMAIL PROTECTED] -- Unsubscribe? mail -s unsubscribe [EMAIL PROTECTED] < /dev/null
Re: Dumping Core on Purpose
> Assuming that forking a "kamakazi" child is not an acceptable > solution, is there some way of capturing the image of the process from > the kernal? Hmmm... That's interesting. Assuming there is no library/system call to force a core dump, I could fork a child and then make the child access mem at 0x to cause a segfault and dump core. Would that work? Brian ( [EMAIL PROTECTED] ) --- The squeaky wheel doesn't always get the grease. Sometimes it gets replaced. -- Unsubscribe? mail -s unsubscribe [EMAIL PROTECTED] < /dev/null
Re: Dumping Core on Purpose
C.J.LAWSON wrote: > I guess the next logical question would be how to get a program to > backtrack and reload the core file .. and then contiue executing > Here's a wild shot at it... Assuming that forking a "kamakazi" child is not an acceptable solution, is there some way of capturing the image of the process from the kernal? I don't have access to a Linux machine at the moment (a tradgedy, I know...) but I'm thinking of copying info out of something like one of FreeBSD's or Solaris' /proc entries. ksb -- Unsubscribe? mail -s unsubscribe [EMAIL PROTECTED] < /dev/null
Re: Dumping Core on Purpose
On Thu, Jul 16, 1998 at 12:13:44PM -0400, Brian White wrote: > > Yes. use CTRL-\ > > I've never heard of that. neither have II just tried it...it makes programs exit fast but I have yet to produce a core dump with it > Actually, though... I was looking for the program to dump core when it > wanted (rather than at user request) and then be able to keep executing. I already replied once...I suggested signals how about this: if (fork() == 0) signal(getpid(), SIGFPE); -Steve -- /* -- Stephen Carpenter <[EMAIL PROTECTED]> --- <[EMAIL PROTECTED]> */ E-mail "Bumper Stickers": "A FREE America or a Drug-Free America: You can't have both!" "honk if you Love Linux" -- Unsubscribe? mail -s unsubscribe [EMAIL PROTECTED] < /dev/null
Re: Dumping Core on Purpose
On Thu, Jul 16, 1998 at 11:31:55AM -0400, Brian White wrote: > Is there any way to make a program dump core and then continue execution? > Sorta like taking a snap-shot of the current program state. well I have made a program dump core on purpose... how about... kill(getpid(), SIGFPE); the program will recive a floating point exception and dump core (this works for any program that doesn't catch SIGFPE... if you do catch SIGFPE (um...like why? :) ) then change itto SIGIOT, or SIGSEGV you can also do this with kill at the command line (if you wanna kill it but also wanna have a core file to see why it was acting stupid :) ) this was never tested but once when I had some evil ideas and wantd to make programs dump core for no apparent reason -Steve -- /* -- Stephen Carpenter <[EMAIL PROTECTED]> --- <[EMAIL PROTECTED]> */ E-mail "Bumper Stickers": "A FREE America or a Drug-Free America: You can't have both!" "honk if you Love Linux" -- Unsubscribe? mail -s unsubscribe [EMAIL PROTECTED] < /dev/null
Re: Dumping Core on Purpose
C.J.LAWSON wrote: > I guess the next logical question would be how to get a program to > backtrack and reload the core file .. and then contiue executing That's what gdb is for. -- see shy jo -- Unsubscribe? mail -s unsubscribe [EMAIL PROTECTED] < /dev/null
Re: Dumping Core on Purpose
I guess the next logical question would be how to get a program to backtrack and reload the core file .. and then contiue executing --J. On Thu, 16 Jul 1998, Brian White wrote: > > Yes. use CTRL-\ > > I've never heard of that. > > Actually, though... I was looking for the program to dump core when it > wanted (rather than at user request) and then be able to keep executing. > > Brian > ( [EMAIL PROTECTED] ) > > --- > Don't marry someone you can live with. Marry someone you can't live without. > > > > -- > Unsubscribe? mail -s unsubscribe [EMAIL PROTECTED] < /dev/null > > -- Unsubscribe? mail -s unsubscribe [EMAIL PROTECTED] < /dev/null
Re: Dumping Core on Purpose
> Yes. use CTRL-\ I've never heard of that. Actually, though... I was looking for the program to dump core when it wanted (rather than at user request) and then be able to keep executing. Brian ( [EMAIL PROTECTED] ) --- Don't marry someone you can live with. Marry someone you can't live without. -- Unsubscribe? mail -s unsubscribe [EMAIL PROTECTED] < /dev/null
Re: Dumping Core on Purpose
> > Is there any way to make a program dump core and then continue execution? > Sorta like taking a snap-shot of the current program state. > > Brian > ( [EMAIL PROTECTED] ) > That's an interesting idea :). Let me see, I think I would try something like void dump_core(void) { pid_t childpid; childpid = fork(); switch (childpid) { case -1: /* complain fiercely: couldn't fork() */ break; case 0: /* in the child here: let's dump core */ abort(); break; default: /* in the parent, lets wait for the child's death to prevent zombie formation, and then proceed */ waitpid(childpid, NULL, 0); } } Of course, this is all untested vaporware, and you are happily encouraged to check out the man pages on fork, abort and waitpid and include the proper header files. HTH, Eric Meijer -- E.L. Meijer ([EMAIL PROTECTED]) | tel. office +31 40 2472189 Eindhoven Univ. of Technology | tel. lab. +31 40 2475032 Lab. for Catalysis and Inorg. Chem. (TAK) | tel. fax+31 40 2455054 -- Unsubscribe? mail -s unsubscribe [EMAIL PROTECTED] < /dev/null
Re: Dumping Core on Purpose
Yes. use CTRL-\ -- Unsubscribe? mail -s unsubscribe [EMAIL PROTECTED] < /dev/null