Changeset 55885 in vbox
- Timestamp:
- May 16, 2015 1:03:11 PM (9 years ago)
- Location:
- trunk
- Files:
-
- 4 edited
-
include/iprt/cpp/ministring.h (modified) (2 diffs)
-
src/VBox/Main/idl/VirtualBox.xidl (modified) (3 diffs)
-
src/VBox/Main/include/MachineDebuggerImpl.h (modified) (1 diff)
-
src/VBox/Main/src-client/MachineDebuggerImpl.cpp (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/include/iprt/cpp/ministring.h
r53624 r55885 248 248 ) 249 249 { 250 int vrc = RTStrRealloc(&m_psz, cb);251 if (RT_SUCCESS( vrc))250 int rc = RTStrRealloc(&m_psz, cb); 251 if (RT_SUCCESS(rc)) 252 252 m_cbAllocated = cb; 253 253 #ifdef RT_EXCEPTIONS_ENABLED … … 256 256 #endif 257 257 } 258 } 259 260 /** 261 * A C like version of the reserve method, i.e. return code instead of throw. 262 * 263 * @returns VINF_SUCCESS or VERR_NO_STRING_MEMORY. 264 * @param cb New minimum size (in bytes) of member memory buffer. 265 */ 266 int reserveNoThrow(size_t cb) 267 { 268 if ( cb != m_cbAllocated 269 && cb > m_cch + 1 270 ) 271 { 272 int rc = RTStrRealloc(&m_psz, cb); 273 if (RT_SUCCESS(rc)) 274 m_cbAllocated = cb; 275 else 276 return rc; 277 } 278 return VINF_SUCCESS; 258 279 } 259 280 -
trunk/src/VBox/Main/idl/VirtualBox.xidl
r55883 r55885 17164 17164 <interface 17165 17165 name="IMachineDebugger" extends="$unknown" 17166 uuid=" b08d5aa9-4e35-3a17-2e4d-61948b590989"17166 uuid="ae7afb78-4265-8c03-ccb9-33a7970057e3" 17167 17167 wsmap="managed" 17168 17168 > … … 17379 17379 </method> 17380 17380 17381 <method name="queryOSKernelLog"> 17382 <desc> 17383 Tries to get the kernel log (dmesg) of the guest OS. 17384 17385 </desc> 17386 <param name="maxMessages" type="unsigned long" dir="in"> 17387 <desc>Max number of messages to return, counting from the end of the 17388 log. If 0, there is no limit.</desc> 17389 </param> 17390 <param name="dmesg" type="wstring" dir="return"> 17391 <desc> 17392 The kernel log. 17393 </desc> 17394 </param> 17395 </method> 17396 17381 17397 <method name="getRegister"> 17382 17398 <desc> 17383 17399 Gets one register. 17384 17385 This feature is not implemented in the 4.0.0 release but may show up17386 in a dot release.17387 17400 </desc> 17388 17401 <param name="cpuId" type="unsigned long" dir="in"> … … 17403 17416 <desc> 17404 17417 Gets all the registers for the given CPU. 17405 17406 This feature is not implemented in the 4.0.0 release but may show up17407 in a dot release.17408 17418 </desc> 17409 17419 <param name="cpuId" type="unsigned long" dir="in"> -
trunk/src/VBox/Main/include/MachineDebuggerImpl.h
r55883 r55885 107 107 HRESULT unloadPlugIn(const com::Utf8Str &aName); 108 108 HRESULT detectOS(com::Utf8Str &aOs); 109 HRESULT queryOSKernelLog(ULONG aMaxMessages, 110 com::Utf8Str &aDmesg); 109 111 HRESULT getRegister(ULONG aCpuId, 110 112 const com::Utf8Str &aName, -
trunk/src/VBox/Main/src-client/MachineDebuggerImpl.cpp
r55883 r55885 1183 1183 else 1184 1184 hrc = setError(VBOX_E_VM_ERROR, tr("DBGFR3OSDetect failed with %Rrc"), vrc); 1185 } 1186 return hrc; 1187 } 1188 1189 HRESULT MachineDebugger::queryOSKernelLog(ULONG aMaxMessages, com::Utf8Str &aDmesg) 1190 { 1191 /* 1192 * Lock the debugger and get the VM pointer 1193 */ 1194 AutoWriteLock alock(this COMMA_LOCKVAL_SRC_POS); 1195 Console::SafeVMPtr ptrVM(mParent); 1196 HRESULT hrc = ptrVM.rc(); 1197 if (SUCCEEDED(hrc)) 1198 { 1199 PDBGFOSIDMESG pDmesg = (PDBGFOSIDMESG)DBGFR3OSQueryInterface(ptrVM.rawUVM(), DBGFOSINTERFACE_DMESG); 1200 if (pDmesg) 1201 { 1202 size_t cbActual; 1203 size_t cbBuf = _512K; 1204 int vrc = aDmesg.reserveNoThrow(cbBuf); 1205 if (RT_SUCCESS(vrc)) 1206 { 1207 uint32_t cMessages = aMaxMessages == 0 ? UINT32_MAX : aMaxMessages; 1208 vrc = pDmesg->pfnQueryKernelLog(pDmesg, ptrVM.rawUVM(), 0 /*fFlags*/, cMessages, 1209 aDmesg.mutableRaw(), cbBuf, &cbActual); 1210 1211 uint32_t cTries = 10; 1212 while (vrc == VERR_BUFFER_OVERFLOW && cbBuf < 16*_1M && cTries-- > 0) 1213 { 1214 cbBuf = RT_ALIGN_Z(cbActual + _4K, _4K); 1215 int vrc = aDmesg.reserveNoThrow(cbBuf); 1216 if (RT_SUCCESS(vrc)) 1217 vrc = pDmesg->pfnQueryKernelLog(pDmesg, ptrVM.rawUVM(), 0 /*fFlags*/, cMessages, 1218 aDmesg.mutableRaw(), cbBuf, &cbActual); 1219 } 1220 if (RT_SUCCESS(vrc)) 1221 aDmesg.jolt(); 1222 else if (vrc == VERR_BUFFER_OVERFLOW) 1223 hrc = setError(E_FAIL, "Too much log available, must use the maxMessages parameter to restrict."); 1224 else 1225 hrc = setErrorVrc(vrc); 1226 } 1227 else 1228 hrc = setErrorBoth(E_OUTOFMEMORY, vrc); 1229 } 1230 else 1231 hrc = setError(E_FAIL, "The dmesg interface isn't implemented by guest OS digger, or detectOS() has not been called."); 1185 1232 } 1186 1233 return hrc;
Note:
See TracChangeset
for help on using the changeset viewer.

