VirtualBox

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

Last change on this file since 56296 was 56287, checked in by vboxsync, 9 years ago

VMM: Updated (C) year.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 3.8 KB
Line 
1/* $Id: tstVMStructDTrace.cpp 56287 2015-06-09 11:15:22Z 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-2015 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_TSTVMSTRUCTGC 1
25#include <VBox/vmm/cfgm.h>
26#include <VBox/vmm/cpum.h>
27#include <VBox/vmm/mm.h>
28#include <VBox/vmm/pgm.h>
29#include <VBox/vmm/selm.h>
30#include <VBox/vmm/trpm.h>
31#include <VBox/vmm/vmm.h>
32#include <VBox/vmm/stam.h>
33#include "PDMInternal.h"
34#include <VBox/vmm/pdm.h>
35#include "CFGMInternal.h"
36#include "CPUMInternal.h"
37#include "MMInternal.h"
38#include "PGMInternal.h"
39#include "SELMInternal.h"
40#include "TRPMInternal.h"
41#include "TMInternal.h"
42#include "IOMInternal.h"
43#include "REMInternal.h"
44#include "HMInternal.h"
45#include "VMMInternal.h"
46#include "DBGFInternal.h"
47#include "GIMInternal.h"
48#include "STAMInternal.h"
49#include "EMInternal.h"
50#include "IEMInternal.h"
51#include "REMInternal.h"
52#ifdef VBOX_WITH_RAW_MODE
53# include "CSAMInternal.h"
54# include "PATMInternal.h"
55#endif
56#include <VBox/vmm/vm.h>
57#include <VBox/param.h>
58#include <iprt/x86.h>
59#include <iprt/assert.h>
60
61/* we don't use iprt here because we wish to run without trouble. */
62#include <stdio.h>
63
64
65int main()
66{
67 /*
68 * File header and pragmas.
69 */
70 printf("#pragma D option quiet\n");
71// printf("#pragma D depends_on library x86.d\n");
72// printf("#pragma D depends_on library cpumctx.d\n");
73// printf("#pragma D depends_on library CPUMInternal.d\n");
74// printf("#pragma D depends_on library vm.d\n");
75
76 printf("int g_cErrors;\n"
77 "\n"
78 "dtrace:::BEGIN\n"
79 "{\n"
80 " g_cErrors = 0;\n"
81 "}\n"
82 "\n"
83 );
84
85 /*
86 * Test generator macros.
87 */
88#define GEN_CHECK_SIZE(s) \
89 printf("dtrace:::BEGIN\n" \
90 "/sizeof(" #s ") != %u/\n" \
91 "{\n" \
92 " printf(\"error: sizeof(" #s ") should be %u, not %%u\\n\", sizeof(" #s "));\n" \
93 " g_cErrors++;\n" \
94 "}\n" \
95 "\n", \
96 (unsigned)sizeof(s), (unsigned)sizeof(s))
97
98#if 1
99# define GEN_CHECK_OFF(s, m) \
100 printf("dtrace:::BEGIN\n" \
101 "/offsetof(" #s ", " #m ") != %u/\n" \
102 "{\n" \
103 " printf(\"error: offsetof(" #s ", " #m ") should be %u, not %%u\\n\", offsetof(" #s ", " #m "));\n" \
104 " g_cErrors++;\n" \
105 "}\n" \
106 "\n", \
107 (unsigned)RT_OFFSETOF(s, m), (unsigned)RT_OFFSETOF(s, m))
108
109#else
110# define GEN_CHECK_OFF(s, m) do { } while (0)
111#endif
112
113#define GEN_CHECK_OFF_DOT(s, m) do { } while (0)
114
115
116 /*
117 * Body.
118 */
119#define VBOX_FOR_DTRACE_LIB
120#include "tstVMStruct.h"
121
122 /*
123 * Footer.
124 */
125 printf("dtrace:::BEGIN\n"
126 "/g_cErrors != 0/\n"
127 "{\n"
128 " printf(\"%%u errors!\\n\", g_cErrors);\n"
129 " exit(1);\n"
130 "}\n"
131 "\n"
132 "dtrace:::BEGIN\n"
133 "{\n"
134 " printf(\"Success!\\n\");\n"
135 " exit(0);\n"
136 "}\n"
137 "\n"
138 );
139
140
141 return (0);
142}
143
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