Changeset 32533 in vbox
- Timestamp:
- Sep 15, 2010 5:30:02 PM (14 years ago)
- Location:
- trunk/src/VBox/Devices/VMMDev
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Devices/VMMDev/VMMDev.cpp
r32369 r32533 27 27 #include <VBox/log.h> 28 28 #include <VBox/param.h> 29 #include <iprt/path.h> 30 #include <iprt/dir.h> 31 #include <iprt/file.h> 29 32 #include <VBox/pgm.h> 30 33 #include <VBox/err.h> … … 384 387 #endif /* TIMESYNC_BACKDOOR */ 385 388 389 386 390 /** 387 391 * Port I/O Handler for the generic request interface … … 544 548 { 545 549 PVM pVM = PDMDevHlpGetVM(pDevIns); 546 pRequestHeader->rc = DBGFR3CoreWrite(pVM, NULL /* pszDumpPath */); 550 551 /* 552 * User makes sure the directory exists. 553 */ 554 if (!RTDirExists(pThis->szGuestCoreLocation)) 555 return VERR_FILE_NOT_FOUND; 556 char szCorePath[RTPATH_MAX]; 557 const char *pszCoreDir = pThis->szGuestCoreLocation; 558 RTStrPrintf(szCorePath, sizeof(szCorePath), "%s/VBox.core", pszCoreDir); 559 560 /* 561 * Rotate existing cores based on number of additional cores to keep around. 562 */ 563 if (pThis->cGuestCores > 0) 564 for (int64_t i = pThis->cGuestCores - 1; i >= 0; i--) 565 { 566 char szFilePathOld[RTPATH_MAX]; 567 if (i == 0) 568 RTStrCopy(szFilePathOld, sizeof(szFilePathOld), szCorePath); 569 else 570 RTStrPrintf(szFilePathOld, sizeof(szFilePathOld), "%s.%d", szCorePath, i); 571 572 char szFilePathNew[RTPATH_MAX]; 573 RTStrPrintf(szFilePathNew, sizeof(szFilePathNew), "%s.%d", szCorePath, i + 1); 574 int vrc = RTFileMove(szFilePathOld, szFilePathNew, RTFILEMOVE_FLAGS_REPLACE); 575 if (vrc == VERR_FILE_NOT_FOUND) 576 RTFileDelete(szFilePathNew); 577 } 578 579 /* 580 * Write the core file. 581 */ 582 pRequestHeader->rc = DBGFR3CoreWrite(pVM, szCorePath); 547 583 } 548 584 else … … 2899 2935 "RZEnabled|" 2900 2936 "GuestCoreDumpEnabled|" 2937 "GuestCoreLocation|" 2938 "GuestCoreCount|" 2901 2939 "TestingEnabled" 2902 2940 , … … 2937 2975 return PDMDEV_SET_ERROR(pDevIns, rc, 2938 2976 N_("Configuration error: Failed querying \"GuestCoreDumpEnabled\" as a boolean")); 2977 2978 /** @todo change this to Snapshots folder!! */ 2979 char szDefaultCoreLocation[RTPATH_MAX]; 2980 RTPathUserHome(szDefaultCoreLocation, sizeof(szDefaultCoreLocation)); 2981 rc = CFGMR3QueryStringDef(pCfg, "GuestCoreLocation", pThis->szGuestCoreLocation, sizeof(pThis->szGuestCoreLocation), 2982 szDefaultCoreLocation); 2983 if (RT_FAILURE(rc)) 2984 return PDMDEV_SET_ERROR(pDevIns, rc, 2985 N_("Configuration error: Failed querying \"GuestCoreDumpLocation\" as a string")); 2986 2987 rc = CFGMR3QueryU32Def(pCfg, "GuestCoreCount", &pThis->cGuestCores, 3); 2988 if (RT_FAILURE(rc)) 2989 return PDMDEV_SET_ERROR(pDevIns, rc, 2990 N_("Configuration error: Failed querying \"GuestCoreCount\" as a 32-bit unsigned integer")); 2939 2991 2940 2992 #ifndef VBOX_WITHOUT_TESTING_FEATURES -
trunk/src/VBox/Devices/VMMDev/VMMDevState.h
r32369 r32533 224 224 bool fGuestCoreDumpEnabled; 225 225 226 /** Alignment padding. */ 227 bool afAlignment7[4]; 226 /** Guest Core Dump location. */ 227 char szGuestCoreLocation[RTPATH_MAX]; 228 229 /** Number of additional cores to keep around. */ 230 uint32_t cGuestCores; 231 232 bool afAlignment7[1]; 228 233 229 234 #ifdef VBOX_WITH_HGCM
Note:
See TracChangeset
for help on using the changeset viewer.