1 | /** @file
|
---|
2 | * DBGF - Debugger Facility.
|
---|
3 | */
|
---|
4 |
|
---|
5 | /*
|
---|
6 | * Copyright (C) 2006-2015 Oracle Corporation
|
---|
7 | *
|
---|
8 | * This file is part of VirtualBox Open Source Edition (OSE), as
|
---|
9 | * available from http://www.virtualbox.org. This file is free software;
|
---|
10 | * you can redistribute it and/or modify it under the terms of the GNU
|
---|
11 | * General Public License (GPL) as published by the Free Software
|
---|
12 | * Foundation, in version 2 as it comes in the "COPYING" file of the
|
---|
13 | * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
|
---|
14 | * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
|
---|
15 | *
|
---|
16 | * The contents of this file may alternatively be used under the terms
|
---|
17 | * of the Common Development and Distribution License Version 1.0
|
---|
18 | * (CDDL) only, as it comes in the "COPYING.CDDL" file of the
|
---|
19 | * VirtualBox OSE distribution, in which case the provisions of the
|
---|
20 | * CDDL are applicable instead of those of the GPL.
|
---|
21 | *
|
---|
22 | * You may elect to license modified versions of this file under the
|
---|
23 | * terms and conditions of either the GPL or the CDDL or both.
|
---|
24 | */
|
---|
25 |
|
---|
26 | #ifndef ___VBox_vmm_dbgftrace_h
|
---|
27 | #define ___VBox_vmm_dbgftrace_h
|
---|
28 |
|
---|
29 | #include <iprt/trace.h>
|
---|
30 | #include <VBox/types.h>
|
---|
31 |
|
---|
32 | RT_C_DECLS_BEGIN
|
---|
33 | /** @defgroup grp_dbgf_trace Tracing
|
---|
34 | * @ingroup grp_dbgf
|
---|
35 | *
|
---|
36 | * @{
|
---|
37 | */
|
---|
38 |
|
---|
39 | #if (defined(RTTRACE_ENABLED) || defined(DBGFTRACE_ENABLED)) && !defined(DBGFTRACE_DISABLED)
|
---|
40 | # undef DBGFTRACE_ENABLED
|
---|
41 | # undef DBGFTRACE_DISABLED
|
---|
42 | # define DBGFTRACE_ENABLED
|
---|
43 | #else
|
---|
44 | # undef DBGFTRACE_ENABLED
|
---|
45 | # undef DBGFTRACE_DISABLED
|
---|
46 | # define DBGFTRACE_DISABLED
|
---|
47 | #endif
|
---|
48 |
|
---|
49 | VMMDECL(int) DBGFR3TraceConfig(PVM pVM, const char *pszConfig);
|
---|
50 |
|
---|
51 |
|
---|
52 | /** @name VMM Internal Trace Macros
|
---|
53 | * @remarks The user of these macros is responsible of including VBox/vmm/vm.h.
|
---|
54 | * @{
|
---|
55 | */
|
---|
56 | /**
|
---|
57 | * Records a 64-bit unsigned integer together with a tag string.
|
---|
58 | */
|
---|
59 | #ifdef DBGFTRACE_ENABLED
|
---|
60 | # define DBGFTRACE_U64_TAG(a_pVM, a_u64, a_pszTag) \
|
---|
61 | do { RTTraceBufAddMsgF((a_pVM)->CTX_SUFF(hTraceBuf), "%'llu %s", (a_u64), (a_pszTag)); } while (0)
|
---|
62 | #else
|
---|
63 | # define DBGFTRACE_U64_TAG(a_pVM, a_u64, a_pszTag) do { } while (0)
|
---|
64 | #endif
|
---|
65 |
|
---|
66 | /**
|
---|
67 | * Records a 64-bit unsigned integer together with two tag strings.
|
---|
68 | */
|
---|
69 | #ifdef DBGFTRACE_ENABLED
|
---|
70 | # define DBGFTRACE_U64_TAG2(a_pVM, a_u64, a_pszTag1, a_pszTag2) \
|
---|
71 | do { RTTraceBufAddMsgF((a_pVM)->CTX_SUFF(hTraceBuf), "%'llu %s %s", (a_u64), (a_pszTag1), (a_pszTag2)); } while (0)
|
---|
72 | #else
|
---|
73 | # define DBGFTRACE_U64_TAG2(a_pVM, a_u64, a_pszTag1, a_pszTag2) do { } while (0)
|
---|
74 | #endif
|
---|
75 |
|
---|
76 | /**
|
---|
77 | * Records the current source position.
|
---|
78 | */
|
---|
79 | #ifdef DBGFTRACE_ENABLED
|
---|
80 | # define DBGFTRACE_POS(a_pVM) \
|
---|
81 | do { RTTraceBufAddPos((a_pVM)->CTX_SUFF(hTraceBuf), RT_SRC_POS); } while (0)
|
---|
82 | #else
|
---|
83 | # define DBGFTRACE_POS(a_pVM) do { } while (0)
|
---|
84 | #endif
|
---|
85 |
|
---|
86 | /**
|
---|
87 | * Records the current source position along with a 64-bit unsigned integer.
|
---|
88 | */
|
---|
89 | #ifdef DBGFTRACE_ENABLED
|
---|
90 | # define DBGFTRACE_POS_U64(a_pVM, a_u64) \
|
---|
91 | do { RTTraceBufAddPosMsgF((a_pVM)->CTX_SUFF(hTraceBuf), RT_SRC_POS, "%'llu", (a_u64)); } while (0)
|
---|
92 | #else
|
---|
93 | # define DBGFTRACE_POS_U64(a_pVM, a_u64) do { } while (0)
|
---|
94 | #endif
|
---|
95 | /** @} */
|
---|
96 |
|
---|
97 |
|
---|
98 | /** @name Tracing Macors for PDM Devices, Drivers and USB Devices.
|
---|
99 | * @{
|
---|
100 | */
|
---|
101 |
|
---|
102 | /**
|
---|
103 | * Get the trace buffer handle.
|
---|
104 | * @param a_pIns The instance (pDevIns, pDrvIns or pUsbIns).
|
---|
105 | */
|
---|
106 | #define DBGFTRACE_PDM_TRACEBUF(a_pIns) ( (a_pIns)->CTX_SUFF(pHlp)->pfnDBGFTraceBuf((a_pIns)) )
|
---|
107 |
|
---|
108 | /**
|
---|
109 | * Records a tagged 64-bit unsigned integer.
|
---|
110 | */
|
---|
111 | #ifdef DBGFTRACE_ENABLED
|
---|
112 | # define DBGFTRACE_PDM_U64_TAG(a_pIns, a_u64, a_pszTag) \
|
---|
113 | do { RTTraceBufAddMsgF(DBGFTRACE_PDM_TRACEBUF(a_pIns), "%'llu %s", (a_u64), (a_pszTag)); } while (0)
|
---|
114 | #else
|
---|
115 | # define DBGFTRACE_PDM_U64_TAG(a_pIns, a_u64, a_pszTag) do { } while (0)
|
---|
116 | #endif
|
---|
117 |
|
---|
118 | /**
|
---|
119 | * Records the current source position.
|
---|
120 | */
|
---|
121 | #ifdef DBGFTRACE_ENABLED
|
---|
122 | # define DBGFTRACE_PDM_POS(a_pIns) \
|
---|
123 | do { RTTraceBufAddPos(DBGFTRACE_PDM_TRACEBUF(a_pIns), RT_SRC_POS); } while (0)
|
---|
124 | #else
|
---|
125 | # define DBGFTRACE_PDM_POS(a_pIns) do { } while (0)
|
---|
126 | #endif
|
---|
127 |
|
---|
128 | /**
|
---|
129 | * Records the current source position along with a 64-bit unsigned integer.
|
---|
130 | */
|
---|
131 | #ifdef DBGFTRACE_ENABLED
|
---|
132 | # define DBGFTRACE_PDM_POS_U64(a_pIns, a_u64) \
|
---|
133 | do { RTTraceBufAddPosMsgF(DBGFTRACE_PDM_TRACEBUF(a_pIns), RT_SRC_POS, "%'llu", (a_u64)); } while (0)
|
---|
134 | #else
|
---|
135 | # define DBGFTRACE_PDM_POS_U64(a_pIns, a_u64) do { } while (0)
|
---|
136 | #endif
|
---|
137 | /** @} */
|
---|
138 |
|
---|
139 |
|
---|
140 | /** @} */
|
---|
141 | RT_C_DECLS_END
|
---|
142 |
|
---|
143 | #endif
|
---|