1 | /** @file
|
---|
2 | * DBGF - Debugger Facility.
|
---|
3 | */
|
---|
4 |
|
---|
5 | /*
|
---|
6 | * Copyright (C) 2006-2019 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_INCLUDED_vmm_dbgftrace_h
|
---|
27 | #define VBOX_INCLUDED_vmm_dbgftrace_h
|
---|
28 | #ifndef RT_WITHOUT_PRAGMA_ONCE
|
---|
29 | # pragma once
|
---|
30 | #endif
|
---|
31 |
|
---|
32 | #include <iprt/trace.h>
|
---|
33 | #include <VBox/types.h>
|
---|
34 |
|
---|
35 | RT_C_DECLS_BEGIN
|
---|
36 | /** @defgroup grp_dbgf_trace Tracing
|
---|
37 | * @ingroup grp_dbgf
|
---|
38 | *
|
---|
39 | * @{
|
---|
40 | */
|
---|
41 |
|
---|
42 | #if (defined(RTTRACE_ENABLED) || defined(DBGFTRACE_ENABLED)) && !defined(DBGFTRACE_DISABLED)
|
---|
43 | # undef DBGFTRACE_ENABLED
|
---|
44 | # undef DBGFTRACE_DISABLED
|
---|
45 | # define DBGFTRACE_ENABLED
|
---|
46 | #else
|
---|
47 | # undef DBGFTRACE_ENABLED
|
---|
48 | # undef DBGFTRACE_DISABLED
|
---|
49 | # define DBGFTRACE_DISABLED
|
---|
50 | #endif
|
---|
51 |
|
---|
52 | VMMDECL(int) DBGFR3TraceConfig(PVM pVM, const char *pszConfig);
|
---|
53 |
|
---|
54 |
|
---|
55 | /** @name VMM Internal Trace Macros
|
---|
56 | * @remarks The user of these macros is responsible of including VBox/vmm/vm.h.
|
---|
57 | * @{
|
---|
58 | */
|
---|
59 | /**
|
---|
60 | * Records a 64-bit unsigned integer together with a tag string.
|
---|
61 | */
|
---|
62 | #ifdef DBGFTRACE_ENABLED
|
---|
63 | # define DBGFTRACE_U64_TAG(a_pVM, a_u64, a_pszTag) \
|
---|
64 | do { RTTraceBufAddMsgF((a_pVM)->CTX_SUFF(hTraceBuf), "%'llu %s", (a_u64), (a_pszTag)); } while (0)
|
---|
65 | #else
|
---|
66 | # define DBGFTRACE_U64_TAG(a_pVM, a_u64, a_pszTag) do { } while (0)
|
---|
67 | #endif
|
---|
68 |
|
---|
69 | /**
|
---|
70 | * Records a 64-bit unsigned integer together with two tag strings.
|
---|
71 | */
|
---|
72 | #ifdef DBGFTRACE_ENABLED
|
---|
73 | # define DBGFTRACE_U64_TAG2(a_pVM, a_u64, a_pszTag1, a_pszTag2) \
|
---|
74 | do { RTTraceBufAddMsgF((a_pVM)->CTX_SUFF(hTraceBuf), "%'llu %s %s", (a_u64), (a_pszTag1), (a_pszTag2)); } while (0)
|
---|
75 | #else
|
---|
76 | # define DBGFTRACE_U64_TAG2(a_pVM, a_u64, a_pszTag1, a_pszTag2) do { } while (0)
|
---|
77 | #endif
|
---|
78 |
|
---|
79 | #ifdef RT_COMPILER_SUPPORTS_VA_ARGS
|
---|
80 | /**
|
---|
81 | * Add a custom string (req. variadict macro support).
|
---|
82 | */
|
---|
83 | # ifdef DBGFTRACE_ENABLED
|
---|
84 | # define DBGFTRACE_CUSTOM(a_pVM, ...) \
|
---|
85 | do { RTTraceBufAddMsgF((a_pVM)->CTX_SUFF(hTraceBuf), __VA_ARGS__); } while (0)
|
---|
86 | # else
|
---|
87 | # define DBGFTRACE_CUSTOM(a_pVM, ...) do { } while (0)
|
---|
88 | # endif
|
---|
89 | #endif
|
---|
90 |
|
---|
91 | /**
|
---|
92 | * Records the current source position.
|
---|
93 | */
|
---|
94 | #ifdef DBGFTRACE_ENABLED
|
---|
95 | # define DBGFTRACE_POS(a_pVM) \
|
---|
96 | do { RTTraceBufAddPos((a_pVM)->CTX_SUFF(hTraceBuf), RT_SRC_POS); } while (0)
|
---|
97 | #else
|
---|
98 | # define DBGFTRACE_POS(a_pVM) do { } while (0)
|
---|
99 | #endif
|
---|
100 |
|
---|
101 | /**
|
---|
102 | * Records the current source position along with a 64-bit unsigned integer.
|
---|
103 | */
|
---|
104 | #ifdef DBGFTRACE_ENABLED
|
---|
105 | # define DBGFTRACE_POS_U64(a_pVM, a_u64) \
|
---|
106 | do { RTTraceBufAddPosMsgF((a_pVM)->CTX_SUFF(hTraceBuf), RT_SRC_POS, "%'llu", (a_u64)); } while (0)
|
---|
107 | #else
|
---|
108 | # define DBGFTRACE_POS_U64(a_pVM, a_u64) do { } while (0)
|
---|
109 | #endif
|
---|
110 | /** @} */
|
---|
111 |
|
---|
112 |
|
---|
113 | /** @name Tracing Macros for PDM Devices, Drivers and USB Devices.
|
---|
114 | * @{
|
---|
115 | */
|
---|
116 |
|
---|
117 | /**
|
---|
118 | * Get the trace buffer handle.
|
---|
119 | * @param a_pIns The instance (pDevIns, pDrvIns or pUsbIns).
|
---|
120 | */
|
---|
121 | #define DBGFTRACE_PDM_TRACEBUF(a_pIns) ( (a_pIns)->CTX_SUFF(pHlp)->pfnDBGFTraceBuf((a_pIns)) )
|
---|
122 |
|
---|
123 | /**
|
---|
124 | * Records a tagged 64-bit unsigned integer.
|
---|
125 | */
|
---|
126 | #ifdef DBGFTRACE_ENABLED
|
---|
127 | # define DBGFTRACE_PDM_U64_TAG(a_pIns, a_u64, a_pszTag) \
|
---|
128 | do { RTTraceBufAddMsgF(DBGFTRACE_PDM_TRACEBUF(a_pIns), "%'llu %s", (a_u64), (a_pszTag)); } while (0)
|
---|
129 | #else
|
---|
130 | # define DBGFTRACE_PDM_U64_TAG(a_pIns, a_u64, a_pszTag) do { } while (0)
|
---|
131 | #endif
|
---|
132 |
|
---|
133 | /**
|
---|
134 | * Records the current source position.
|
---|
135 | */
|
---|
136 | #ifdef DBGFTRACE_ENABLED
|
---|
137 | # define DBGFTRACE_PDM_POS(a_pIns) \
|
---|
138 | do { RTTraceBufAddPos(DBGFTRACE_PDM_TRACEBUF(a_pIns), RT_SRC_POS); } while (0)
|
---|
139 | #else
|
---|
140 | # define DBGFTRACE_PDM_POS(a_pIns) do { } while (0)
|
---|
141 | #endif
|
---|
142 |
|
---|
143 | /**
|
---|
144 | * Records the current source position along with a 64-bit unsigned integer.
|
---|
145 | */
|
---|
146 | #ifdef DBGFTRACE_ENABLED
|
---|
147 | # define DBGFTRACE_PDM_POS_U64(a_pIns, a_u64) \
|
---|
148 | do { RTTraceBufAddPosMsgF(DBGFTRACE_PDM_TRACEBUF(a_pIns), RT_SRC_POS, "%'llu", (a_u64)); } while (0)
|
---|
149 | #else
|
---|
150 | # define DBGFTRACE_PDM_POS_U64(a_pIns, a_u64) do { } while (0)
|
---|
151 | #endif
|
---|
152 | /** @} */
|
---|
153 |
|
---|
154 |
|
---|
155 | /** @} */
|
---|
156 | RT_C_DECLS_END
|
---|
157 |
|
---|
158 | #endif /* !VBOX_INCLUDED_vmm_dbgftrace_h */
|
---|