Changeset 34902 in vbox for trunk/src/VBox
- Timestamp:
- Dec 9, 2010 4:16:51 PM (14 years ago)
- Location:
- trunk/src/VBox
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Debugger/DBGCCommands.cpp
r32313 r34902 2112 2112 return DBGCCmdHlpFail(pCmdHlp, pCmd, "Missing file path.\n"); 2113 2113 2114 int rc = DBGFR3CoreWrite(pVM, pszDumpPath );2114 int rc = DBGFR3CoreWrite(pVM, pszDumpPath, true /*fReplaceFile*/); 2115 2115 if (RT_FAILURE(rc)) 2116 2116 return DBGCCmdHlpFail(pCmdHlp, pCmd, "DBGFR3WriteCore failed. rc=%Rrc\n", rc); -
trunk/src/VBox/Debugger/testcase/tstDBGCStubs.cpp
r32313 r34902 237 237 } 238 238 239 VMMR3DECL(int) DBGFR3CoreWrite(PVM pVM, const char *psz DumpPath)239 VMMR3DECL(int) DBGFR3CoreWrite(PVM pVM, const char *pszFilename, bool fReplaceFile) 240 240 { 241 241 return VERR_INTERNAL_ERROR; -
trunk/src/VBox/Devices/VMMDev/VMMDev.cpp
r34534 r34902 581 581 */ 582 582 PVM pVM = PDMDevHlpGetVM(pDevIns); 583 pRequestHeader->rc = DBGFR3CoreWrite(pVM, szCorePath );583 pRequestHeader->rc = DBGFR3CoreWrite(pVM, szCorePath, true /*fReplaceFile*/); 584 584 } 585 585 else -
trunk/src/VBox/Main/MachineDebuggerImpl.cpp
r31698 r34902 718 718 719 719 /** 720 * Set the new patch manager enabled flag. 721 * 722 * @returns COM status code 723 * @param new patch manager enabled flag 720 * Injects an NMI. 721 * 722 * @returns COM status code 724 723 */ 725 724 STDMETHODIMP MachineDebugger::InjectNMI() … … 738 737 739 738 return S_OK; 739 } 740 741 /** 742 * Triggers a guest core dump. 743 * 744 * @returns COM status code 745 * @param 746 */ 747 STDMETHODIMP MachineDebugger::DumpGuestCore(IN_BSTR a_bstrFilename) 748 { 749 CheckComArgStrNotEmptyOrNull(a_bstrFilename); 750 Utf8Str strFilename(a_bstrFilename); 751 752 AutoCaller autoCaller(this); 753 HRESULT hrc = autoCaller.rc(); 754 if (SUCCEEDED(hrc)) 755 { 756 AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS); 757 Console::SafeVMPtr ptrVM(mParent); 758 hrc = ptrVM.rc(); 759 if (SUCCEEDED(hrc)) 760 { 761 int vrc = DBGFR3CoreWrite(ptrVM, strFilename.c_str(), false /*fReplaceFile*/); 762 if (RT_SUCCESS(vrc)) 763 hrc = S_OK; 764 else 765 hrc = setError(E_FAIL, tr("DBGFR3CoreWrite failed with %Rrc"), vrc); 766 } 767 } 768 769 return hrc; 740 770 } 741 771 -
trunk/src/VBox/Main/idl/VirtualBox.xidl
r34899 r34902 11875 11875 <interface 11876 11876 name="IMachineDebugger" extends="$unknown" 11877 uuid=" b0b2a2dd-0627-4502-91c2-ddc5e77609e0"11877 uuid="373a5f51-67c1-4a31-be43-1e29ebe8ef85" 11878 11878 wsmap="suppress" 11879 11879 > … … 11915 11915 Inject an NMI into a running VT-x/AMD-V VM. 11916 11916 </desc> 11917 </method> 11918 11919 <method name="dumpGuestCore"> 11920 <desc> 11921 Takes a core dump of the guest. 11922 11923 See include/VBox/dbgfcorefmt.h for details on the file format. 11924 </desc> 11925 <param name="filename" type="wstring" dir="in"> 11926 <desc> 11927 The name of the output file. The file must not exist. 11928 </desc> 11929 </param> 11917 11930 </method> 11918 11931 -
trunk/src/VBox/Main/include/MachineDebuggerImpl.h
r31698 r34902 73 73 STDMETHOD(COMGETTER(VM)) (LONG64 *aVm); 74 74 STDMETHOD(InjectNMI)(); 75 STDMETHOD(DumpGuestCore)(IN_BSTR a_bstrFilename); 75 76 76 77 // IMachineDebugger methods -
trunk/src/VBox/VMM/DBGFCoreWrite.cpp
r34197 r34902 67 67 #include "../Runtime/include/internal/ldrELF64.h" 68 68 69 69 70 /******************************************************************************* 70 71 * Defined Constants And Macros * … … 76 77 #define DBGFLOG_NAME "DBGFCoreWrite" 77 78 79 80 /******************************************************************************* 81 * Global Variables * 82 *******************************************************************************/ 78 83 static const int s_NoteAlign = 8; 79 84 static const int s_cbNoteName = 16; … … 84 89 85 90 86 /** 87 * DBGFCOREDATA: Core data. 88 */ 89 typedef struct 90 { 91 const char *pszDumpPath; /* File path to dump the core into. */ 92 } DBGFCOREDATA, *PDBGFCOREDATA; 91 /******************************************************************************* 92 * Structures and Typedefs * 93 *******************************************************************************/ 94 /** 95 * Guest core writer data. 96 * 97 * Used to pass parameters from DBGFR3CoreWrite to dbgfR3CoreWriteRendezvous. 98 */ 99 typedef struct DBGFCOREDATA 100 { 101 /** The name of the file to write the file to. */ 102 const char *pszFilename; 103 /** Whether to replace (/overwrite) any existing file. */ 104 bool fReplaceFile; 105 } DBGFCOREDATA; 106 /** Pointer to the guest core writer data. */ 107 typedef DBGFCOREDATA *PDBGFCOREDATA; 108 109 93 110 94 111 /** … … 299 316 * @returns VBox status code 300 317 * @param pVM The VM handle. 301 * @param pDbgfData The core dump parameters.302 318 * @param hFile The file to write to. Caller closes this. 303 319 */ 304 static int dbgfR3CoreWriteWorker(PVM pVM, PDBGFCOREDATA pDbgfData,RTFILE hFile)320 static int dbgfR3CoreWriteWorker(PVM pVM, RTFILE hFile) 305 321 { 306 322 /* … … 487 503 * @return VBox status code. 488 504 */ 489 static DECLCALLBACK(VBOXSTRICTRC) dbgfR3CoreWrite (PVM pVM, PVMCPU pVCpu, void *pvData)505 static DECLCALLBACK(VBOXSTRICTRC) dbgfR3CoreWriteRendezvous(PVM pVM, PVMCPU pVCpu, void *pvData) 490 506 { 491 507 /* … … 501 517 * Create the core file. 502 518 */ 503 RTFILE hFile; 504 int rc = RTFileOpen(&hFile, pDbgfData->pszDumpPath, RTFILE_O_WRITE | RTFILE_O_CREATE_REPLACE | RTFILE_O_DENY_WRITE); 519 uint32_t fFlags = (pDbgfData->fReplaceFile ? RTFILE_O_CREATE_REPLACE : RTFILE_O_CREATE) 520 | RTFILE_O_WRITE 521 | RTFILE_O_DENY_ALL 522 | (0600 << RTFILE_O_CREATE_MODE_SHIFT); 523 RTFILE hFile; 524 int rc = RTFileOpen(&hFile, pDbgfData->pszFilename, fFlags); 505 525 if (RT_SUCCESS(rc)) 506 526 { 507 rc = dbgfR3CoreWriteWorker(pVM, pDbgfData,hFile);527 rc = dbgfR3CoreWriteWorker(pVM, hFile); 508 528 RTFileClose(hFile); 509 529 } 510 530 else 511 LogRel((DBGFLOG_NAME ": RTFileOpen failed for '%s' rc=%Rrc\n", pDbgfData->psz DumpPath, rc));531 LogRel((DBGFLOG_NAME ": RTFileOpen failed for '%s' rc=%Rrc\n", pDbgfData->pszFilename, rc)); 512 532 return rc; 513 533 } … … 517 537 * Write core dump of the guest. 518 538 * 519 * @return VBox status code.539 * @returns VBox status code. 520 540 * @param pVM The VM handle. 521 * @param pszDumpPath The path of the file to dump into, cannot be 522 * NULL. 523 * 524 * @remarks The VM must be suspended before calling this function. 525 */ 526 VMMR3DECL(int) DBGFR3CoreWrite(PVM pVM, const char *pszDumpPath) 541 * @param pszFilename The name of the file to which the guest core 542 * dump should be written. 543 * @param fReplaceFile Whether to replace the file or not. 544 * 545 * @remarks The VM should be suspended before calling this function or DMA may 546 * interfer with the state. 547 */ 548 VMMR3DECL(int) DBGFR3CoreWrite(PVM pVM, const char *pszFilename, bool fReplaceFile) 527 549 { 528 550 VM_ASSERT_VALID_EXT_RETURN(pVM, VERR_INVALID_VM_HANDLE); 529 AssertReturn(psz DumpPath, VERR_INVALID_HANDLE);551 AssertReturn(pszFilename, VERR_INVALID_HANDLE); 530 552 531 553 /* … … 536 558 DBGFCOREDATA CoreData; 537 559 RT_ZERO(CoreData); 538 CoreData.pszDumpPath = pszDumpPath; 539 540 int rc = VMMR3EmtRendezvous(pVM, VMMEMTRENDEZVOUS_FLAGS_TYPE_ONCE, dbgfR3CoreWrite, &CoreData); 560 CoreData.pszFilename = pszFilename; 561 CoreData.fReplaceFile = fReplaceFile; 562 563 int rc = VMMR3EmtRendezvous(pVM, VMMEMTRENDEZVOUS_FLAGS_TYPE_ONCE, dbgfR3CoreWriteRendezvous, &CoreData); 541 564 if (RT_SUCCESS(rc)) 542 LogRel((DBGFLOG_NAME ": Successfully wrote guest core dump %s\n", pszDumpPath));565 LogRel((DBGFLOG_NAME ": Successfully wrote guest core dump '%s'\n", pszFilename)); 543 566 else 544 LogRel((DBGFLOG_NAME ": Failed to write guest core dump %s. rc=%Rrc\n", pszDumpPath, rc));567 LogRel((DBGFLOG_NAME ": Failed to write guest core dump '%s'. rc=%Rrc\n", pszFilename, rc)); 545 568 return rc; 546 569 }
Note:
See TracChangeset
for help on using the changeset viewer.