VirtualBox

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

Last change on this file since 41800 was 41268, checked in by vboxsync, 13 years ago

Working on making DTrace grok VM+CPUM and VMCPU+CPUMCPU.

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