1
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*-
3
* Dan Williams <dcbw@redhat.com>
5
* This program is free software; you can redistribute it and/or modify
6
* it under the terms of the GNU General Public License as published by
7
* the Free Software Foundation; either version 2 of the License, or
8
* (at your option) any later version.
10
* This program is distributed in the hope that it will be useful,
11
* but WITHOUT ANY WARRANTY; without even the implied warranty of
12
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
* GNU General Public License for more details.
15
* You should have received a copy of the GNU General Public License
16
* along with this program; if not, write to the Free Software
17
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
19
* (C) Copyright 2006 Red Hat, Inc.
32
int main (int argc, char ** argv)
44
char * args[] = { "gdb",
47
"--command=" DATADIR "/gdm/gdb-cmd",
51
snprintf (gdm_pid, sizeof (gdm_pid), "--pid=%d", getppid ());
52
args[4] = &gdm_pid[0];
54
res = g_spawn_async_with_pipes (NULL,
57
G_SPAWN_SEARCH_PATH | G_SPAWN_DO_NOT_REAP_CHILD,
66
g_warning ("Unable to get backtrace: %s", error->message);
71
options = LOG_PID | LOG_CONS;
73
options |= LOG_PERROR;
76
openlog ("gdm", options, LOG_DAEMON);
77
syslog (LOG_CRIT, "******************* START **********************************");
80
bytes_read = read (out, line, sizeof (line) - 1);
83
char *start = &line[0];
85
/* Can't just funnel the output to syslog, have to do a separate
86
* syslog () for each line in the output.
88
line[bytes_read] = '\0';
89
while (*end != '\0') {
92
syslog (LOG_CRIT, "%s", start);
97
} else if ((bytes_read <= 0) || ((errno != EINTR) && (errno != EAGAIN))) {
101
syslog (LOG_CRIT, "******************* END **********************************");
103
waitpid (gdb_pid, &gdb_stat, 0);