VirtualBox

source: vbox/trunk/src/VBox/VMM/testcase/tstVMStructDTrace.cpp@ 76553

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

scm --update-copyright-year

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 4.0 KB
Line 
1/* $Id: tstVMStructDTrace.cpp 76553 2019-01-01 01:45:53Z vboxsync $ */
2/** @file
3 * tstVMMStructDTrace - Generates the DTrace test scripts for check that C/C++
4 * and DTrace has the same understand of the VM, VMCPU and
5 * other structures.
6 */
7
8/*
9 * Copyright (C) 2006-2019 Oracle Corporation
10 *
11 * This file is part of VirtualBox Open Source Edition (OSE), as
12 * available from http://www.virtualbox.org. This file is free software;
13 * you can redistribute it and/or modify it under the terms of the GNU
14 * General Public License (GPL) as published by the Free Software
15 * Foundation, in version 2 as it comes in the "COPYING" file of the
16 * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
17 * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
18 */
19
20
21/*********************************************************************************************************************************
22* Header Files *
23*********************************************************************************************************************************/
24#define IN_TSTVMSTRUCT 1
25#define IN_TSTVMSTRUCTGC 1
26#include <VBox/vmm/cfgm.h>
27#include <VBox/vmm/cpum.h>
28#include <VBox/vmm/mm.h>
29#include <VBox/vmm/pgm.h>
30#include <VBox/vmm/selm.h>
31#include <VBox/vmm/trpm.h>
32#include <VBox/vmm/vmm.h>
33#include <VBox/vmm/stam.h>
34#include "PDMInternal.h"
35#include <VBox/vmm/pdm.h>
36#include "CFGMInternal.h"
37#include "CPUMInternal.h"
38#include "MMInternal.h"
39#include "PGMInternal.h"
40#include "SELMInternal.h"
41#include "TRPMInternal.h"
42#include "TMInternal.h"
43#include "IOMInternal.h"
44#include "REMInternal.h"
45#include "HMInternal.h"
46#include "APICInternal.h"
47#include "VMMInternal.h"
48#include "DBGFInternal.h"
49#include "GIMInternal.h"
50#include "STAMInternal.h"
51#include "EMInternal.h"
52#include "IEMInternal.h"
53#include "REMInternal.h"
54#include "NEMInternal.h"
55#ifdef VBOX_WITH_RAW_MODE
56# include "CSAMInternal.h"
57# include "PATMInternal.h"
58#endif
59#include <VBox/vmm/vm.h>
60#include <VBox/param.h>
61#include <iprt/x86.h>
62#include <iprt/assert.h>
63
64/* we don't use iprt here because we wish to run without trouble. */
65#include <stdio.h>
66
67
68int main()
69{
70 /*
71 * File header and pragmas.
72 */
73 printf("#pragma D option quiet\n");
74// printf("#pragma D depends_on library x86.d\n");
75// printf("#pragma D depends_on library cpumctx.d\n");
76// printf("#pragma D depends_on library CPUMInternal.d\n");
77// printf("#pragma D depends_on library vm.d\n");
78
79 printf("int g_cErrors;\n"
80 "\n"
81 "dtrace:::BEGIN\n"
82 "{\n"
83 " g_cErrors = 0;\n"
84 "}\n"
85 "\n"
86 );
87
88 /*
89 * Test generator macros.
90 */
91#define GEN_CHECK_SIZE(s) \
92 printf("dtrace:::BEGIN\n" \
93 "/sizeof(" #s ") != %u/\n" \
94 "{\n" \
95 " printf(\"error: sizeof(" #s ") should be %u, not %%u\\n\", sizeof(" #s "));\n" \
96 " g_cErrors++;\n" \
97 "}\n" \
98 "\n", \
99 (unsigned)sizeof(s), (unsigned)sizeof(s))
100
101#if 1
102# define GEN_CHECK_OFF(s, m) \
103 printf("dtrace:::BEGIN\n" \
104 "/offsetof(" #s ", " #m ") != %u/\n" \
105 "{\n" \
106 " printf(\"error: offsetof(" #s ", " #m ") should be %u, not %%u\\n\", offsetof(" #s ", " #m "));\n" \
107 " g_cErrors++;\n" \
108 "}\n" \
109 "\n", \
110 (unsigned)RT_OFFSETOF(s, m), (unsigned)RT_OFFSETOF(s, m))
111
112#else
113# define GEN_CHECK_OFF(s, m) do { } while (0)
114#endif
115
116#define GEN_CHECK_OFF_DOT(s, m) do { } while (0)
117
118
119 /*
120 * Body.
121 */
122#define VBOX_FOR_DTRACE_LIB
123#include "tstVMStruct.h"
124
125 /*
126 * Footer.
127 */
128 printf("dtrace:::BEGIN\n"
129 "/g_cErrors != 0/\n"
130 "{\n"
131 " printf(\"%%u errors!\\n\", g_cErrors);\n"
132 " exit(1);\n"
133 "}\n"
134 "\n"
135 "dtrace:::BEGIN\n"
136 "{\n"
137 " printf(\"Success!\\n\");\n"
138 " exit(0);\n"
139 "}\n"
140 "\n"
141 );
142
143
144 return (0);
145}
146
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