Re: core dump

2019-09-03 Thread ToddAndMargo via perl6-users

*From:* ToddAndMargo via perl6-users 
*Sent:* Friday, August 30, 2019 7:21 PM
*To:* perl6-users@perl.org 
*Subject:* Re: core dump
On 8/9/19 3:41 PM, ToddAndMargo via perl6-users wrote:

Hi All,

Fedora 30
rakudo-0.2019.03-2.fc30.x86_64

I have a weird question.  I need to simulate a core
dump under a bash (ulimit) shell.

Any of you guys know who to get Perl to crash with a
core dump?

I need to prove that core dumps are not
active on my system.  Or if I am mistaken.


Many thanks,
-T



Follow up:

   To trigger a core dump:
   $ kill -s SIGSEGV PID Subsitute your PID
   $ kill -s SIGSEGV $$  Will kill your current shell


Since core dumps have changed significantly under Fedora 30
(systemd), anyone wants my full notes, please ping me
on the subject line and respond on this thread.

-T



On 9/3/19 9:08 AM, Andy Bach wrote:

On my box, man core shows how to dump core using ctrl-backslash
$ perl
^\Quit (core dumped)

It also gives the example of creating a pipeline for core handling (.c 
file text below):

         $ cc -o core_pattern_pipe_test core_pattern_pipe_test.c
            $ su
            Password:
            # echo "|$PWD/core_pattern_pipe_test %p UID=%u GID=%g 
sig=%s" > \

                /proc/sys/kernel/core_pattern
            # exit
            $ sleep 100
            ^\                     # type control-backslash
            Quit (core dumped)
            $ cat core.info
            argc=5
            argc[0]=
            argc[1]=<20575>
            argc[2]=
            argc[3]=
            argc[4]=
            Total bytes in core dump: 282624

I used just
$ perl
^\Quit (core dumped)
$ cat core.info
argc=5
argc[0]=
argc[1]=<3804>
argc[2]=
argc[3]=
argc[4]=
Total bytes in core dump: 602112


   /* core_pattern_pipe_test.c */

        #define _GNU_SOURCE
        #include 
        #include 
        #include 
        #include 
        #include 
        #include 

        #define BUF_SIZE 1024

        int
        main(int argc, char *argv[])
        {
            int tot, j;
            ssize_t nread;
            char buf[BUF_SIZE];
            FILE *fp;
            char cwd[PATH_MAX];

            /* Change our current working directory to that of the
               crashing process */

            snprintf(cwd, PATH_MAX, "/proc/%s/cwd", argv[1]);
            chdir(cwd);

            /* Write output to file "core.info" in that directory */

            fp = fopen("core.info", "w+");
            if (fp == NULL)
                exit(EXIT_FAILURE);

            /* Display command-line arguments given to core_pattern
               pipe program */

            fprintf(fp, "argc=%d\n", argc);
            for (j = 0; j < argc; j++)
                fprintf(fp, "argc[%d]=<%s>\n", j, argv[j]);

            /* Count bytes in standard input (the core dump) */

            tot = 0;
            while ((nread = read(STDIN_FILENO, buf, BUF_SIZE)) > 0)
                tot += nread;
            fprintf(fp, "Total bytes in core dump: %d\n", tot);

            fclose(fp);
            exit(EXIT_SUCCESS);
        }




Are you using system5 or systemd?


Re: core dump

2019-09-03 Thread Andy Bach
On my box, man core shows how to dump core using ctrl-backslash
$ perl
^\Quit (core dumped)

It also gives the example of creating a pipeline for core handling (.c file 
text below):
$ cc -o core_pattern_pipe_test core_pattern_pipe_test.c
   $ su
   Password:
   # echo "|$PWD/core_pattern_pipe_test %p UID=%u GID=%g sig=%s" > \
   /proc/sys/kernel/core_pattern
   # exit
   $ sleep 100
   ^\ # type control-backslash
   Quit (core dumped)
   $ cat core.info
   argc=5
   argc[0]=
   argc[1]=<20575>
   argc[2]=
   argc[3]=
   argc[4]=
   Total bytes in core dump: 282624

