Devel-bt

 view release on metacpan or  search on metacpan

bt.xs  view on Meta::CPAN

static void
stack_trace (char **args)
{
    pid_t pid;
    int in_fd[2], out_fd[2], idx, state;
    fd_set fdset;
    char buffer[4096];

    /* stop gdb from wrapping lines */
    snprintf(buffer, sizeof(buffer), "%u", (unsigned int)sizeof(buffer));
    setenv("COLUMNS", buffer, 1);

    if ((pipe(in_fd) == -1) || (pipe(out_fd) == -1)) {
        perror("unable to open pipe");
        _exit(0);
    }

    pid = fork();
    if (pid == 0) {
        /* double fork+_exit so we can properly detach from the parent
           process. this is important because some platforms (only OpenBSD for



( run in 0.381 second using v1.01-cache-2.11-cpan-3989ada0592 )