VirtualBox

source: vbox/trunk/include/iprt/coredumper.h@ 81025

Last change on this file since 81025 was 76585, checked in by vboxsync, 6 years ago

*: scm --fix-header-guard-endif

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 3.2 KB
Line 
1/** @file
2 * IPRT - Core Dumper.
3 */
4
5/*
6 * Copyright (C) 2010-2019 Oracle Corporation
7 *
8 * This file is part of VirtualBox Open Source Edition (OSE), as
9 * available from http://www.virtualbox.org. This file is free software;
10 * you can redistribute it and/or modify it under the terms of the GNU
11 * General Public License (GPL) as published by the Free Software
12 * Foundation, in version 2 as it comes in the "COPYING" file of the
13 * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
14 * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
15 *
16 * The contents of this file may alternatively be used under the terms
17 * of the Common Development and Distribution License Version 1.0
18 * (CDDL) only, as it comes in the "COPYING.CDDL" file of the
19 * VirtualBox OSE distribution, in which case the provisions of the
20 * CDDL are applicable instead of those of the GPL.
21 *
22 * You may elect to license modified versions of this file under the
23 * terms and conditions of either the GPL or the CDDL or both.
24 */
25
26#ifndef IPRT_INCLUDED_coredumper_h
27#define IPRT_INCLUDED_coredumper_h
28#ifndef RT_WITHOUT_PRAGMA_ONCE
29# pragma once
30#endif
31
32#include <iprt/cdefs.h>
33#include <iprt/types.h>
34
35RT_C_DECLS_BEGIN
36
37/** @defgroup grp_rt_coredumper RTCoreDumper - Core Dumper.
38 * @ingroup grp_rt
39 * @{
40 */
41
42/** @name RTCoreDumperSetup flags
43 * @{ */
44/** Override system core dumper. Registers handlers for
45 * SIGSEGV/SIGTRAP/SIGBUS. */
46#define RTCOREDUMPER_FLAGS_REPLACE_SYSTEM_DUMP RT_BIT(0)
47/** Allow taking live process dumps (without killing process). Registers handler
48 * for SIGUSR2. */
49#define RTCOREDUMPER_FLAGS_LIVE_CORE RT_BIT(1)
50/** @} */
51
52/**
53 * Take a core dump of the current process without terminating it.
54 *
55 * @returns IPRT status code.
56 * @param pszOutputFile Name of the core file. If NULL use the
57 * default naming scheme.
58 * @param fLiveCore When true, the process is not killed after
59 * taking a core. Otherwise it will be killed. This
60 * works in conjuction with the flags set during
61 * RTCoreDumperSetup().
62 */
63RTDECL(int) RTCoreDumperTakeDump(const char *pszOutputFile, bool fLiveCore);
64
65/**
66 * Sets up and enables the core dumper.
67 *
68 * Installs signal / unhandled exception handlers for catching fatal errors
69 * that should result in a core dump. If you wish to install your own handlers
70 * you should do that after calling this function and make sure you pass on
71 * events you don't handle.
72 *
73 * This can be called multiple times to change the settings without needing to
74 * call RTCoreDumperDisable in between.
75 *
76 * @param pszOutputDir The directory to store the cores in. If NULL
77 * the current directory will be used.
78 * @param fFlags Setup flags, 0 in NOT a valid flag, it must be
79 * one or more of RTCOREDUMPER_FLAGS_*.
80 */
81RTDECL(int) RTCoreDumperSetup(const char *pszOutputDir, uint32_t fFlags);
82
83/**
84 * Disables the core dumper, i.e. undoes what RTCoreDumperSetup did.
85 *
86 * @returns IPRT status code.
87 */
88RTDECL(int) RTCoreDumperDisable(void);
89
90/** @} */
91
92RT_C_DECLS_END
93
94#endif /* !IPRT_INCLUDED_coredumper_h */
95
Note: See TracBrowser for help on using the repository browser.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette