status_t BDebugContext::SetTeamDebuggingFlags(int32 flags) { debug_nub_set_team_flags message; message.flags = flags; return SendDebugMessage(B_DEBUG_MESSAGE_SET_TEAM_FLAGS, &message, sizeof(message), NULL, 0); }
void PrintLeakReport() { if( pMemLogger != 0 ) pMemLogger->PrintLeakReport(); else { SendDebugMessage("no memory logger available"); } }
status_t BDebugContext::ClearWatchpoint(void* address) { debug_nub_clear_watchpoint message; message.address = address; return SendDebugMessage(B_DEBUG_MESSAGE_CLEAR_WATCHPOINT, &message, sizeof(message), NULL, 0); }
status_t BDebugContext::SetThreadDebuggingFlags(thread_id thread, int32 flags) { debug_nub_set_thread_flags message; message.thread = thread; message.flags = flags; return SendDebugMessage(B_DEBUG_MESSAGE_SET_THREAD_FLAGS, &message, sizeof(message), NULL, 0); }
status_t BDebugContext::ContinueThread(thread_id thread, bool singleStep) { debug_nub_continue_thread message; message.thread = thread; message.handle_event = B_THREAD_DEBUG_HANDLE_EVENT; message.single_step = singleStep; return SendDebugMessage(B_DEBUG_MESSAGE_CONTINUE_THREAD, &message, sizeof(message), NULL, 0); }
void JMemoryManager::SendRunningStats() const { std::ostringstream output; output << kJMemoryManagerDebugVersion; output << ' '; WriteRunningStats(output); SendDebugMessage(output); }
status_t BDebugContext::SetBreakpoint(void* address) { debug_nub_set_breakpoint message; message.reply_port = fContext.reply_port; message.address = address; debug_nub_set_breakpoint_reply reply; status_t error = SendDebugMessage(B_DEBUG_MESSAGE_SET_BREAKPOINT, &message, sizeof(message), &reply, sizeof(reply)); return error == B_OK ? reply.error : error; }
status_t BDebugContext::SetWatchpoint(void* address, uint32 type, int32 length) { debug_nub_set_watchpoint message; message.reply_port = fContext.reply_port; message.address = address; message.type = type; message.length = length; debug_nub_set_watchpoint_reply reply; status_t error = SendDebugMessage(B_DEBUG_MESSAGE_SET_WATCHPOINT, &message, sizeof(message), &reply, sizeof(reply)); return error == B_OK ? reply.error : error; }
void JMemoryManager::SendRecords ( istream& input ) const { RecordFilter filter; filter.Read(input); std::ostringstream output; output << kJMemoryManagerDebugVersion; output << ' '; WriteRecords(output, filter); SendDebugMessage(output); }
void JMemoryManager::SendExitStats() const { if (!itsExitStatsFileName->IsEmpty()) { std::ostringstream output; output << kJMemoryManagerDebugVersion; output << ' ' << kExitStatsMessage; output << ' ' << *itsExitStatsFileName; SendDebugMessage(output); theInternalFlag = kJTrue; itsExitStatsStream = new std::ofstream(*itsExitStatsFileName); assert( itsExitStatsStream != NULL ); theInternalFlag = kJFalse; } }
void VMemLogger::PrintLeakReport() { #ifdef V3D_MEM_ENABLE_LOGGING char buffer[1000]; std::sprintf(buffer, "Leak report\n"); std::printf("%s", buffer); SendDebugMessage(buffer); VMemLogEntry* pEntry = firstLog.pNext; long nLeakCount = 0; size_t nLeakSize = 0; while(pEntry != 0 && pEntry != &lastLog ) { std::sprintf(buffer, "[%s#%s:%d] Size %d\n", pEntry->pModuleName, pEntry->pFileName, pEntry->nLine, int(pEntry->nSize)); std::printf("%s", buffer); SendDebugMessage(buffer); ++nLeakCount; nLeakSize += pEntry->nSize; pEntry = pEntry->pNext; } std::sprintf(buffer, "\n%d bytes allocated in %d allocations\n", int(GetTotalAllocatedMem()), int(GetTotalAllocations())); std::printf("%s", buffer); SendDebugMessage(buffer); std::sprintf(buffer, "%d releases\n", GetTotalReleases()); std::printf("%s", buffer); SendDebugMessage(buffer); std::sprintf(buffer, "\n%d bytes of memory leaked in %d places\n\n", nLeakSize, nLeakCount); std::printf("%s", buffer); SendDebugMessage(buffer); #else // no logging enabled SendDebugMessage("\n\nNo memory logging information available\n\n"); #endif // V3D_MEM_ENABLE_LOGGING }