how to enable core dump in csh

转载:https://kb.iu.edu/d/awdh

If you're using bash or ksh, use the ulimit command to check the stack size:

[dartmaul@h2 ~]$ ulimit -a
core file size          (blocks, -c) 0
data seg size           (kbytes, -d) unlimited
scheduling priority             (-e) 0
file size               (blocks, -f) unlimited
pending signals                 (-i) 258007
max locked memory       (kbytes, -l) 64
max memory size         (kbytes, -m) unlimited
open files                      (-n) 1024
pipe size            (512 bytes, -p) 8
POSIX message queues     (bytes, -q) 819200
real-time priority              (-r) 0
stack size              (kbytes, -s) 10240
cpu time               (seconds, -t) unlimited
max user processes              (-u) 1024
virtual memory          (kbytes, -v) unlimited
file locks                      (-x) unlimited

If you're using tcsh or csh, use limit:

[palpatin@h1 ~]$ limit
cputime      unlimited
filesize     unlimited
datasize     unlimited
stacksize    unlimited
coredumpsize 0 kbytes
memoryuse    unlimited
vmemoryuse   4194304 kbytes
descriptors  4096
memorylocked unlimited
maxproc      1024

In the first example, note that the stack size is set to 10240. Edit the initialization file for your shell to set the stack size to unlimited, and then try running your job again:

ShellInitialization fileCommand
bash.bashrculimit -s unlimited
ksh.profileulimit -s unlimited
csh.cshrclimit stacksize unlimited
tcsh.cshrclimit stacksize unlimited

Once you've set your stack size to any value other than unlimited, you cannot raise it above that value in your current process. You must log out and log in again to reset your stack size to a higher value. In this situation, ulimit will return an error that looks like:

-bash: ulimit: stack size: cannot modify limit:
Operation not permitted

By default, most versions of Linux set the core file size to zero. To generate a core file when you run a job on a research supercomputer at IU, use ulimit or limit to set the file size to unlimited:

ShellInitialization fileCommand
bash.bashrculimit -c unlimited
ksh.profileulimit -c unlimited
csh.cshrclimit coredumpsize unlimited
tcsh.cshrclimit coredumpsize unlimited

=====================================

How to use the core dump file?

suppose you have a file main.cpp, and this file will write a value to a illegal address, which not allowed to write.

$ gdb -g main.cpp  #build main.cpp, don't forget the -g option.

$ ./a.out     #will generate a core dump file, named core.xxx

$ gdb a.out core.xxx   #the program will run and stop in the segment fault happened place.

also can refer to this page: http://sunyongfeng.com/201609/programmer/tools/coredump

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值