I used just
$ perl
^\Quit (core dumped)
$ cat core.info
argc=5
argc[0]=
argc[1]=<3804>
argc[2]=
argc[3]=
argc[4]=
Total bytes in core dump: 602112


  /* core_pattern_pipe_test.c */

   #define _GNU_SOURCE
   #include 
   #include 
   #include 
   #include 
   #include 
   #include 

   #define BUF_SIZE 1024

   int
   main(int argc, char *argv[])
   {
   int tot, j;
   ssize_t nread;
   char buf[BUF_SIZE];
   FILE *fp;
   char cwd[PATH_MAX];

   /* Change our current working directory to that of the
  crashing process */

   snprintf(cwd, PATH_MAX, "/proc/%s/cwd", argv[1]);
   chdir(cwd);

   /* Write output to file "core.info" in that directory */

   fp = fopen("core.info", "w+");
   if (fp == NULL)
   exit(EXIT_FAILURE);

   /* Display command-line arguments given to core_pattern
  pipe program */

   fprintf(fp, "argc=%d\n", argc);
   for (j = 0; j < argc; j++)
   fprintf(fp, "argc[%d]=<%s>\n", j, argv[j]);

   /* Count bytes in standard input (the core dump) */

   tot = 0;
   while ((nread = read(STDIN_FILENO, buf, BUF_SIZE)) > 0)
   tot += nread;
   fprintf(fp, "Total bytes in core dump: %d\n", tot);

   fclose(fp);
   exit(EXIT_SUCCESS);
   }


From: ToddAndMargo via perl6-users 
Sent: Friday, August 30, 2019 7:21 PM
To: perl6-users@perl.org 
Subject: Re: core dump

On 8/9/19 3:41 PM, ToddAndMargo via perl6-users wrote:
> Hi All,
>
> Fedora 30
> rakudo-0.2019.03-2.fc30.x86_64
>
> I have a weird question.  I need to simulate a core
> dump under a bash (ulimit) shell.
>
> Any of you guys know who to get Perl to crash with a
> core dump?
>
> I need to prove that core dumps are not
> active on my system.  Or if I am mistaken.
>
>
> Many thanks,
> -T
>

Follow up:

  To trigger a core dump:
  $ kill -s SIGSEGV PID Subsitute your PID
  $ kill -s SIGSEGV $$  Will kill your current shell


Since core dumps have changed significantly under Fedora 30
(systemd), anyone wants my full notes, please ping me
on the subject line and respond on this thread.

-T


Re: core dump

2019-08-30 Thread ToddAndMargo via perl6-users

On 8/9/19 3:41 PM, ToddAndMargo via perl6-users wrote:

Hi All,

Fedora 30
rakudo-0.2019.03-2.fc30.x86_64

I have a weird question.  I need to simulate a core
dump under a bash (ulimit) shell.

Any of you guys know who to get Perl to crash with a
core dump?

I need to prove that core dumps are not
active on my system.  Or if I am mistaken.


Many thanks,
-T



Follow up:

 To trigger a core dump:
 $ kill -s SIGSEGV PID Subsitute your PID
 $ kill -s SIGSEGV $$  Will kill your current shell


Since core dumps have changed significantly under Fedora 30
(systemd), anyone wants my full notes, please ping me
on the subject line and respond on this thread.

-T


core dump

2019-08-09 Thread ToddAndMargo via perl6-users

Hi All,

Fedora 30
rakudo-0.2019.03-2.fc30.x86_64

I have a weird question.  I need to simulate a core
dump under a bash (ulimit) shell.

Any of you guys know who to get Perl to crash with a
core dump?

I need to prove that core dumps are not
active on my system.  Or if I am mistaken.


Many thanks,
-T

--
~
When we ask for advice, we are usually looking for an accomplice.
   --  Charles Varlet de La Grange
~