satyr  0.28
unwind.h
Go to the documentation of this file.
1 /*
2  core_unwind.h
3 
4  Copyright (C) 2010, 2011, 2012 Red Hat, Inc.
5 
6  This program is free software; you can redistribute it and/or modify
7  it under the terms of the GNU General Public License as published by
8  the Free Software Foundation; either version 2 of the License, or
9  (at your option) any later version.
10 
11  This program is distributed in the hope that it will be useful,
12  but WITHOUT ANY WARRANTY; without even the implied warranty of
13  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14  GNU General Public License for more details.
15 
16  You should have received a copy of the GNU General Public License along
17  with this program; if not, write to the Free Software Foundation, Inc.,
18  51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
19 */
20 #ifndef SATYR_CORE_UNWIND_H
21 #define SATYR_CORE_UNWIND_H
22 
28 #ifdef __cplusplus
29 extern "C" {
30 #endif
31 
32 #include <sys/types.h>
33 
34 struct sr_core_stacktrace;
35 struct sr_gdb_stacktrace;
36 struct sr_core_stracetrace_unwind_state;
37 
38 struct sr_core_stacktrace *
39 sr_parse_coredump(const char *coredump_filename,
40  const char *executable_filename,
41  char **error_message);
42 
43 struct sr_core_stacktrace *
44 sr_core_stacktrace_from_gdb(const char *gdb_output,
45  const char *coredump_filename,
46  const char *executable_filename,
47  char **error_message);
48 
49 /* This function can be used to unwind stack of live ("dying") process, invoked
50  * from the core dump hook (/proc/sys/kernel/core_pattern).
51  *
52  * Beware:
53  *
54  * - It can only unwind one thread of the process, the thread that caused the
55  * terminating signal to be sent. You must supply that thread's tid.
56  * - The function calls close() on stdin, meaning that in the core handler you
57  * cannot access the core image after calling this function.
58  */
59 struct sr_core_stacktrace *
60 sr_core_stacktrace_from_core_hook(pid_t thread_id,
61  const char *executable_filename,
62  int signum,
63  char **error_message);
64 
65 struct sr_core_stracetrace_unwind_state *
66 sr_core_stacktrace_from_core_hook_prepare(pid_t tid, char **error_msg);
67 
68 struct sr_core_stacktrace *
69 sr_core_stacktrace_from_core_hook_generate(pid_t tid,
70  const char *executable,
71  int signum,
72  struct sr_core_stracetrace_unwind_state *state,
73  char **error_msg);
74 
75 void
76 sr_core_stacktrace_unwind_state_free(struct sr_core_stracetrace_unwind_state *state);
77 
78 #ifdef __cplusplus
79 }
80 #endif
81 
82 #endif
A stack trace of a core dump.
A stack trace produced by GDB.