in reply to Re^2: How to find perl line after segfault.
in thread How to find perl line after segfault.

Generally, when tracking down a segfault, all you are interested in is the last few lines of the output telling you which sub faulted; and possibly how you got there; so I set it running and minimise the session. When I go back a while later, the information I need is left right there on the last line (or last few lines) of the screen.

If you do redirect to a file, then tail theLog gives you the same information.


With the rise and rise of 'Social' network sites: 'Computers are making people easier to use everyday'
Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
"Science is about questioning the status quo. Questioning authority". I'm with torvalds on this
In the absence of evidence, opinion is indistinguishable from prejudice. Agile (and TDD) debunked

Replies are listed 'Best First'.
Re^4: How to find perl line after segfault.
by Steve_BZ (Chaplain) on Feb 14, 2015 at 18:43 UTC

    Hi Browser UK,

    perl -d:CallTrace i-Mage.pl 2> trace.txt

    absolutely did the job and found the problem immediately. It was a Wx::Timer process that I had forgotten about starting off a little early. There seemed to be very little performance overhead, maybe the program loaded a bit slower but after that it seemed about the same as always.

    Now I'd like to call it from open3 like this:

    my @array = qw(perl -d:CallTrace i-Mage.pl); my $child_pid = open3( '<&STDIN', ">trace.txt", *CHILD_ERROR, @array );

    The code starts, but there is no sign of "trace.txt".

    Not sure where I'vwe gone wrong.

    Regards

    Steve.

      Sorry, but I never had any luck at all with open3() when I first tried it, as a consequence I never use it. You'll need help from someone who does.

      As an aside; I wasn't aware that open3(), accepted strings for the file handles. Nor does anything in the documentation lead me to believe it does.


      With the rise and rise of 'Social' network sites: 'Computers are making people easier to use everyday'
      Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
      "Science is about questioning the status quo. Questioning authority". I'm with torvalds on this
      In the absence of evidence, opinion is indistinguishable from prejudice. Agile (and TDD) debunked

        Ok, maybe that's it.

        Actually, I notice now that CallTrace outputs to STDERR not STDOUT, so it wouldn't work for that reason either.

        Thanks for your help.