2004-03-18 02:08:43 +00:00
|
|
|
/*
|
|
|
|
* NtDll debug buffer functions
|
|
|
|
*
|
|
|
|
* Copyright 2004 Raphael Junqueira
|
|
|
|
*
|
|
|
|
* This library is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU Lesser General Public
|
|
|
|
* License as published by the Free Software Foundation; either
|
|
|
|
* version 2.1 of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This library is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
* Lesser General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU Lesser General Public
|
|
|
|
* License along with this library; if not, write to the Free Software
|
2006-05-18 12:49:52 +00:00
|
|
|
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
|
2004-03-18 02:08:43 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
#include "config.h"
|
|
|
|
#include "wine/port.h"
|
|
|
|
|
|
|
|
#include <stdarg.h>
|
|
|
|
#include <stdlib.h>
|
|
|
|
#include <string.h>
|
|
|
|
|
2005-11-28 16:32:54 +00:00
|
|
|
#include "ntstatus.h"
|
|
|
|
#define WIN32_NO_STATUS
|
2004-03-18 02:08:43 +00:00
|
|
|
#include "windef.h"
|
|
|
|
#include "winnt.h"
|
|
|
|
#include "winternl.h"
|
|
|
|
#include "ntdll_misc.h"
|
|
|
|
#include "wine/debug.h"
|
|
|
|
|
|
|
|
WINE_DEFAULT_DEBUG_CHANNEL(debug_buffer);
|
|
|
|
|
2007-06-22 18:49:30 +00:00
|
|
|
static void dump_DEBUG_MODULE_INFORMATION(const DEBUG_MODULE_INFORMATION *iBuf)
|
2004-03-18 02:08:43 +00:00
|
|
|
{
|
|
|
|
TRACE( "MODULE_INFORMATION:%p\n", iBuf );
|
|
|
|
if (NULL == iBuf) return ;
|
2006-10-16 11:49:06 +00:00
|
|
|
TRACE( "Base:%d\n", iBuf->Base );
|
|
|
|
TRACE( "Size:%d\n", iBuf->Size );
|
|
|
|
TRACE( "Flags:%d\n", iBuf->Flags );
|
2004-03-18 02:08:43 +00:00
|
|
|
}
|
|
|
|
|
2007-06-22 18:49:30 +00:00
|
|
|
static void dump_DEBUG_HEAP_INFORMATION(const DEBUG_HEAP_INFORMATION *iBuf)
|
2004-03-18 02:08:43 +00:00
|
|
|
{
|
|
|
|
TRACE( "HEAP_INFORMATION:%p\n", iBuf );
|
|
|
|
if (NULL == iBuf) return ;
|
2006-10-16 11:49:06 +00:00
|
|
|
TRACE( "Base:%d\n", iBuf->Base );
|
|
|
|
TRACE( "Flags:%d\n", iBuf->Flags );
|
2004-03-18 02:08:43 +00:00
|
|
|
}
|
|
|
|
|
2007-06-22 18:49:30 +00:00
|
|
|
static void dump_DEBUG_LOCK_INFORMATION(const DEBUG_LOCK_INFORMATION *iBuf)
|
2004-03-18 02:08:43 +00:00
|
|
|
{
|
|
|
|
TRACE( "LOCK_INFORMATION:%p\n", iBuf );
|
|
|
|
|
|
|
|
if (NULL == iBuf) return ;
|
|
|
|
|
|
|
|
TRACE( "Address:%p\n", iBuf->Address );
|
|
|
|
TRACE( "Type:%d\n", iBuf->Type );
|
|
|
|
TRACE( "CreatorBackTraceIndex:%d\n", iBuf->CreatorBackTraceIndex );
|
2006-10-16 11:49:06 +00:00
|
|
|
TRACE( "OwnerThreadId:%d\n", iBuf->OwnerThreadId );
|
|
|
|
TRACE( "ActiveCount:%d\n", iBuf->ActiveCount );
|
|
|
|
TRACE( "ContentionCount:%d\n", iBuf->ContentionCount );
|
|
|
|
TRACE( "EntryCount:%d\n", iBuf->EntryCount );
|
|
|
|
TRACE( "RecursionCount:%d\n", iBuf->RecursionCount );
|
|
|
|
TRACE( "NumberOfSharedWaiters:%d\n", iBuf->NumberOfSharedWaiters );
|
|
|
|
TRACE( "NumberOfExclusiveWaiters:%d\n", iBuf->NumberOfExclusiveWaiters );
|
2004-03-18 02:08:43 +00:00
|
|
|
}
|
|
|
|
|
2007-06-22 18:49:30 +00:00
|
|
|
static void dump_DEBUG_BUFFER(const DEBUG_BUFFER *iBuf)
|
2004-03-18 02:08:43 +00:00
|
|
|
{
|
|
|
|
if (NULL == iBuf) return ;
|
|
|
|
TRACE( "SectionHandle:%p\n", iBuf->SectionHandle);
|
|
|
|
TRACE( "SectionBase:%p\n", iBuf->SectionBase);
|
|
|
|
TRACE( "RemoteSectionBase:%p\n", iBuf->RemoteSectionBase);
|
2006-10-16 11:49:06 +00:00
|
|
|
TRACE( "SectionBaseDelta:%d\n", iBuf->SectionBaseDelta);
|
2004-03-18 02:08:43 +00:00
|
|
|
TRACE( "EventPairHandle:%p\n", iBuf->EventPairHandle);
|
|
|
|
TRACE( "RemoteThreadHandle:%p\n", iBuf->RemoteThreadHandle);
|
2006-10-16 11:49:06 +00:00
|
|
|
TRACE( "InfoClassMask:%x\n", iBuf->InfoClassMask);
|
|
|
|
TRACE( "SizeOfInfo:%d\n", iBuf->SizeOfInfo);
|
|
|
|
TRACE( "AllocatedSize:%d\n", iBuf->AllocatedSize);
|
|
|
|
TRACE( "SectionSize:%d\n", iBuf->SectionSize);
|
2004-03-18 02:08:43 +00:00
|
|
|
TRACE( "BackTraceInfo:%p\n", iBuf->BackTraceInformation);
|
|
|
|
dump_DEBUG_MODULE_INFORMATION(iBuf->ModuleInformation);
|
|
|
|
dump_DEBUG_HEAP_INFORMATION(iBuf->HeapInformation);
|
|
|
|
dump_DEBUG_LOCK_INFORMATION(iBuf->LockInformation);
|
|
|
|
}
|
|
|
|
|
|
|
|
PDEBUG_BUFFER WINAPI RtlCreateQueryDebugBuffer(IN ULONG iSize, IN BOOLEAN iEventPair)
|
|
|
|
{
|
|
|
|
PDEBUG_BUFFER oBuf = NULL;
|
2006-10-16 11:49:06 +00:00
|
|
|
FIXME("(%d, %d): stub\n", iSize, iEventPair);
|
2004-03-18 02:08:43 +00:00
|
|
|
if (iSize < sizeof(DEBUG_BUFFER)) {
|
|
|
|
iSize = sizeof(DEBUG_BUFFER);
|
|
|
|
}
|
2008-10-23 21:53:02 +00:00
|
|
|
oBuf = RtlAllocateHeap(GetProcessHeap(), 0, iSize);
|
2004-03-18 02:08:43 +00:00
|
|
|
memset(oBuf, 0, iSize);
|
2006-10-16 11:49:06 +00:00
|
|
|
FIXME("(%d, %d): returning %p\n", iSize, iEventPair, oBuf);
|
2004-03-18 02:08:43 +00:00
|
|
|
return oBuf;
|
|
|
|
}
|
|
|
|
|
|
|
|
NTSTATUS WINAPI RtlDestroyQueryDebugBuffer(IN PDEBUG_BUFFER iBuf)
|
|
|
|
{
|
|
|
|
NTSTATUS nts = STATUS_SUCCESS;
|
|
|
|
FIXME("(%p): stub\n", iBuf);
|
|
|
|
if (NULL != iBuf) {
|
2006-05-01 20:44:43 +00:00
|
|
|
RtlFreeHeap(GetProcessHeap(), 0, iBuf->ModuleInformation);
|
|
|
|
RtlFreeHeap(GetProcessHeap(), 0, iBuf->HeapInformation);
|
|
|
|
RtlFreeHeap(GetProcessHeap(), 0, iBuf->LockInformation);
|
2004-03-18 02:08:43 +00:00
|
|
|
RtlFreeHeap(GetProcessHeap(), 0, iBuf);
|
|
|
|
}
|
|
|
|
return nts;
|
|
|
|
}
|
|
|
|
|
|
|
|
NTSTATUS WINAPI RtlQueryProcessDebugInformation(IN ULONG iProcessId, IN ULONG iDebugInfoMask, IN OUT PDEBUG_BUFFER iBuf)
|
|
|
|
{
|
|
|
|
NTSTATUS nts = STATUS_SUCCESS;
|
2006-10-16 11:49:06 +00:00
|
|
|
FIXME("(%d, %x, %p): stub\n", iProcessId, iDebugInfoMask, iBuf);
|
2004-03-18 02:08:43 +00:00
|
|
|
iBuf->InfoClassMask = iDebugInfoMask;
|
|
|
|
|
|
|
|
if (iDebugInfoMask & PDI_MODULES) {
|
|
|
|
PDEBUG_MODULE_INFORMATION info = RtlAllocateHeap(GetProcessHeap(), 0, sizeof(DEBUG_MODULE_INFORMATION));
|
|
|
|
memset(info, 0, sizeof(DEBUG_MODULE_INFORMATION));
|
|
|
|
iBuf->ModuleInformation = info;
|
|
|
|
}
|
|
|
|
if (iDebugInfoMask & PDI_HEAPS) {
|
|
|
|
PDEBUG_HEAP_INFORMATION info = RtlAllocateHeap(GetProcessHeap(), 0, sizeof(DEBUG_HEAP_INFORMATION));
|
|
|
|
memset(info, 0, sizeof(DEBUG_HEAP_INFORMATION));
|
|
|
|
if (iDebugInfoMask & PDI_HEAP_TAGS) {
|
|
|
|
}
|
|
|
|
if (iDebugInfoMask & PDI_HEAP_BLOCKS) {
|
|
|
|
}
|
|
|
|
iBuf->HeapInformation = info;
|
|
|
|
}
|
|
|
|
if (iDebugInfoMask & PDI_LOCKS) {
|
|
|
|
PDEBUG_LOCK_INFORMATION info = RtlAllocateHeap(GetProcessHeap(), 0, sizeof(DEBUG_LOCK_INFORMATION));
|
|
|
|
memset(info, 0, sizeof(DEBUG_LOCK_INFORMATION));
|
|
|
|
iBuf->LockInformation = info;
|
|
|
|
}
|
|
|
|
TRACE("returns:%p\n", iBuf);
|
|
|
|
dump_DEBUG_BUFFER(iBuf);
|
|
|
|
return nts;
|
|
|
|
}
|