lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 18.04.4 LTS
Release: 18.04
Codename: bionic
***** 来源 ******
// This is a disposable program for expermentation
#include <stdio.h>
#include <time.h>
int i;
char c;
int main() {
//float now = time(NULL);
int now = time(NULL);
for (i = 32; i < 66; ++i){
c = i ;
printf("**********\n");
printf(" %d\n",i);
printf(" %c\n", c);
printf("^^^^^^^^^^\n");
//printf("Now: %f \n", now);
printf("Now: %d \n", now);
} /* end for */
// The four lines below were added in hopes of creating a core dump.
int foo = 1;
int bar = 0;
int result = foo/bar;
printf("Result: %d", result);
return (0);
} // end main..
************* 来源结束 ********
从命令行运行 gcc。
.../miscplayground$ gcc -g -o foobar play.c
运行编译的代码。
miscplayground$ ./foobar
32
^^^^^^^^^^
Now: 1605890415
**********
33
!
^^^^^^^^^^
Now: 1605890415
****** 注意:输出的中间部分已被剪切,目的是删除与问题无关的数据。******************** 结束注意 *************************************
^^^^^^^^^^
Now: 1605890415
**********
64
@
^^^^^^^^^^
Now: 1605890415
**********
65
A
^^^^^^^^^^
Now: 1605890415
Floating point exception (core dumped)
(base)
运行“sudo updatedb”然后重新启动以确保数据库已被读取后,我运行
$ sudo locate -i coredump | grep -i foobar
[sudo] password for kindness:
(base) kindness@kindness-Latitude-E6220:~/development/go/Go_pdf$
**** 注意,没有返回结果。 *******