VirtualBox

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

Last change on this file since 72686 was 72686, checked in by vboxsync, 6 years ago

vmm/dbgftrace.h: Added DBGFTRACE_CUSTOM. bugref:9044

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 4.5 KB
Line 
1/** @file
2 * DBGF - Debugger Facility.
3 */
4
5/*
6 * Copyright (C) 2006-2017 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
32RT_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
49VMMDECL(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#ifdef RT_COMPILER_SUPPORTS_VA_ARGS
77/**
78 * Add a custom string (req. variadict macro support).
79 */
80# ifdef DBGFTRACE_ENABLED
81# define DBGFTRACE_CUSTOM(a_pVM, ...) \
82 do { RTTraceBufAddMsgF((a_pVM)->CTX_SUFF(hTraceBuf), __VA_ARGS__); } while (0)
83# else
84# define DBGFTRACE_CUSTOM(a_pVM, ...) do { } while (0)
85# endif
86#endif
87
88/**
89 * Records the current source position.
90 */
91#ifdef DBGFTRACE_ENABLED
92# define DBGFTRACE_POS(a_pVM) \
93 do { RTTraceBufAddPos((a_pVM)->CTX_SUFF(hTraceBuf), RT_SRC_POS); } while (0)
94#else
95# define DBGFTRACE_POS(a_pVM) do { } while (0)
96#endif
97
98/**
99 * Records the current source position along with a 64-bit unsigned integer.
100 */
101#ifdef DBGFTRACE_ENABLED
102# define DBGFTRACE_POS_U64(a_pVM, a_u64) \
103 do { RTTraceBufAddPosMsgF((a_pVM)->CTX_SUFF(hTraceBuf), RT_SRC_POS, "%'llu", (a_u64)); } while (0)
104#else
105# define DBGFTRACE_POS_U64(a_pVM, a_u64) do { } while (0)
106#endif
107/** @} */
108
109
110/** @name Tracing Macros for PDM Devices, Drivers and USB Devices.
111 * @{
112 */
113
114/**
115 * Get the trace buffer handle.
116 * @param a_pIns The instance (pDevIns, pDrvIns or pUsbIns).
117 */
118#define DBGFTRACE_PDM_TRACEBUF(a_pIns) ( (a_pIns)->CTX_SUFF(pHlp)->pfnDBGFTraceBuf((a_pIns)) )
119
120/**
121 * Records a tagged 64-bit unsigned integer.
122 */
123#ifdef DBGFTRACE_ENABLED
124# define DBGFTRACE_PDM_U64_TAG(a_pIns, a_u64, a_pszTag) \
125 do { RTTraceBufAddMsgF(DBGFTRACE_PDM_TRACEBUF(a_pIns), "%'llu %s", (a_u64), (a_pszTag)); } while (0)
126#else
127# define DBGFTRACE_PDM_U64_TAG(a_pIns, a_u64, a_pszTag) do { } while (0)
128#endif
129
130/**
131 * Records the current source position.
132 */
133#ifdef DBGFTRACE_ENABLED
134# define DBGFTRACE_PDM_POS(a_pIns) \
135 do { RTTraceBufAddPos(DBGFTRACE_PDM_TRACEBUF(a_pIns), RT_SRC_POS); } while (0)
136#else
137# define DBGFTRACE_PDM_POS(a_pIns) do { } while (0)
138#endif
139
140/**
141 * Records the current source position along with a 64-bit unsigned integer.
142 */
143#ifdef DBGFTRACE_ENABLED
144# define DBGFTRACE_PDM_POS_U64(a_pIns, a_u64) \
145 do { RTTraceBufAddPosMsgF(DBGFTRACE_PDM_TRACEBUF(a_pIns), RT_SRC_POS, "%'llu", (a_u64)); } while (0)
146#else
147# define DBGFTRACE_PDM_POS_U64(a_pIns, a_u64) do { } while (0)
148#endif
149/** @} */
150
151
152/** @} */
153RT_C_DECLS_END
154
155#endif
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