2007-05-24 03:28:26

by gshan

[permalink] [raw]
Subject: How to produce a core

This morning, I tried command "kill -7 [pid]" but didn't see the core
file. Anybody has ideas?

bash-2.05b# ps
PID USER COMMAND
1 0 init
2 0 [ksoftirqd/0]
3 0 [watchdog/0]
4 0 [events/0]
5 0 [khelper]
6 0 [kthread]
36 0 [kblockd/0]
38 0 [kseriod]
50 0 [pdflush]
51 0 [pdflush]
52 0 [kswapd0]
53 0 [aio/0]
171 0 -sh
174 0 [rpciod/0]
182 0 bash
198 0 gdi_trans 16777471 0 0 12 1 0 10000 8000 0 0 0 1 1
204 0 ps
bash-2.05b# kill -7 198
bash-2.05b# ps
PID USER COMMAND
1 0 init
2 0 [ksoftirqd/0]
3 0 [watchdog/0]
4 0 [events/0]
5 0 [khelper]
6 0 [kthread]
36 0 [kblockd/0]
38 0 [kseriod]
50 0 [pdflush]
51 0 [pdflush]
52 0 [kswapd0]
53 0 [aio/0]
171 0 -sh
174 0 [rpciod/0]
182 0 bash
205 0 ps
[1]+ Bus error gdi_trans 16777471 0 0 12 1 0 10000 8000 0 0 0 1 1



2007-05-24 03:49:58

by Willy Tarreau

[permalink] [raw]
Subject: Re: How to produce a core

On Thu, May 24, 2007 at 11:28:15AM +0800, gshan wrote:
> This morning, I tried command "kill -7 [pid]" but didn't see the core
> file. Anybody has ideas?

do the following before starting your program :

# ulimit -c unlimited

You can check before and after that the core size changed from 0 to
"unlimited" :

# ulimit -a

Willy

2007-05-24 04:23:28

by gshan

[permalink] [raw]
Subject: Re: How to produce a core

Willy Tarreau wrote:
> On Thu, May 24, 2007 at 11:28:15AM +0800, gshan wrote:
>
>> This morning, I tried command "kill -7 [pid]" but didn't see the core
>> file. Anybody has ideas?
>>
>
> do the following before starting your program :
>
> # ulimit -c unlimited
>
> You can check before and after that the core size changed from 0 to
> "unlimited" :
>
> # ulimit -a
>
> Willy
>
>
Willy,

Thank you very much. The command "kill -7 [pid]" really works with
"ulimit -c unlimited"

# /bin/sh
# ps
PID USER COMMAND
1 0 init
2 0 [ksoftirqd/0]
3 0 [desched/0]
4 0 [events/0]
5 0 [khelper]
10 0 [kthread]
31 0 [kblockd/0]
60 0 [pdflush]
61 0 [pdflush]
63 0 [aio/0]
62 0 [kswapd0]
64 0 [jfsIO]
65 0 [jfsCommit]
66 0 [jfsSync]
67 0 [xfslogd/0]
68 0 [xfsdatad/0]
69 0 [xfsbufd]
706 0 [mtdblockd]
730 0 -sh
788 0 /bin/sh
789 0 ps
# ulimit -c unlimited
# kill -7 788
Bus error (core dumped)
# ls -al
drwxr-xr-x 12 0 0 0 Jan 1 00:55 .
drwxr-xr-x 12 0 0 0 Jan 1 00:55 ..
drwxr-xr-x 2 1000 1000 0 Jan 1 00:00 bin
-rw------- 1 0 0 417792 Jan 1 00:55
core <<< Here is the corefile
drwxr-xr-x 2 0 0 0 Jan 1 00:00 dev
drwxr-xr-x 3 0 0 0 Jan 1 00:00 etc
lrwxrwxrwx 1 0 0 12 Jan 1 00:00 init -> /bin/busybox
drwxr-xr-x 2 0 0 0 Jan 1 00:00 lib
drwxr-xr-x 2 0 0 0 Jan 1 00:00 misc
dr-xr-xr-x 32 0 0 0 Jan 1 00:00 proc
drwx------ 2 0 0 0 Jan 1 00:00 root
drwxr-xr-x 2 0 0 0 Jan 1 00:00 sbin
drwxr-xr-x 2 0 0 0 Jan 1 00:00 sys
drwxr-xr-x 4 0 0 0 Jan 1 00:00 usr
#

Thanks,
Gavin