VirtualBox

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

Last change on this file since 50653 was 45528, checked in by vboxsync, 11 years ago

VBOX_WITH_RAW_MODE changes.

  • 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 45528 2013-04-12 17:32:57Z 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-2012 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 "STAMInternal.h"
48#include "EMInternal.h"
49#include "IEMInternal.h"
50#include "REMInternal.h"
51#ifdef VBOX_WITH_RAW_MODE
52# include "CSAMInternal.h"
53# include "PATMInternal.h"
54#endif
55#include <VBox/vmm/vm.h>
56#include <VBox/param.h>
57#include <iprt/x86.h>
58#include <iprt/assert.h>
59
60/* we don't use iprt here because we wish to run without trouble. */
61#include <stdio.h>
62
63
64int main()
65{
66 /*
67 * File header and pragmas.
68 */
69 printf("#pragma D option quiet\n");
70// printf("#pragma D depends_on library x86.d\n");
71// printf("#pragma D depends_on library cpumctx.d\n");
72// printf("#pragma D depends_on library CPUMInternal.d\n");
73// printf("#pragma D depends_on library vm.d\n");
74
75 printf("int g_cErrors;\n"
76 "\n"
77 "dtrace:::BEGIN\n"
78 "{\n"
79 " g_cErrors = 0;\n"
80 "}\n"
81 "\n"
82 );
83
84 /*
85 * Test generator macros.
86 */
87#define GEN_CHECK_SIZE(s) \
88 printf("dtrace:::BEGIN\n" \
89 "/sizeof(" #s ") != %u/\n" \
90 "{\n" \
91 " printf(\"error: sizeof(" #s ") should be %u, not %%u\\n\", sizeof(" #s "));\n" \
92 " g_cErrors++;\n" \
93 "}\n" \
94 "\n", \
95 (unsigned)sizeof(s), (unsigned)sizeof(s))
96
97#if 1
98# define GEN_CHECK_OFF(s, m) \
99 printf("dtrace:::BEGIN\n" \
100 "/offsetof(" #s ", " #m ") != %u/\n" \
101 "{\n" \
102 " printf(\"error: offsetof(" #s ", " #m ") should be %u, not %%u\\n\", offsetof(" #s ", " #m "));\n" \
103 " g_cErrors++;\n" \
104 "}\n" \
105 "\n", \
106 (unsigned)RT_OFFSETOF(s, m), (unsigned)RT_OFFSETOF(s, m))
107
108#else
109# define GEN_CHECK_OFF(s, m) do { } while (0)
110#endif
111
112#define GEN_CHECK_OFF_DOT(s, m) do { } while (0)
113
114
115 /*
116 * Body.
117 */
118#define VBOX_FOR_DTRACE_LIB
119#include "tstVMStruct.h"
120
121 /*
122 * Footer.
123 */
124 printf("dtrace:::BEGIN\n"
125 "/g_cErrors != 0/\n"
126 "{\n"
127 " printf(\"%%u errors!\\n\", g_cErrors);\n"
128 " exit(1);\n"
129 "}\n"
130 "\n"
131 "dtrace:::BEGIN\n"
132 "{\n"
133 " printf(\"Success!\\n\");\n"
134 " exit(0);\n"
135 "}\n"
136 "\n"
137 );
138
139
140 return (0);
141}
142
Note: See TracBrowser for help on using the repository browser.

© 2023 Oracle
ContactPrivacy policyTerms of Use