VirtualBox

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

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

Fixed the 'r', 'rg' and 'rg32' commands in 64-bit guest code.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id
File size: 11.5 KB
Line 
1/* $Id: tstDBGCStubs.cpp 46217 2013-05-22 13:02:37Z 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) DBGFR3LogModifyDestinations(PUVM pUVM, const char *pszDestSettings)
117{
118 return VERR_INTERNAL_ERROR;
119}
120VMMR3DECL(int) DBGFR3LogModifyFlags(PUVM pUVM, const char *pszFlagSettings)
121{
122 return VERR_INTERNAL_ERROR;
123}
124VMMR3DECL(int) DBGFR3LogModifyGroups(PUVM pUVM, const char *pszGroupSettings)
125{
126 return VERR_INTERNAL_ERROR;
127}
128VMMR3DECL(RTDBGCFG) DBGFR3AsGetConfig(PUVM pUVM)
129{
130 return NIL_RTDBGCFG;
131}
132VMMR3DECL(int) DBGFR3AsLoadImage(PUVM pUVM, RTDBGAS hAS, const char *pszFilename, const char *pszModName, PCDBGFADDRESS pModAddress, RTDBGSEGIDX iModSeg, uint32_t fFlags)
133{
134 return VERR_INTERNAL_ERROR;
135}
136VMMR3DECL(int) DBGFR3AsLoadMap(PUVM pUVM, RTDBGAS hAS, const char *pszFilename, const char *pszModName, PCDBGFADDRESS pModAddress, RTDBGSEGIDX iModSeg, RTGCUINTPTR uSubtrahend, uint32_t fFlags)
137{
138 return VERR_INTERNAL_ERROR;
139}
140VMMR3DECL(RTDBGAS) DBGFR3AsResolveAndRetain(PUVM pUVM, RTDBGAS hAlias)
141{
142 return NIL_RTDBGAS;
143}
144VMMR3DECL(int) DBGFR3AsLineByAddr(PUVM pUVM, RTDBGAS hDbgAs, PCDBGFADDRESS pAddress,
145 PRTGCINTPTR poffDisp, PRTDBGLINE pLine, PRTDBGMOD phMod)
146{
147 return VERR_DBG_LINE_NOT_FOUND;
148}
149VMMR3DECL(int) DBGFR3Resume(PUVM pUVM)
150{
151 return VERR_INTERNAL_ERROR;
152}
153VMMR3DECL(int) DBGFR3StackWalkBegin(PUVM pUVM, VMCPUID idCpu, DBGFCODETYPE enmCodeType, PCDBGFSTACKFRAME *ppFirstFrame)
154{
155 return VERR_INTERNAL_ERROR;
156}
157VMMR3DECL(PCDBGFSTACKFRAME) DBGFR3StackWalkNext(PCDBGFSTACKFRAME pCurrent)
158{
159 return NULL;
160}
161VMMR3DECL(void) DBGFR3StackWalkEnd(PCDBGFSTACKFRAME pFirstFrame)
162{
163}
164VMMR3DECL(int) DBGFR3Step(PUVM pUVM, VMCPUID idCpu)
165{
166 return VERR_INTERNAL_ERROR;
167}
168VMMR3DECL(int) DBGFR3AsSymbolByAddr(PUVM pUVM, RTDBGAS hDbgAs, PCDBGFADDRESS pAddress, uint32_t fFlags, PRTGCINTPTR poffDisplacement, PRTDBGSYMBOL pSymbol, PRTDBGMOD phMod)
169{
170 return VERR_INTERNAL_ERROR;
171}
172VMMR3DECL(int) DBGFR3AsSymbolByName(PUVM pUVM, RTDBGAS hDbgAs, const char *pszSymbol, PRTDBGSYMBOL pSymbol, PRTDBGMOD phMod)
173{
174 return VERR_INTERNAL_ERROR;
175}
176VMMR3DECL(int) DBGFR3MemScan(PUVM pUVM, VMCPUID idCpu, PCDBGFADDRESS pAddress, RTGCUINTPTR cbRange, RTGCUINTPTR uAlign, const void *pabNeedle, size_t cbNeedle, PDBGFADDRESS pHitAddress)
177{
178 return VERR_INTERNAL_ERROR;
179}
180VMMR3DECL(int) DBGFR3MemRead(PUVM pUVM, VMCPUID idCpu, PCDBGFADDRESS pAddress, void *pvBuf, size_t cbRead)
181{
182 return VERR_INTERNAL_ERROR;
183}
184VMMR3DECL(int) DBGFR3MemReadString(PUVM pUVM, VMCPUID idCpu, PCDBGFADDRESS pAddress, char *pszBuf, size_t cchBuf)
185{
186 return VERR_INTERNAL_ERROR;
187}
188VMMR3DECL(int) DBGFR3MemWrite(PUVM pUVM, VMCPUID idCpu, PCDBGFADDRESS pAddress, const void *pvBuf, size_t cbRead)
189{
190 return VERR_INTERNAL_ERROR;
191}
192VMMDECL(int) DBGFR3PagingDumpEx(PUVM pUVM, VMCPUID idCpu, uint32_t fFlags, uint64_t cr3, uint64_t u64FirstAddr,
193 uint64_t u64LastAddr, uint32_t cMaxDepth, PCDBGFINFOHLP pHlp)
194{
195 return VERR_INTERNAL_ERROR;
196}
197VMMR3DECL(int) DBGFR3RegNmValidate(PUVM pUVM, VMCPUID idDefCpu, const char *pszReg)
198{
199 if ( !strcmp(pszReg, "ah")
200 || !strcmp(pszReg, "ax")
201 || !strcmp(pszReg, "eax")
202 || !strcmp(pszReg, "rax"))
203 return VINF_SUCCESS;
204 return VERR_DBGF_REGISTER_NOT_FOUND;
205}
206VMMR3DECL(int) DBGFR3RegCpuQueryU8( PUVM pUVM, VMCPUID idCpu, DBGFREG enmReg, uint8_t *pu8)
207{
208 return VERR_INTERNAL_ERROR;
209}
210VMMR3DECL(int) DBGFR3RegCpuQueryU16( PUVM pUVM, VMCPUID idCpu, DBGFREG enmReg, uint16_t *pu16)
211{
212 return VERR_INTERNAL_ERROR;
213}
214VMMR3DECL(int) DBGFR3RegCpuQueryU32( PUVM pUVM, VMCPUID idCpu, DBGFREG enmReg, uint32_t *pu32)
215{
216 return VERR_INTERNAL_ERROR;
217}
218VMMR3DECL(int) DBGFR3RegCpuQueryU64( PUVM pUVM, VMCPUID idCpu, DBGFREG enmReg, uint64_t *pu64)
219{
220 return VERR_INTERNAL_ERROR;
221}
222VMMR3DECL(int) DBGFR3RegNmQuery(PUVM pUVM, VMCPUID idDefCpu, const char *pszReg, PDBGFREGVAL pValue, PDBGFREGVALTYPE penmType)
223{
224 if (idDefCpu == 0 || idDefCpu == DBGFREG_HYPER_VMCPUID)
225 {
226 if (!strcmp(pszReg, "ah"))
227 {
228 pValue->u16 = 0xf0;
229 *penmType = DBGFREGVALTYPE_U8;
230 return VINF_SUCCESS;
231 }
232 if (!strcmp(pszReg, "ax"))
233 {
234 pValue->u16 = 0xbabe;
235 *penmType = DBGFREGVALTYPE_U16;
236 return VINF_SUCCESS;
237 }
238 if (!strcmp(pszReg, "eax"))
239 {
240 pValue->u32 = 0xcafebabe;
241 *penmType = DBGFREGVALTYPE_U32;
242 return VINF_SUCCESS;
243 }
244 if (!strcmp(pszReg, "rax"))
245 {
246 pValue->u64 = UINT64_C(0x00beef00feedface);
247 *penmType = DBGFREGVALTYPE_U32;
248 return VINF_SUCCESS;
249 }
250 }
251 return VERR_DBGF_REGISTER_NOT_FOUND;
252}
253VMMR3DECL(int) DBGFR3RegPrintf(PUVM pUVM, VMCPUID idCpu, char *pszBuf, size_t cbBuf, const char *pszFormat, ...)
254{
255 return VERR_INTERNAL_ERROR;
256}
257VMMDECL(ssize_t) DBGFR3RegFormatValue(char *pszBuf, size_t cbBuf, PCDBGFREGVAL pValue, DBGFREGVALTYPE enmType, bool fSpecial)
258{
259 return VERR_INTERNAL_ERROR;
260}
261VMMR3DECL(int) DBGFR3RegNmSet(PUVM pUVM, VMCPUID idDefCpu, const char *pszReg, PCDBGFREGVAL pValue, DBGFREGVALTYPE enmType)
262{
263 return VERR_INTERNAL_ERROR;
264}
265
266VMMR3DECL(PDBGFADDRESS) DBGFR3AddrFromPhys(PUVM pUVM, PDBGFADDRESS pAddress, RTGCPHYS PhysAddr)
267{
268 return NULL;
269}
270VMMR3DECL(int) DBGFR3AddrToHostPhys(PUVM pUVM, VMCPUID idCpu, PDBGFADDRESS pAddress, PRTHCPHYS pHCPhys)
271{
272 return VERR_INTERNAL_ERROR;
273}
274VMMR3DECL(int) DBGFR3AddrToVolatileR3Ptr(PUVM pUVM, VMCPUID idCpu, PDBGFADDRESS pAddress, bool fReadOnly, void **ppvR3Ptr)
275{
276 return VERR_INTERNAL_ERROR;
277}
278
279VMMR3DECL(int) DBGFR3OSRegister(PUVM pUVM, PCDBGFOSREG pReg)
280{
281 return VERR_INTERNAL_ERROR;
282}
283VMMR3DECL(int) DBGFR3OSDetect(PUVM pUVM, char *pszName, size_t cchName)
284{
285 return VERR_INTERNAL_ERROR;
286}
287VMMR3DECL(int) DBGFR3OSQueryNameAndVersion(PUVM pUVM, char *pszName, size_t cchName, char *pszVersion, size_t cchVersion)
288{
289 return VERR_INTERNAL_ERROR;
290}
291
292VMMR3DECL(int) DBGFR3SelQueryInfo(PUVM pUVM, VMCPUID idCpu, RTSEL Sel, uint32_t fFlags, PDBGFSELINFO pSelInfo)
293{
294 return VERR_INTERNAL_ERROR;
295}
296
297VMMR3DECL(CPUMMODE) DBGFR3CpuGetMode(PUVM pUVM, VMCPUID idCpu)
298{
299 return CPUMMODE_INVALID;
300}
301VMMR3DECL(VMCPUID) DBGFR3CpuGetCount(PUVM pUVM)
302{
303 return 1;
304}
305VMMR3DECL(bool) DBGFR3CpuIsIn64BitCode(PUVM pUVM, VMCPUID idCpu)
306{
307 return false;
308}
309
310VMMR3DECL(int) DBGFR3CoreWrite(PUVM pUVM, const char *pszFilename, bool fReplaceFile)
311{
312 return VERR_INTERNAL_ERROR;
313}
314
315
316//////////////////////////////////////////////////////////////////////////
317// The rest should eventually be replaced by DBGF calls and eliminated. //
318/////////////////////////////////////////////////////////////////////////
319
320#include <VBox/vmm/cpum.h>
321
322VMMDECL(uint64_t) CPUMGetGuestCR3(PVMCPU pVCpu)
323{
324 return 0;
325}
326
327VMMDECL(uint64_t) CPUMGetGuestCR4(PVMCPU pVCpu)
328{
329 return 0;
330}
331
332VMMDECL(RTSEL) CPUMGetGuestCS(PVMCPU pVCpu)
333{
334 return 0;
335}
336
337VMMDECL(PCCPUMCTXCORE) CPUMGetGuestCtxCore(PVMCPU pVCpu)
338{
339 return NULL;
340}
341
342VMMDECL(uint32_t) CPUMGetGuestEIP(PVMCPU pVCpu)
343{
344 return 0;
345}
346
347VMMDECL(uint64_t) CPUMGetGuestRIP(PVMCPU pVCpu)
348{
349 return 0;
350}
351
352VMMDECL(RTGCPTR) CPUMGetGuestIDTR(PVMCPU pVCpu, uint16_t *pcbLimit)
353{
354 return 0;
355}
356
357VMMDECL(CPUMMODE) CPUMGetGuestMode(PVMCPU pVCpu)
358{
359 return CPUMMODE_INVALID;
360}
361
362VMMDECL(RTSEL) CPUMGetHyperCS(PVMCPU pVCpu)
363{
364 return 0xfff8;
365}
366
367VMMDECL(uint32_t) CPUMGetHyperEIP(PVMCPU pVCpu)
368{
369 return 0;
370}
371
372VMMDECL(PCPUMCTX) CPUMQueryGuestCtxPtr(PVMCPU pVCpu)
373{
374 return NULL;
375}
376
377VMMDECL(bool) CPUMIsGuestIn64BitCode(PVMCPU pVCpu)
378{
379 return false;
380}
381
382
383#include <VBox/vmm/hm.h>
384VMMR3DECL(bool) HMR3IsEnabled(PUVM pUVM)
385{
386 return true;
387}
388
389
390#include <VBox/vmm/pgm.h>
391
392VMMDECL(RTHCPHYS) PGMGetHyperCR3(PVMCPU pVCpu)
393{
394 return 0;
395}
396
397VMMDECL(PGMMODE) PGMGetShadowMode(PVMCPU pVCpu)
398{
399 return PGMMODE_INVALID;
400}
401
402VMMR3DECL(int) PGMR3DbgR3Ptr2GCPhys(PUVM pUVM, RTR3PTR R3Ptr, PRTGCPHYS pGCPhys)
403{
404 return VERR_INTERNAL_ERROR;
405}
406
407VMMR3DECL(int) PGMR3DbgR3Ptr2HCPhys(PUVM pUVM, RTR3PTR R3Ptr, PRTHCPHYS pHCPhys)
408{
409 return VERR_INTERNAL_ERROR;
410}
411VMMR3DECL(int) PGMR3DbgHCPhys2GCPhys(PUVM pUVM, RTHCPHYS HCPhys, PRTGCPHYS pGCPhys)
412{
413 return VERR_INTERNAL_ERROR;
414}
415
416
417#include <VBox/vmm/vmm.h>
418
419VMMR3DECL(PVMCPU) VMMR3GetCpuByIdU(PUVM pUVM, RTCPUID idCpu)
420{
421 return NULL;
422}
423
424
425VMMR3DECL(PVM) VMR3GetVM(PUVM pUVM)
426{
427 return NULL;
428}
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