VirtualBox

source: vbox/trunk/src/VBox/Debugger/testcase/tstDBGCStubs.cpp@ 46074

Last change on this file since 46074 was 46074, checked in by vboxsync, 12 years ago

RTDbgCfg: Added API for setting the log callback.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id
File size: 11.4 KB
Line 
1/* $Id: tstDBGCStubs.cpp 46074 2013-05-14 16:25:57Z vboxsync $ */
2/** @file
3 * DBGC Testcase - Command Parser, VMM Stub Functions.
4 */
5
6/*
7 * Copyright (C) 2006-2013 Oracle Corporation
8 *
9 * This file is part of VirtualBox Open Source Edition (OSE), as
10 * available from http://www.virtualbox.org. This file is free software;
11 * you can redistribute it and/or modify it under the terms of the GNU
12 * General Public License (GPL) as published by the Free Software
13 * Foundation, in version 2 as it comes in the "COPYING" file of the
14 * VirtualBox OSE distribution. VirtualBox OSE is distributed in the
15 * hope that it will be useful, but WITHOUT ANY WARRANTY of any kind.
16 */
17
18#include <VBox/err.h>
19#include <VBox/vmm/vm.h>
20#include <iprt/string.h>
21
22
23
24#include <VBox/vmm/dbgf.h>
25VMMR3DECL(PDBGFADDRESS) DBGFR3AddrFromFlat(PUVM pUVM, PDBGFADDRESS pAddress, RTGCUINTPTR FlatPtr)
26{
27 return NULL;
28}
29
30VMMR3DECL(int) DBGFR3AddrFromSelOff(PUVM pUVM, VMCPUID idCpu, PDBGFADDRESS pAddress, RTSEL Sel, RTUINTPTR off)
31{
32 /* bad:bad -> provke error during parsing. */
33 if (Sel == 0xbad && off == 0xbad)
34 return VERR_OUT_OF_SELECTOR_BOUNDS;
35
36 /* real mode conversion. */
37 pAddress->FlatPtr = (uint32_t)(Sel << 4) | off;
38 pAddress->fFlags |= DBGFADDRESS_FLAGS_FLAT;
39 pAddress->Sel = DBGF_SEL_FLAT;
40 pAddress->off = pAddress->FlatPtr;
41 return VINF_SUCCESS;
42}
43
44VMMR3DECL(int) DBGFR3AddrToPhys(PUVM pUVM, VMCPUID idCpu, PDBGFADDRESS pAddress, PRTGCPHYS pGCPhys)
45{
46 return VERR_INTERNAL_ERROR;
47}
48
49VMMR3DECL(int) DBGFR3Attach(PUVM pUVM)
50{
51 return VERR_INTERNAL_ERROR;
52}
53
54VMMR3DECL(int) DBGFR3BpClear(PUVM pUVM, RTUINT iBp)
55{
56 return VERR_INTERNAL_ERROR;
57}
58VMMR3DECL(int) DBGFR3BpDisable(PUVM pUVM, RTUINT iBp)
59{
60 return VERR_INTERNAL_ERROR;
61}
62VMMR3DECL(int) DBGFR3BpEnable(PUVM pUVM, RTUINT iBp)
63{
64 return VERR_INTERNAL_ERROR;
65}
66VMMR3DECL(int) DBGFR3BpEnum(PUVM pUVM, PFNDBGFBPENUM pfnCallback, void *pvUser)
67{
68 return VERR_INTERNAL_ERROR;
69}
70VMMR3DECL(int) DBGFR3BpSet(PUVM pUVM, PCDBGFADDRESS pAddress, uint64_t iHitTrigger, uint64_t iHitDisable, PRTUINT piBp)
71{
72 return VERR_INTERNAL_ERROR;
73}
74VMMR3DECL(int) DBGFR3BpSetReg(PUVM pUVM, PCDBGFADDRESS pAddress, uint64_t iHitTrigger, uint64_t iHitDisable,
75 uint8_t fType, uint8_t cb, PRTUINT piBp)
76{
77 return VERR_INTERNAL_ERROR;
78}
79VMMR3DECL(int) DBGFR3BpSetREM(PUVM pUVM, PCDBGFADDRESS pAddress, uint64_t iHitTrigger, uint64_t iHitDisable, PRTUINT piBp)
80{
81 return VERR_INTERNAL_ERROR;
82}
83VMMR3DECL(int) DBGFR3QueryWaitable(PUVM pUVM)
84{
85 return VINF_SUCCESS;
86}
87VMMR3DECL(int) DBGFR3Detach(PUVM pUVM)
88{
89 return VERR_INTERNAL_ERROR;
90}
91VMMR3DECL(int) DBGFR3DisasInstrEx(PUVM pUVM, VMCPUID idCpu, RTSEL Sel, RTGCPTR GCPtr, uint32_t fFlags,
92 char *pszOutput, uint32_t cchOutput, uint32_t *pcbInstr)
93{
94 return VERR_INTERNAL_ERROR;
95}
96VMMR3DECL(int) DBGFR3EventWait(PUVM pUVM, RTMSINTERVAL cMillies, PCDBGFEVENT *ppEvent)
97{
98 return VERR_INTERNAL_ERROR;
99}
100VMMR3DECL(int) DBGFR3Halt(PUVM pUVM)
101{
102 return VERR_INTERNAL_ERROR;
103}
104VMMR3DECL(int) DBGFR3Info(PUVM pUVM, const char *pszName, const char *pszArgs, PCDBGFINFOHLP pHlp)
105{
106 return VERR_INTERNAL_ERROR;
107}
108VMMR3DECL(int) DBGFR3InfoEx(PUVM pUVM, VMCPUID idCpu, const char *pszName, const char *pszArgs, PCDBGFINFOHLP pHlp)
109{
110 return VERR_INTERNAL_ERROR;
111}
112VMMR3DECL(bool) DBGFR3IsHalted(PUVM pUVM)
113{
114 return true;
115}
116VMMR3DECL(int) DBGFR3LineByAddr(PUVM pUVM, RTGCUINTPTR Address, PRTGCINTPTR poffDisplacement, PDBGFLINE pLine)
117{
118 return VERR_INTERNAL_ERROR;
119}
120VMMR3DECL(int) DBGFR3LogModifyDestinations(PUVM pUVM, const char *pszDestSettings)
121{
122 return VERR_INTERNAL_ERROR;
123}
124VMMR3DECL(int) DBGFR3LogModifyFlags(PUVM pUVM, const char *pszFlagSettings)
125{
126 return VERR_INTERNAL_ERROR;
127}
128VMMR3DECL(int) DBGFR3LogModifyGroups(PUVM pUVM, const char *pszGroupSettings)
129{
130 return VERR_INTERNAL_ERROR;
131}
132VMMR3DECL(int) DBGFR3ModuleLoad(PUVM pUVM, const char *pszFilename, RTGCUINTPTR AddressDelta, const char *pszName, RTGCUINTPTR ModuleAddress, unsigned cbImage)
133{
134 return VERR_INTERNAL_ERROR;
135}
136VMMR3DECL(RTDBGCFG) DBGFR3AsGetConfig(PUVM pUVM)
137{
138 return NIL_RTDBGCFG;
139}
140VMMR3DECL(int) DBGFR3AsLoadImage(PUVM pUVM, RTDBGAS hAS, const char *pszFilename, const char *pszModName, PCDBGFADDRESS pModAddress, RTDBGSEGIDX iModSeg, uint32_t fFlags)
141{
142 return VERR_INTERNAL_ERROR;
143}
144VMMR3DECL(int) DBGFR3AsLoadMap(PUVM pUVM, RTDBGAS hAS, const char *pszFilename, const char *pszModName, PCDBGFADDRESS pModAddress, RTDBGSEGIDX iModSeg, RTGCUINTPTR uSubtrahend, uint32_t fFlags)
145{
146 return VERR_INTERNAL_ERROR;
147}
148VMMR3DECL(RTDBGAS) DBGFR3AsResolveAndRetain(PUVM pUVM, RTDBGAS hAlias)
149{
150 return NIL_RTDBGAS;
151}
152VMMR3DECL(int) DBGFR3Resume(PUVM pUVM)
153{
154 return VERR_INTERNAL_ERROR;
155}
156VMMR3DECL(int) DBGFR3StackWalkBegin(PUVM pUVM, VMCPUID idCpu, DBGFCODETYPE enmCodeType, PCDBGFSTACKFRAME *ppFirstFrame)
157{
158 return VERR_INTERNAL_ERROR;
159}
160VMMR3DECL(PCDBGFSTACKFRAME) DBGFR3StackWalkNext(PCDBGFSTACKFRAME pCurrent)
161{
162 return NULL;
163}
164VMMR3DECL(void) DBGFR3StackWalkEnd(PCDBGFSTACKFRAME pFirstFrame)
165{
166}
167VMMR3DECL(int) DBGFR3Step(PUVM pUVM, VMCPUID idCpu)
168{
169 return VERR_INTERNAL_ERROR;
170}
171VMMR3DECL(int) DBGFR3AsSymbolByAddr(PUVM pUVM, RTDBGAS hDbgAs, PCDBGFADDRESS pAddress, PRTGCINTPTR poffDisplacement, PRTDBGSYMBOL pSymbol, PRTDBGMOD phMod)
172{
173 return VERR_INTERNAL_ERROR;
174}
175VMMR3DECL(int) DBGFR3AsSymbolByName(PUVM pUVM, RTDBGAS hDbgAs, const char *pszSymbol, PRTDBGSYMBOL pSymbol, PRTDBGMOD phMod)
176{
177 return VERR_INTERNAL_ERROR;
178}
179VMMR3DECL(int) DBGFR3MemScan(PUVM pUVM, VMCPUID idCpu, PCDBGFADDRESS pAddress, RTGCUINTPTR cbRange, RTGCUINTPTR uAlign, const void *pabNeedle, size_t cbNeedle, PDBGFADDRESS pHitAddress)
180{
181 return VERR_INTERNAL_ERROR;
182}
183VMMR3DECL(int) DBGFR3MemRead(PUVM pUVM, VMCPUID idCpu, PCDBGFADDRESS pAddress, void *pvBuf, size_t cbRead)
184{
185 return VERR_INTERNAL_ERROR;
186}
187VMMR3DECL(int) DBGFR3MemReadString(PUVM pUVM, VMCPUID idCpu, PCDBGFADDRESS pAddress, char *pszBuf, size_t cchBuf)
188{
189 return VERR_INTERNAL_ERROR;
190}
191VMMR3DECL(int) DBGFR3MemWrite(PUVM pUVM, VMCPUID idCpu, PCDBGFADDRESS pAddress, const void *pvBuf, size_t cbRead)
192{
193 return VERR_INTERNAL_ERROR;
194}
195VMMDECL(int) DBGFR3PagingDumpEx(PUVM pUVM, VMCPUID idCpu, uint32_t fFlags, uint64_t cr3, uint64_t u64FirstAddr,
196 uint64_t u64LastAddr, uint32_t cMaxDepth, PCDBGFINFOHLP pHlp)
197{
198 return VERR_INTERNAL_ERROR;
199}
200VMMR3DECL(int) DBGFR3RegNmValidate(PUVM pUVM, VMCPUID idDefCpu, const char *pszReg)
201{
202 if ( !strcmp(pszReg, "ah")
203 || !strcmp(pszReg, "ax")
204 || !strcmp(pszReg, "eax")
205 || !strcmp(pszReg, "rax"))
206 return VINF_SUCCESS;
207 return VERR_DBGF_REGISTER_NOT_FOUND;
208}
209VMMR3DECL(int) DBGFR3RegCpuQueryU8( PUVM pUVM, VMCPUID idCpu, DBGFREG enmReg, uint8_t *pu8)
210{
211 return VERR_INTERNAL_ERROR;
212}
213VMMR3DECL(int) DBGFR3RegCpuQueryU16( PUVM pUVM, VMCPUID idCpu, DBGFREG enmReg, uint16_t *pu16)
214{
215 return VERR_INTERNAL_ERROR;
216}
217VMMR3DECL(int) DBGFR3RegCpuQueryU32( PUVM pUVM, VMCPUID idCpu, DBGFREG enmReg, uint32_t *pu32)
218{
219 return VERR_INTERNAL_ERROR;
220}
221VMMR3DECL(int) DBGFR3RegCpuQueryU64( PUVM pUVM, VMCPUID idCpu, DBGFREG enmReg, uint64_t *pu64)
222{
223 return VERR_INTERNAL_ERROR;
224}
225VMMR3DECL(int) DBGFR3RegNmQuery(PUVM pUVM, VMCPUID idDefCpu, const char *pszReg, PDBGFREGVAL pValue, PDBGFREGVALTYPE penmType)
226{
227 if (idDefCpu == 0 || idDefCpu == DBGFREG_HYPER_VMCPUID)
228 {
229 if (!strcmp(pszReg, "ah"))
230 {
231 pValue->u16 = 0xf0;
232 *penmType = DBGFREGVALTYPE_U8;
233 return VINF_SUCCESS;
234 }
235 if (!strcmp(pszReg, "ax"))
236 {
237 pValue->u16 = 0xbabe;
238 *penmType = DBGFREGVALTYPE_U16;
239 return VINF_SUCCESS;
240 }
241 if (!strcmp(pszReg, "eax"))
242 {
243 pValue->u32 = 0xcafebabe;
244 *penmType = DBGFREGVALTYPE_U32;
245 return VINF_SUCCESS;
246 }
247 if (!strcmp(pszReg, "rax"))
248 {
249 pValue->u64 = UINT64_C(0x00beef00feedface);
250 *penmType = DBGFREGVALTYPE_U32;
251 return VINF_SUCCESS;
252 }
253 }
254 return VERR_DBGF_REGISTER_NOT_FOUND;
255}
256VMMR3DECL(int) DBGFR3RegPrintf(PUVM pUVM, VMCPUID idCpu, char *pszBuf, size_t cbBuf, const char *pszFormat, ...)
257{
258 return VERR_INTERNAL_ERROR;
259}
260VMMDECL(ssize_t) DBGFR3RegFormatValue(char *pszBuf, size_t cbBuf, PCDBGFREGVAL pValue, DBGFREGVALTYPE enmType, bool fSpecial)
261{
262 return VERR_INTERNAL_ERROR;
263}
264VMMR3DECL(int) DBGFR3RegNmSet(PUVM pUVM, VMCPUID idDefCpu, const char *pszReg, PCDBGFREGVAL pValue, DBGFREGVALTYPE enmType)
265{
266 return VERR_INTERNAL_ERROR;
267}
268
269VMMR3DECL(PDBGFADDRESS) DBGFR3AddrFromPhys(PUVM pUVM, PDBGFADDRESS pAddress, RTGCPHYS PhysAddr)
270{
271 return NULL;
272}
273VMMR3DECL(int) DBGFR3AddrToHostPhys(PUVM pUVM, VMCPUID idCpu, PDBGFADDRESS pAddress, PRTHCPHYS pHCPhys)
274{
275 return VERR_INTERNAL_ERROR;
276}
277VMMR3DECL(int) DBGFR3AddrToVolatileR3Ptr(PUVM pUVM, VMCPUID idCpu, PDBGFADDRESS pAddress, bool fReadOnly, void **ppvR3Ptr)
278{
279 return VERR_INTERNAL_ERROR;
280}
281
282VMMR3DECL(int) DBGFR3OSRegister(PUVM pUVM, PCDBGFOSREG pReg)
283{
284 return VERR_INTERNAL_ERROR;
285}
286VMMR3DECL(int) DBGFR3OSDetect(PUVM pUVM, char *pszName, size_t cchName)
287{
288 return VERR_INTERNAL_ERROR;
289}
290VMMR3DECL(int) DBGFR3OSQueryNameAndVersion(PUVM pUVM, char *pszName, size_t cchName, char *pszVersion, size_t cchVersion)
291{
292 return VERR_INTERNAL_ERROR;
293}
294
295VMMR3DECL(int) DBGFR3SelQueryInfo(PUVM pUVM, VMCPUID idCpu, RTSEL Sel, uint32_t fFlags, PDBGFSELINFO pSelInfo)
296{
297 return VERR_INTERNAL_ERROR;
298}
299
300VMMR3DECL(CPUMMODE) DBGFR3CpuGetMode(PUVM pUVM, VMCPUID idCpu)
301{
302 return CPUMMODE_INVALID;
303}
304VMMR3DECL(VMCPUID) DBGFR3CpuGetCount(PUVM pUVM)
305{
306 return 1;
307}
308
309VMMR3DECL(int) DBGFR3CoreWrite(PUVM pUVM, const char *pszFilename, bool fReplaceFile)
310{
311 return VERR_INTERNAL_ERROR;
312}
313
314
315//////////////////////////////////////////////////////////////////////////
316// The rest should eventually be replaced by DBGF calls and eliminated. //
317/////////////////////////////////////////////////////////////////////////
318
319#include <VBox/vmm/cpum.h>
320
321VMMDECL(uint64_t) CPUMGetGuestCR3(PVMCPU pVCpu)
322{
323 return 0;
324}
325
326VMMDECL(uint64_t) CPUMGetGuestCR4(PVMCPU pVCpu)
327{
328 return 0;
329}
330
331VMMDECL(RTSEL) CPUMGetGuestCS(PVMCPU pVCpu)
332{
333 return 0;
334}
335
336VMMDECL(PCCPUMCTXCORE) CPUMGetGuestCtxCore(PVMCPU pVCpu)
337{
338 return NULL;
339}
340
341VMMDECL(uint32_t) CPUMGetGuestEIP(PVMCPU pVCpu)
342{
343 return 0;
344}
345
346VMMDECL(uint64_t) CPUMGetGuestRIP(PVMCPU pVCpu)
347{
348 return 0;
349}
350
351VMMDECL(RTGCPTR) CPUMGetGuestIDTR(PVMCPU pVCpu, uint16_t *pcbLimit)
352{
353 return 0;
354}
355
356VMMDECL(CPUMMODE) CPUMGetGuestMode(PVMCPU pVCpu)
357{
358 return CPUMMODE_INVALID;
359}
360
361VMMDECL(RTSEL) CPUMGetHyperCS(PVMCPU pVCpu)
362{
363 return 0xfff8;
364}
365
366VMMDECL(uint32_t) CPUMGetHyperEIP(PVMCPU pVCpu)
367{
368 return 0;
369}
370
371VMMDECL(PCPUMCTX) CPUMQueryGuestCtxPtr(PVMCPU pVCpu)
372{
373 return NULL;
374}
375
376VMMDECL(bool) CPUMIsGuestIn64BitCode(PVMCPU pVCpu)
377{
378 return false;
379}
380
381
382
383#include <VBox/vmm/pgm.h>
384
385VMMDECL(RTHCPHYS) PGMGetHyperCR3(PVMCPU pVCpu)
386{
387 return 0;
388}
389
390VMMDECL(PGMMODE) PGMGetShadowMode(PVMCPU pVCpu)
391{
392 return PGMMODE_INVALID;
393}
394
395VMMR3DECL(int) PGMR3DbgR3Ptr2GCPhys(PUVM pUVM, RTR3PTR R3Ptr, PRTGCPHYS pGCPhys)
396{
397 return VERR_INTERNAL_ERROR;
398}
399
400VMMR3DECL(int) PGMR3DbgR3Ptr2HCPhys(PUVM pUVM, RTR3PTR R3Ptr, PRTHCPHYS pHCPhys)
401{
402 return VERR_INTERNAL_ERROR;
403}
404VMMR3DECL(int) PGMR3DbgHCPhys2GCPhys(PUVM pUVM, RTHCPHYS HCPhys, PRTGCPHYS pGCPhys)
405{
406 return VERR_INTERNAL_ERROR;
407}
408
409
410#include <VBox/vmm/vmm.h>
411
412VMMR3DECL(PVMCPU) VMMR3GetCpuByIdU(PUVM pUVM, RTCPUID idCpu)
413{
414 return NULL;
415}
416
417
418VMMR3DECL(PVM) VMR3GetVM(PUVM pUVM)
419{
420 return NULL;
421}
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