VirtualBox

source: vbox/trunk/include/VBox/vmm/dbgftrace.h@ 99760

Last change on this file since 99760 was 98103, checked in by vboxsync, 23 months ago

Copyright year updates by scm.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 4.9 KB
Line 
1/** @file
2 * DBGF - Debugger Facility.
3 */
4
5/*
6 * Copyright (C) 2006-2023 Oracle and/or its affiliates.
7 *
8 * This file is part of VirtualBox base platform packages, as
9 * available from https://www.virtualbox.org.
10 *
11 * This program is free software; you can redistribute it and/or
12 * modify it under the terms of the GNU General Public License
13 * as published by the Free Software Foundation, in version 3 of the
14 * License.
15 *
16 * This program is distributed in the hope that it will be useful, but
17 * WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
19 * General Public License for more details.
20 *
21 * You should have received a copy of the GNU General Public License
22 * along with this program; if not, see <https://www.gnu.org/licenses>.
23 *
24 * The contents of this file may alternatively be used under the terms
25 * of the Common Development and Distribution License Version 1.0
26 * (CDDL), a copy of it is provided in the "COPYING.CDDL" file included
27 * in the VirtualBox distribution, in which case the provisions of the
28 * CDDL are applicable instead of those of the GPL.
29 *
30 * You may elect to license modified versions of this file under the
31 * terms and conditions of either the GPL or the CDDL or both.
32 *
33 * SPDX-License-Identifier: GPL-3.0-only OR CDDL-1.0
34 */
35
36#ifndef VBOX_INCLUDED_vmm_dbgftrace_h
37#define VBOX_INCLUDED_vmm_dbgftrace_h
38#ifndef RT_WITHOUT_PRAGMA_ONCE
39# pragma once
40#endif
41
42#include <iprt/trace.h>
43#include <VBox/types.h>
44
45RT_C_DECLS_BEGIN
46/** @defgroup grp_dbgf_trace Tracing
47 * @ingroup grp_dbgf
48 *
49 * @{
50 */
51
52#if (defined(RTTRACE_ENABLED) || defined(DBGFTRACE_ENABLED)) && !defined(DBGFTRACE_DISABLED)
53# undef DBGFTRACE_ENABLED
54# undef DBGFTRACE_DISABLED
55# define DBGFTRACE_ENABLED
56#else
57# undef DBGFTRACE_ENABLED
58# undef DBGFTRACE_DISABLED
59# define DBGFTRACE_DISABLED
60#endif
61
62VMMDECL(int) DBGFR3TraceConfig(PVM pVM, const char *pszConfig);
63
64
65/** @name VMM Internal Trace Macros
66 * @remarks The user of these macros is responsible of including VBox/vmm/vm.h.
67 * @{
68 */
69/**
70 * Records a 64-bit unsigned integer together with a tag string.
71 */
72#ifdef DBGFTRACE_ENABLED
73# define DBGFTRACE_U64_TAG(a_pVM, a_u64, a_pszTag) \
74 do { RTTraceBufAddMsgF((a_pVM)->CTX_SUFF(hTraceBuf), "%'llu %s", (a_u64), (a_pszTag)); } while (0)
75#else
76# define DBGFTRACE_U64_TAG(a_pVM, a_u64, a_pszTag) do { } while (0)
77#endif
78
79/**
80 * Records a 64-bit unsigned integer together with two tag strings.
81 */
82#ifdef DBGFTRACE_ENABLED
83# define DBGFTRACE_U64_TAG2(a_pVM, a_u64, a_pszTag1, a_pszTag2) \
84 do { RTTraceBufAddMsgF((a_pVM)->CTX_SUFF(hTraceBuf), "%'llu %s %s", (a_u64), (a_pszTag1), (a_pszTag2)); } while (0)
85#else
86# define DBGFTRACE_U64_TAG2(a_pVM, a_u64, a_pszTag1, a_pszTag2) do { } while (0)
87#endif
88
89#ifdef RT_COMPILER_SUPPORTS_VA_ARGS
90/**
91 * Add a custom string (req. variadict macro support).
92 */
93# ifdef DBGFTRACE_ENABLED
94# define DBGFTRACE_CUSTOM(a_pVM, ...) \
95 do { RTTraceBufAddMsgF((a_pVM)->CTX_SUFF(hTraceBuf), __VA_ARGS__); } while (0)
96# else
97# define DBGFTRACE_CUSTOM(a_pVM, ...) do { } while (0)
98# endif
99#endif
100
101/**
102 * Records the current source position.
103 */
104#ifdef DBGFTRACE_ENABLED
105# define DBGFTRACE_POS(a_pVM) \
106 do { RTTraceBufAddPos((a_pVM)->CTX_SUFF(hTraceBuf), RT_SRC_POS); } while (0)
107#else
108# define DBGFTRACE_POS(a_pVM) do { } while (0)
109#endif
110
111/**
112 * Records the current source position along with a 64-bit unsigned integer.
113 */
114#ifdef DBGFTRACE_ENABLED
115# define DBGFTRACE_POS_U64(a_pVM, a_u64) \
116 do { RTTraceBufAddPosMsgF((a_pVM)->CTX_SUFF(hTraceBuf), RT_SRC_POS, "%'llu", (a_u64)); } while (0)
117#else
118# define DBGFTRACE_POS_U64(a_pVM, a_u64) do { } while (0)
119#endif
120/** @} */
121
122
123/** @name Tracing Macros for PDM Devices, Drivers and USB Devices.
124 * @{
125 */
126
127/**
128 * Get the trace buffer handle.
129 * @param a_pIns The instance (pDevIns, pDrvIns or pUsbIns).
130 */
131#define DBGFTRACE_PDM_TRACEBUF(a_pIns) ( (a_pIns)->CTX_SUFF(pHlp)->pfnDBGFTraceBuf((a_pIns)) )
132
133/**
134 * Records a tagged 64-bit unsigned integer.
135 */
136#ifdef DBGFTRACE_ENABLED
137# define DBGFTRACE_PDM_U64_TAG(a_pIns, a_u64, a_pszTag) \
138 do { RTTraceBufAddMsgF(DBGFTRACE_PDM_TRACEBUF(a_pIns), "%'llu %s", (a_u64), (a_pszTag)); } while (0)
139#else
140# define DBGFTRACE_PDM_U64_TAG(a_pIns, a_u64, a_pszTag) do { } while (0)
141#endif
142
143/**
144 * Records the current source position.
145 */
146#ifdef DBGFTRACE_ENABLED
147# define DBGFTRACE_PDM_POS(a_pIns) \
148 do { RTTraceBufAddPos(DBGFTRACE_PDM_TRACEBUF(a_pIns), RT_SRC_POS); } while (0)
149#else
150# define DBGFTRACE_PDM_POS(a_pIns) do { } while (0)
151#endif
152
153/**
154 * Records the current source position along with a 64-bit unsigned integer.
155 */
156#ifdef DBGFTRACE_ENABLED
157# define DBGFTRACE_PDM_POS_U64(a_pIns, a_u64) \
158 do { RTTraceBufAddPosMsgF(DBGFTRACE_PDM_TRACEBUF(a_pIns), RT_SRC_POS, "%'llu", (a_u64)); } while (0)
159#else
160# define DBGFTRACE_PDM_POS_U64(a_pIns, a_u64) do { } while (0)
161#endif
162/** @} */
163
164
165/** @} */
166RT_C_DECLS_END
167
168#endif /* !VBOX_INCLUDED_vmm_dbgftrace_h */
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