VirtualBox

source: vbox/trunk/src/VBox/Runtime/testcase/tstRTCoreDump.h@ 57637

Last change on this file since 57637 was 56290, checked in by vboxsync, 9 years ago

IPRT: Updated (C) year.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id
File size: 6.8 KB
Line 
1/* $Id: tstRTCoreDump.h 56290 2015-06-09 14:01:31Z vboxsync $ */
2/** @file
3 * IPRT Testcase - Core dump, header.
4 */
5
6/*
7 * Copyright (C) 2010-2015 Oracle Corporation
8 *
9 * This file is part of VirtualBox Open Source Edition (OSE), as
10 * available from http://www.virtualbox.org. This file is free software;
11 * you can redistribute it and/or modify it under the terms of the GNU
12 * General Public License (GPL) as published by the Free Software
13 * Foundation, in version 2 as it comes in the "COPYING" file of the
14 * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
15 * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
16 *
17 * The contents of this file may alternatively be used under the terms
18 * of the Common Development and Distribution License Version 1.0
19 * (CDDL) only, as it comes in the "COPYING.CDDL" file of the
20 * VirtualBox OSE distribution, in which case the provisions of the
21 * CDDL are applicable instead of those of the GPL.
22 *
23 * You may elect to license modified versions of this file under the
24 * terms and conditions of either the GPL or the CDDL or both.
25 */
26
27#include <iprt/process.h>
28#include <iprt/file.h>
29
30#ifdef RT_OS_SOLARIS
31# if defined(RT_ARCH_X86) && _FILE_OFFSET_BITS==64
32/*
33 * Solaris' procfs cannot be used with large file environment in 32-bit.
34 */
35# undef _FILE_OFFSET_BITS
36# define _FILE_OFFSET_BITS 32
37# include <procfs.h>
38# include <sys/procfs.h>
39# include <sys/old_procfs.h>
40# undef _FILE_OFFSET_BITS
41# define _FILE_OFFSET_BITS 64
42#else
43# include <procfs.h>
44# include <sys/procfs.h>
45# include <sys/old_procfs.h>
46#endif
47# include <limits.h>
48# include <thread.h>
49# include <sys/auxv.h>
50# include <sys/lwp.h>
51# include <sys/zone.h>
52# include <sys/utsname.h>
53
54#ifdef RT_ARCH_AMD64
55# define _ELF64
56# undef _ELF32_COMPAT
57#endif
58# include <sys/machelf.h>
59# include <sys/corectl.h>
60#endif
61
62/**
63 * ELF NOTE header.
64 */
65typedef struct ELFNOTEHDR
66{
67 Nhdr Hdr; /* Header of NOTE section */
68 char achName[8]; /* Name of NOTE section */
69} ELFNOTEHDR;
70typedef ELFNOTEHDR *PELFNOTEHDR;
71
72#ifdef RT_OS_SOLARIS
73typedef struct VBOXSOLMAPINFO
74{
75 prmap_t pMap; /* Proc description of this mapping */
76 int fError; /* Any error reading this mapping (errno) */
77 struct VBOXSOLMAPINFO *pNext; /* Pointer to the next mapping */
78} VBOXSOLMAPINFO;
79typedef VBOXSOLMAPINFO *PVBOXSOLMAPINFO;
80
81typedef struct VBOXSOLTHREADINFO
82{
83 lwpsinfo_t Info; /* Proc description of this thread */
84 lwpstatus_t *pStatus; /* Proc description of this thread's status (can be NULL, zombie lwp) */
85 struct VBOXSOLTHREADINFO *pNext; /* Pointer to the next thread */
86} VBOXSOLTHREADINFO;
87typedef VBOXSOLTHREADINFO *PVBOXSOLTHREADINFO;
88#endif
89
90typedef int (*PFNCOREREADER)(RTFILE hFile, void *pv, size_t cb);
91typedef int (*PFNCOREWRITER)(RTFILE hFile, const void *pcv, size_t cb);
92
93typedef struct VBOXPROCESS
94{
95 RTPROCESS Process; /* The pid of the process */
96 char szExecPath[PATH_MAX]; /* Path of the executable */
97 char *pszExecName; /* Name of the executable file */
98#ifdef RT_OS_SOLARIS
99 psinfo_t ProcInfo; /* Process info. */
100 prpsinfo_t ProcInfoOld; /* Process info. Older version (for GDB compat.) */
101 pstatus_t ProcStatus; /* Process status info. */
102 thread_t hCurThread; /* The current thread */
103 ucontext_t *pCurThreadCtx; /* Context info. of current thread before starting to dump */
104 RTFILE hAs; /* proc/<pid/as file handle */
105 auxv_t *pAuxVecs; /* Aux vector of process */
106 int cAuxVecs; /* Number of aux vector entries */
107 PVBOXSOLMAPINFO pMapInfoHead; /* Pointer to the head of list of mappings */
108 uint32_t cMappings; /* Number of mappings (count of pMapInfoHead list) */
109 PVBOXSOLTHREADINFO pThreadInfoHead; /* Pointer to the head of list of threads */
110 uint64_t cThreads; /* Number of threads (count of pThreadInfoHead list) */
111 char szPlatform[SYS_NMLN]; /* Platform name */
112 char szZoneName[ZONENAME_MAX]; /* Zone name */
113 struct utsname UtsName; /* UTS name */
114 void *pvCred; /* Process credential info. */
115 size_t cbCred; /* Size of process credential info. */
116 void *pvLdt; /* Process LDT info. */
117 size_t cbLdt; /* Size of the LDT info. */
118 prpriv_t *pPriv; /* Process privilege info. */
119 size_t cbPriv; /* Size of process privilege info. */
120 const priv_impl_info_t *pcPrivImpl; /* Process privilege implementation info. (opaque handle) */
121 core_content_t CoreContent; /* What information goes in the core */
122#else
123# error Port Me!
124#endif
125
126} VBOXPROCESS;
127typedef VBOXPROCESS *PVBOXPROCESS;
128
129typedef struct VBOXCORE
130{
131 char szCorePath[PATH_MAX]; /* Path of the core file */
132 VBOXPROCESS VBoxProc; /* Current process information */
133 void *pvCore; /* Pointer to memory area during dumping */
134 size_t cbCore; /* Size of memory area during dumping */
135 void *pvFree; /* Pointer to base of free range in preallocated memory area */
136 bool fIsValid; /* Whether core information has been fully collected */
137 PFNCOREREADER pfnReader; /* Reader function */
138 PFNCOREWRITER pfnWriter; /* Writer function */
139 RTFILE hCoreFile; /* Core file (used only while writing the core) */
140 RTFOFF offWrite; /* Segment/section offset (used only while writing the core) */
141} VBOXCORE;
142typedef VBOXCORE *PVBOXCORE;
143
144typedef int (*PFNCOREACCUMULATOR)(PVBOXCORE pVBoxCOre);
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