mirror of
https://github.com/reactos/reactos.git
synced 2024-12-27 17:44:45 +00:00
2002-07-13 Casper S. Hornstrup <chorns@users.sourceforge.net>
* rules.mak (RSYM): Define. * include/ddk/zwtypes.h (DebugDbgLoadSymbols): Add to enum _DEBUG_CONTROL_CODE. * include/ntdll/ldr.h (LDR_SYMBOL_INFO, LdrpLoadUserModuleSymbols): Add. (LdrLoadModuleSymbols): Remove. * include/ntos/kdbgsyms.h (ST_FILENAME, ST_FUNCTION, ST_LINENUMBER): Add. (SYMBOL). Make Name an ANSI_STRING. (IMAGE_SYMBOL_INFO, AreSymbolsParsed): Add. * lib/ntdll/ldr/startup.c (LdrInitializeThunk): Call LdrpLoadUserModuleSymbols() not LdrLoadModuleSymbols(). * lib/ntdll/ldr/utils.c (LdrLoadModuleSymbols): Rename to LdrpLoadUserModuleSymbols. (LdrpLoadUserModuleSymbols): Use DebugDbgLoadSymbols debug control code. (LdrLoadDll): assert if out of memory. (LdrLoadDll): Call LdrpLoadUserModuleSymbols(), not LdrLoadModuleSymbols(). * lib/ntdll/string/ctype.c (_pctype): #undef. * ntoskrnl/dbg/dbgctrl.c (NtSystemDebugControl): Call LdrLoadUserModuleSymbols on DebugDbgLoadSymbols. * ntoskrnl/include/internal/ldr.h (LdrGetAddressInformation): Add. * ntoskrnl/include/internal/module.h (MODULE_TEXT_SECTION): Make SymbolInfo an IMAGE_SYMBOL_INFO. * ntoskrnl/ke/i386/exp.c (LdrGetAddressInformation): Add prototype. (print_address): Change #ifdef KDBG to #ifdef DBG. (KiDoubleFaultHandler, KiDumpTrapFrame, KeDumpStackFrames): Dump one stack frame per line. * ntoskrnl/ke/i386/multiboot.S: Create pagetables for more kernel address space so larger modules can be passed from the boot loader. * ntoskrnl/ke/i386/usertrap.c (LdrGetAddressInformation): Add prototype. (print_user_address): Print symbols using LdrGetAddressInformation(). * ntoskrnl/ldr/loader.c (SYMBOLFILE_HEADER, IMAGE_SYMBOL_INFO_CACHE, STAB_ENTRY, N_FUN, N_SLINE, N_SO, SymbolListHead): Add. (TAG_SYM_BUF): Remove. (LdrInitDebug): Remove unneeded code. (LdrInit1): Prepare for loading symbols. (LdrpReadLine, HexL, LdrpParseLine, LdrpLoadModuleSymbolsFromBuffer, LdrpLoadUserModuleSymbolsFromBuffer): Remove. (LdrpParseImageSymbols, LdrpGetFileName, LdrpGetFunctionName, LdrpGetLineNumber, LdrGetAddressInformation, LdrpLookupUserSymbolInfo): Add. (LdrpLoadModuleSymbols, LdrInitializeBootStartDriver): Change to use new symbol structures. (LdrLoadUserModuleSymbols): Cache symbol buffers. (LdrUnloadModuleSymbols): Implement. (LdrLoadModule, LdrUnloadModule): Change #ifdef KDBG to #ifdef DBG. (LdrPEProcessModule): Split a line into two lines. (LdrPEProcessModule): Setup for loading symbols. * ntoskrnl/ldr/sysdll.c (LdrpMapSystemDll): Open with FILE_SHARE_READ. * ntoskrnl/ps/process.c (PiFreeSymbols): Call LdrUnloadModuleSymbols() to free symbols. (PiDeleteProcess): Change #ifdef KDBG to #ifdef DBG. * ntoskrnl/rtl/ctype.c (_pctype): #undef. * ntoskrnl/rtl/string.c (strncpy): Terminate destination string. * tools/Makefile (rsym): Add target. * tools/helper.mk: Include config and use -g if DBG = 1. svn path=/trunk/; revision=3212
This commit is contained in:
parent
3e56065829
commit
84b74a9cd9
23 changed files with 1068 additions and 539 deletions
|
@ -1,3 +1,61 @@
|
||||||
|
2002-07-13 Casper S. Hornstrup <chorns@users.sourceforge.net>
|
||||||
|
|
||||||
|
* rules.mak (RSYM): Define.
|
||||||
|
* include/ddk/zwtypes.h (DebugDbgLoadSymbols): Add to enum
|
||||||
|
_DEBUG_CONTROL_CODE.
|
||||||
|
* include/ntdll/ldr.h (LDR_SYMBOL_INFO, LdrpLoadUserModuleSymbols): Add.
|
||||||
|
(LdrLoadModuleSymbols): Remove.
|
||||||
|
* include/ntos/kdbgsyms.h (ST_FILENAME, ST_FUNCTION,
|
||||||
|
ST_LINENUMBER): Add.
|
||||||
|
(SYMBOL). Make Name an ANSI_STRING.
|
||||||
|
(IMAGE_SYMBOL_INFO, AreSymbolsParsed): Add.
|
||||||
|
* lib/ntdll/ldr/startup.c (LdrInitializeThunk): Call
|
||||||
|
LdrpLoadUserModuleSymbols() not LdrLoadModuleSymbols().
|
||||||
|
* lib/ntdll/ldr/utils.c (LdrLoadModuleSymbols): Rename to
|
||||||
|
LdrpLoadUserModuleSymbols.
|
||||||
|
(LdrpLoadUserModuleSymbols): Use DebugDbgLoadSymbols debug control code.
|
||||||
|
(LdrLoadDll): assert if out of memory.
|
||||||
|
(LdrLoadDll): Call
|
||||||
|
LdrpLoadUserModuleSymbols(), not LdrLoadModuleSymbols().
|
||||||
|
* lib/ntdll/string/ctype.c (_pctype): #undef.
|
||||||
|
* ntoskrnl/dbg/dbgctrl.c (NtSystemDebugControl): Call
|
||||||
|
LdrLoadUserModuleSymbols on DebugDbgLoadSymbols.
|
||||||
|
* ntoskrnl/include/internal/ldr.h (LdrGetAddressInformation): Add.
|
||||||
|
* ntoskrnl/include/internal/module.h (MODULE_TEXT_SECTION): Make SymbolInfo
|
||||||
|
an IMAGE_SYMBOL_INFO.
|
||||||
|
* ntoskrnl/ke/i386/exp.c (LdrGetAddressInformation): Add prototype.
|
||||||
|
(print_address): Change #ifdef KDBG to #ifdef DBG.
|
||||||
|
(KiDoubleFaultHandler, KiDumpTrapFrame, KeDumpStackFrames): Dump
|
||||||
|
one stack frame per line.
|
||||||
|
* ntoskrnl/ke/i386/multiboot.S: Create pagetables for more kernel
|
||||||
|
address space so larger modules can be passed from the boot loader.
|
||||||
|
* ntoskrnl/ke/i386/usertrap.c (LdrGetAddressInformation): Add prototype.
|
||||||
|
(print_user_address): Print symbols using LdrGetAddressInformation().
|
||||||
|
* ntoskrnl/ldr/loader.c (SYMBOLFILE_HEADER, IMAGE_SYMBOL_INFO_CACHE,
|
||||||
|
STAB_ENTRY, N_FUN, N_SLINE, N_SO, SymbolListHead): Add.
|
||||||
|
(TAG_SYM_BUF): Remove.
|
||||||
|
(LdrInitDebug): Remove unneeded code.
|
||||||
|
(LdrInit1): Prepare for loading symbols.
|
||||||
|
(LdrpReadLine, HexL, LdrpParseLine, LdrpLoadModuleSymbolsFromBuffer,
|
||||||
|
LdrpLoadUserModuleSymbolsFromBuffer): Remove.
|
||||||
|
(LdrpParseImageSymbols, LdrpGetFileName, LdrpGetFunctionName,
|
||||||
|
LdrpGetLineNumber, LdrGetAddressInformation, LdrpLookupUserSymbolInfo): Add.
|
||||||
|
(LdrpLoadModuleSymbols, LdrInitializeBootStartDriver): Change to use new
|
||||||
|
symbol structures.
|
||||||
|
(LdrLoadUserModuleSymbols): Cache symbol buffers.
|
||||||
|
(LdrUnloadModuleSymbols): Implement.
|
||||||
|
(LdrLoadModule, LdrUnloadModule): Change #ifdef KDBG to #ifdef DBG.
|
||||||
|
(LdrPEProcessModule): Split a line into two lines.
|
||||||
|
(LdrPEProcessModule): Setup for loading symbols.
|
||||||
|
* ntoskrnl/ldr/sysdll.c (LdrpMapSystemDll): Open with FILE_SHARE_READ.
|
||||||
|
* ntoskrnl/ps/process.c (PiFreeSymbols): Call LdrUnloadModuleSymbols() to
|
||||||
|
free symbols.
|
||||||
|
(PiDeleteProcess): Change #ifdef KDBG to #ifdef DBG.
|
||||||
|
* ntoskrnl/rtl/ctype.c (_pctype): #undef.
|
||||||
|
* ntoskrnl/rtl/string.c (strncpy): Terminate destination string.
|
||||||
|
* tools/Makefile (rsym): Add target.
|
||||||
|
* tools/helper.mk: Include config and use -g if DBG = 1.
|
||||||
|
|
||||||
2002-07-13 Casper S. Hornstrup <chorns@users.sourceforge.net>
|
2002-07-13 Casper S. Hornstrup <chorns@users.sourceforge.net>
|
||||||
|
|
||||||
* Makefile (install_before): Install system.hiv to correct location.
|
* Makefile (install_before): Install system.hiv to correct location.
|
||||||
|
|
|
@ -8,7 +8,8 @@ typedef enum _DEBUG_CONTROL_CODE
|
||||||
DebugSetSpecialCalls,
|
DebugSetSpecialCalls,
|
||||||
DebugClearSpecialCalls,
|
DebugClearSpecialCalls,
|
||||||
DebugQuerySpecialCalls,
|
DebugQuerySpecialCalls,
|
||||||
DebugDbgBreakPoint
|
DebugDbgBreakPoint,
|
||||||
|
DebugDbgLoadSymbols
|
||||||
} DEBUG_CONTROL_CODE;
|
} DEBUG_CONTROL_CODE;
|
||||||
|
|
||||||
typedef enum _KPROFILE_SOURCE
|
typedef enum _KPROFILE_SOURCE
|
||||||
|
|
|
@ -19,11 +19,20 @@ typedef struct _LDR_MODULE
|
||||||
HANDLE SectionHandle;
|
HANDLE SectionHandle;
|
||||||
ULONG CheckSum;
|
ULONG CheckSum;
|
||||||
ULONG TimeDateStamp;
|
ULONG TimeDateStamp;
|
||||||
#ifdef KDBG
|
#ifdef DBG
|
||||||
SYMBOL_TABLE Symbols;
|
IMAGE_SYMBOL_INFO SymbolInfo;
|
||||||
#endif /* KDBG */
|
#endif /* DBG */
|
||||||
} LDR_MODULE, *PLDR_MODULE;
|
} LDR_MODULE, *PLDR_MODULE;
|
||||||
|
|
||||||
|
typedef struct _LDR_SYMBOL_INFO {
|
||||||
|
PLDR_MODULE ModuleObject;
|
||||||
|
ULONG_PTR ImageBase;
|
||||||
|
PVOID SymbolsBuffer;
|
||||||
|
ULONG SymbolsBufferLength;
|
||||||
|
PVOID SymbolStringsBuffer;
|
||||||
|
ULONG SymbolStringsBufferLength;
|
||||||
|
} LDR_SYMBOL_INFO, *PLDR_SYMBOL_INFO;
|
||||||
|
|
||||||
|
|
||||||
#define RVA(m, b) ((ULONG)b + m)
|
#define RVA(m, b) ((ULONG)b + m)
|
||||||
|
|
||||||
|
@ -48,7 +57,12 @@ typedef struct _MODULE_INFORMATION
|
||||||
MODULE_ENTRY ModuleEntry[1];
|
MODULE_ENTRY ModuleEntry[1];
|
||||||
} MODULE_INFORMATION, *PMODULE_INFORMATION;
|
} MODULE_INFORMATION, *PMODULE_INFORMATION;
|
||||||
|
|
||||||
|
#ifdef DBG
|
||||||
|
|
||||||
|
VOID
|
||||||
|
LdrpLoadUserModuleSymbols(PLDR_MODULE LdrModule);
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
PEPFUNC LdrPEStartup(PVOID ImageBase, HANDLE SectionHandle);
|
PEPFUNC LdrPEStartup(PVOID ImageBase, HANDLE SectionHandle);
|
||||||
NTSTATUS LdrMapSections(HANDLE ProcessHandle,
|
NTSTATUS LdrMapSections(HANDLE ProcessHandle,
|
||||||
|
@ -58,9 +72,6 @@ NTSTATUS LdrMapSections(HANDLE ProcessHandle,
|
||||||
NTSTATUS LdrMapNTDllForProcess(HANDLE ProcessHandle,
|
NTSTATUS LdrMapNTDllForProcess(HANDLE ProcessHandle,
|
||||||
PHANDLE NTDllSectionHandle);
|
PHANDLE NTDllSectionHandle);
|
||||||
|
|
||||||
VOID LdrLoadModuleSymbols(PLDR_MODULE ModuleObject);
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
NTSTATUS STDCALL
|
NTSTATUS STDCALL
|
||||||
LdrDisableThreadCalloutsForDll(IN PVOID BaseAddress);
|
LdrDisableThreadCalloutsForDll(IN PVOID BaseAddress);
|
||||||
|
|
|
@ -4,12 +4,18 @@
|
||||||
|
|
||||||
#include <ddk/ntddk.h>
|
#include <ddk/ntddk.h>
|
||||||
|
|
||||||
|
#define ST_FILENAME 0x00
|
||||||
|
#define ST_FUNCTION 0x01
|
||||||
|
#define ST_LINENUMBER 0x02
|
||||||
|
|
||||||
typedef struct _SYMBOL
|
typedef struct _SYMBOL
|
||||||
{
|
{
|
||||||
struct _SYMBOL *Next;
|
struct _SYMBOL *Next;
|
||||||
/* Address relative to module base address */
|
/* Address relative to module base address */
|
||||||
ULONG RelativeAddress;
|
ULONG RelativeAddress;
|
||||||
UNICODE_STRING Name;
|
ULONG SymbolType;
|
||||||
|
ANSI_STRING Name;
|
||||||
|
ULONG LineNumber;
|
||||||
} SYMBOL, *PSYMBOL;
|
} SYMBOL, *PSYMBOL;
|
||||||
|
|
||||||
typedef struct _SYMBOL_TABLE
|
typedef struct _SYMBOL_TABLE
|
||||||
|
@ -18,5 +24,23 @@ typedef struct _SYMBOL_TABLE
|
||||||
PSYMBOL Symbols;
|
PSYMBOL Symbols;
|
||||||
} SYMBOL_TABLE, *PSYMBOL_TABLE;
|
} SYMBOL_TABLE, *PSYMBOL_TABLE;
|
||||||
|
|
||||||
|
typedef struct _IMAGE_SYMBOL_INFO
|
||||||
|
{
|
||||||
|
SYMBOL_TABLE FileNameSymbols;
|
||||||
|
SYMBOL_TABLE FunctionSymbols;
|
||||||
|
SYMBOL_TABLE LineNumberSymbols;
|
||||||
|
ULONG_PTR ImageBase;
|
||||||
|
ULONG_PTR ImageSize;
|
||||||
|
PVOID FileBuffer;
|
||||||
|
PVOID SymbolsBase;
|
||||||
|
ULONG SymbolsLength;
|
||||||
|
PVOID SymbolStringsBase;
|
||||||
|
ULONG SymbolStringsLength;
|
||||||
|
} IMAGE_SYMBOL_INFO, *PIMAGE_SYMBOL_INFO;
|
||||||
|
|
||||||
|
#define AreSymbolsParsed(si)((si)->FileNameSymbols.Symbols \
|
||||||
|
|| (si)->FunctionSymbols.Symbols \
|
||||||
|
|| (si)->LineNumberSymbols.Symbols)
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
/* $Id: startup.c,v 1.37 2002/04/26 13:08:18 ekohl Exp $
|
/* $Id: startup.c,v 1.38 2002/07/13 12:44:06 chorns Exp $
|
||||||
*
|
*
|
||||||
* COPYRIGHT: See COPYING in the top level directory
|
* COPYRIGHT: See COPYING in the top level directory
|
||||||
* PROJECT: ReactOS kernel
|
* PROJECT: ReactOS kernel
|
||||||
|
@ -183,10 +183,11 @@ LdrInitializeThunk (ULONG Unknown1,
|
||||||
InsertTailList(&Peb->Ldr->InInitializationOrderModuleList,
|
InsertTailList(&Peb->Ldr->InInitializationOrderModuleList,
|
||||||
&NtModule->InInitializationOrderModuleList);
|
&NtModule->InInitializationOrderModuleList);
|
||||||
|
|
||||||
#ifdef KDBG
|
#ifdef DBG
|
||||||
LdrLoadModuleSymbols(NtModule);
|
|
||||||
#endif /* KDBG */
|
|
||||||
|
|
||||||
|
LdrpLoadUserModuleSymbols(NtModule);
|
||||||
|
|
||||||
|
#endif /* DBG */
|
||||||
|
|
||||||
/* add entry for executable (becomes first list entry) */
|
/* add entry for executable (becomes first list entry) */
|
||||||
ExeModule = (PLDR_MODULE)RtlAllocateHeap (Peb->ProcessHeap,
|
ExeModule = (PLDR_MODULE)RtlAllocateHeap (Peb->ProcessHeap,
|
||||||
|
@ -229,9 +230,11 @@ LdrInitializeThunk (ULONG Unknown1,
|
||||||
InsertHeadList(&Peb->Ldr->InLoadOrderModuleList,
|
InsertHeadList(&Peb->Ldr->InLoadOrderModuleList,
|
||||||
&ExeModule->InLoadOrderModuleList);
|
&ExeModule->InLoadOrderModuleList);
|
||||||
|
|
||||||
#ifdef KDBG
|
#ifdef DBG
|
||||||
LdrLoadModuleSymbols(ExeModule);
|
|
||||||
#endif /* KDBG */
|
LdrpLoadUserModuleSymbols(ExeModule);
|
||||||
|
|
||||||
|
#endif /* DBG */
|
||||||
|
|
||||||
EntryPoint = LdrPEStartup((PVOID)ImageBase, NULL);
|
EntryPoint = LdrPEStartup((PVOID)ImageBase, NULL);
|
||||||
ExeModule->EntryPoint = (ULONG)EntryPoint;
|
ExeModule->EntryPoint = (ULONG)EntryPoint;
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
/* $Id: utils.c,v 1.50 2002/04/26 13:08:18 ekohl Exp $
|
/* $Id: utils.c,v 1.51 2002/07/13 12:44:06 chorns Exp $
|
||||||
*
|
*
|
||||||
* COPYRIGHT: See COPYING in the top level directory
|
* COPYRIGHT: See COPYING in the top level directory
|
||||||
* PROJECT: ReactOS kernel
|
* PROJECT: ReactOS kernel
|
||||||
|
@ -48,20 +48,21 @@ static PVOID LdrGetExportByName(PVOID BaseAddress, PUCHAR SymbolName, USHORT Hin
|
||||||
/* FUNCTIONS *****************************************************************/
|
/* FUNCTIONS *****************************************************************/
|
||||||
|
|
||||||
|
|
||||||
#ifdef KDBG
|
#ifdef DBG
|
||||||
|
|
||||||
VOID LdrLoadModuleSymbols(PLDR_MODULE ModuleObject)
|
VOID
|
||||||
|
LdrpLoadUserModuleSymbols(PLDR_MODULE LdrModule)
|
||||||
{
|
{
|
||||||
NtSystemDebugControl(
|
NtSystemDebugControl(
|
||||||
0xffffffff,
|
DebugDbgLoadSymbols,
|
||||||
(PVOID)ModuleObject,
|
(PVOID)LdrModule,
|
||||||
0,
|
0,
|
||||||
NULL,
|
NULL,
|
||||||
0,
|
0,
|
||||||
NULL);
|
NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif /* KDBG */
|
#endif /* DBG */
|
||||||
|
|
||||||
|
|
||||||
/***************************************************************************
|
/***************************************************************************
|
||||||
|
@ -364,6 +365,7 @@ LdrLoadDll (IN PWSTR SearchPath OPTIONAL,
|
||||||
Module = RtlAllocateHeap(RtlGetProcessHeap(),
|
Module = RtlAllocateHeap(RtlGetProcessHeap(),
|
||||||
0,
|
0,
|
||||||
sizeof (LDR_MODULE));
|
sizeof (LDR_MODULE));
|
||||||
|
assert(Module);
|
||||||
Module->BaseAddress = (PVOID)ImageBase;
|
Module->BaseAddress = (PVOID)ImageBase;
|
||||||
Module->EntryPoint = NTHeaders->OptionalHeader.AddressOfEntryPoint;
|
Module->EntryPoint = NTHeaders->OptionalHeader.AddressOfEntryPoint;
|
||||||
if (Module->EntryPoint != 0)
|
if (Module->EntryPoint != 0)
|
||||||
|
@ -400,9 +402,11 @@ LdrLoadDll (IN PWSTR SearchPath OPTIONAL,
|
||||||
&Module->InInitializationOrderModuleList);
|
&Module->InInitializationOrderModuleList);
|
||||||
/* FIXME: release loader lock */
|
/* FIXME: release loader lock */
|
||||||
|
|
||||||
#ifdef KDBG
|
#ifdef DBG
|
||||||
LdrLoadModuleSymbols(Module);
|
|
||||||
#endif /* KDBG */
|
LdrpLoadUserModuleSymbols(Module);
|
||||||
|
|
||||||
|
#endif /* DBG */
|
||||||
|
|
||||||
/* initialize dll */
|
/* initialize dll */
|
||||||
if ((NTHeaders->FileHeader.Characteristics & IMAGE_FILE_DLL) ==
|
if ((NTHeaders->FileHeader.Characteristics & IMAGE_FILE_DLL) ==
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
/* $Id: ctype.c,v 1.7 2000/01/10 20:30:15 ekohl Exp $
|
/* $Id: ctype.c,v 1.8 2002/07/13 12:44:06 chorns Exp $
|
||||||
*
|
*
|
||||||
* COPYRIGHT: See COPYING in the top level directory
|
* COPYRIGHT: See COPYING in the top level directory
|
||||||
* PROJECT: ReactOS kernel
|
* PROJECT: ReactOS kernel
|
||||||
|
@ -13,6 +13,7 @@
|
||||||
|
|
||||||
#include <ctype.h>
|
#include <ctype.h>
|
||||||
|
|
||||||
|
#undef _pctype
|
||||||
|
|
||||||
#define upalpha ('A' - 'a')
|
#define upalpha ('A' - 'a')
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
# $Id: Makefile,v 1.72 2002/07/04 19:56:35 dwelch Exp $
|
# $Id: Makefile,v 1.73 2002/07/13 12:44:07 chorns Exp $
|
||||||
#
|
#
|
||||||
# ReactOS Operating System
|
# ReactOS Operating System
|
||||||
#
|
#
|
||||||
|
@ -617,7 +617,7 @@ $(TARGETNAME).dbg: $(TARGETNAME).dbg.o $(TARGETNAME).a $(TARGETNAME).dbg.lnk
|
||||||
- $(RM) temp.exp
|
- $(RM) temp.exp
|
||||||
|
|
||||||
$(TARGETNAME).sym: $(TARGETNAME).nostrip.exe
|
$(TARGETNAME).sym: $(TARGETNAME).nostrip.exe
|
||||||
$(NM) --numeric-sort $(TARGETNAME).nostrip.exe > $(TARGETNAME).sym
|
$(RSYM) $(TARGETNAME).nostrip.exe $(TARGETNAME).sym
|
||||||
|
|
||||||
$(TARGETNAME).o: $(OBJECTS)
|
$(TARGETNAME).o: $(OBJECTS)
|
||||||
$(LD) \
|
$(LD) \
|
||||||
|
|
|
@ -50,10 +50,12 @@ NtSystemDebugControl(DEBUG_CONTROL_CODE ControlCode,
|
||||||
case DebugQuerySpecialCalls:
|
case DebugQuerySpecialCalls:
|
||||||
case DebugDbgBreakPoint:
|
case DebugDbgBreakPoint:
|
||||||
break;
|
break;
|
||||||
|
#ifdef DBG
|
||||||
|
case DebugDbgLoadSymbols:
|
||||||
|
LdrLoadUserModuleSymbols((PLDR_MODULE) InputBuffer);
|
||||||
|
#endif /* DBG */
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
#ifdef KDBG
|
|
||||||
LdrLoadUserModuleSymbols((PLDR_MODULE)InputBuffer);
|
|
||||||
#endif /* KDBG */
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
return STATUS_SUCCESS;
|
return STATUS_SUCCESS;
|
||||||
|
|
|
@ -112,13 +112,22 @@ LdrUnloadModule(PMODULE_OBJECT ModuleObject);
|
||||||
PMODULE_OBJECT
|
PMODULE_OBJECT
|
||||||
LdrGetModuleObject(PUNICODE_STRING ModuleName);
|
LdrGetModuleObject(PUNICODE_STRING ModuleName);
|
||||||
|
|
||||||
|
NTSTATUS
|
||||||
|
LdrGetAddressInformation(IN PIMAGE_SYMBOL_INFO SymbolInfo,
|
||||||
|
IN ULONG_PTR RelativeAddress,
|
||||||
|
OUT PULONG LineNumber,
|
||||||
|
OUT PCH FileName OPTIONAL,
|
||||||
|
OUT PCH FunctionName OPTIONAL);
|
||||||
|
|
||||||
#ifdef KDBG
|
|
||||||
VOID
|
#ifdef DBG
|
||||||
LdrpLoadModuleSymbols(PMODULE_OBJECT ModuleObject);
|
|
||||||
|
|
||||||
VOID
|
VOID
|
||||||
LdrLoadUserModuleSymbols(PLDR_MODULE ModuleObject);
|
LdrLoadUserModuleSymbols(PLDR_MODULE LdrModule);
|
||||||
#endif /* KDBG */
|
|
||||||
|
VOID
|
||||||
|
LdrUnloadModuleSymbols(PIMAGE_SYMBOL_INFO SymbolInfo);
|
||||||
|
|
||||||
|
#endif /* DBG */
|
||||||
|
|
||||||
#endif /* __INCLUDE_INTERNAL_LDR_H */
|
#endif /* __INCLUDE_INTERNAL_LDR_H */
|
||||||
|
|
|
@ -13,11 +13,9 @@ typedef struct _MODULE_TEXT_SECTION
|
||||||
ULONG Length;
|
ULONG Length;
|
||||||
LIST_ENTRY ListEntry;
|
LIST_ENTRY ListEntry;
|
||||||
PWCH Name;
|
PWCH Name;
|
||||||
#ifdef KDBG
|
#ifdef DBG
|
||||||
SYMBOL_TABLE Symbols;
|
IMAGE_SYMBOL_INFO SymbolInfo;
|
||||||
#endif /* KDBG */
|
#endif /* DBG */
|
||||||
PVOID SymbolsBase;
|
|
||||||
ULONG SymbolsLength;
|
|
||||||
} MODULE_TEXT_SECTION, *PMODULE_TEXT_SECTION;
|
} MODULE_TEXT_SECTION, *PMODULE_TEXT_SECTION;
|
||||||
|
|
||||||
typedef struct _MODULE_OBJECT
|
typedef struct _MODULE_OBJECT
|
||||||
|
|
|
@ -45,6 +45,17 @@
|
||||||
|
|
||||||
/* GLOBALS *****************************************************************/
|
/* GLOBALS *****************************************************************/
|
||||||
|
|
||||||
|
#ifdef DBG
|
||||||
|
|
||||||
|
NTSTATUS
|
||||||
|
LdrGetAddressInformation(IN PIMAGE_SYMBOL_INFO SymbolInfo,
|
||||||
|
IN ULONG_PTR RelativeAddress,
|
||||||
|
OUT PULONG LineNumber,
|
||||||
|
OUT PCH FileName OPTIONAL,
|
||||||
|
OUT PCH FunctionName OPTIONAL);
|
||||||
|
|
||||||
|
#endif /* DBG */
|
||||||
|
|
||||||
#define _STR(x) #x
|
#define _STR(x) #x
|
||||||
#define STR(x) _STR(x)
|
#define STR(x) _STR(x)
|
||||||
|
|
||||||
|
@ -124,16 +135,17 @@ extern unsigned int _text_start__, _text_end__;
|
||||||
STATIC BOOLEAN
|
STATIC BOOLEAN
|
||||||
print_address(PVOID address)
|
print_address(PVOID address)
|
||||||
{
|
{
|
||||||
#ifdef KDBG
|
|
||||||
ULONG Offset;
|
|
||||||
PSYMBOL Symbol, NextSymbol;
|
|
||||||
BOOLEAN Printed = FALSE;
|
|
||||||
ULONG NextAddress;
|
|
||||||
#endif /* KDBG */
|
|
||||||
PLIST_ENTRY current_entry;
|
PLIST_ENTRY current_entry;
|
||||||
MODULE_TEXT_SECTION* current;
|
MODULE_TEXT_SECTION* current;
|
||||||
extern LIST_ENTRY ModuleTextListHead;
|
extern LIST_ENTRY ModuleTextListHead;
|
||||||
|
ULONG_PTR RelativeAddress;
|
||||||
|
#ifdef DBG
|
||||||
|
NTSTATUS Status;
|
||||||
|
ULONG LineNumber;
|
||||||
|
CHAR FileName[256];
|
||||||
|
CHAR FunctionName[256];
|
||||||
|
#endif
|
||||||
|
|
||||||
current_entry = ModuleTextListHead.Flink;
|
current_entry = ModuleTextListHead.Flink;
|
||||||
|
|
||||||
while (current_entry != &ModuleTextListHead &&
|
while (current_entry != &ModuleTextListHead &&
|
||||||
|
@ -141,46 +153,31 @@ print_address(PVOID address)
|
||||||
{
|
{
|
||||||
current =
|
current =
|
||||||
CONTAINING_RECORD(current_entry, MODULE_TEXT_SECTION, ListEntry);
|
CONTAINING_RECORD(current_entry, MODULE_TEXT_SECTION, ListEntry);
|
||||||
|
|
||||||
if (address >= (PVOID)current->Base &&
|
if (address >= (PVOID)current->Base &&
|
||||||
address < (PVOID)(current->Base + current->Length))
|
address < (PVOID)(current->Base + current->Length))
|
||||||
{
|
{
|
||||||
|
RelativeAddress = (ULONG_PTR) address - current->Base;
|
||||||
#ifdef KDBG
|
#ifdef DBG
|
||||||
|
Status = LdrGetAddressInformation(¤t->SymbolInfo,
|
||||||
Offset = (ULONG)((ULONG)address - current->Base);
|
RelativeAddress,
|
||||||
Symbol = current->Symbols.Symbols;
|
&LineNumber,
|
||||||
while (Symbol != NULL)
|
FileName,
|
||||||
{
|
FunctionName);
|
||||||
NextSymbol = Symbol->Next;
|
if (NT_SUCCESS(Status))
|
||||||
if (NextSymbol != NULL)
|
{
|
||||||
NextAddress = NextSymbol->RelativeAddress;
|
DbgPrint("<%ws: %x (%s:%d (%s))>",
|
||||||
else
|
current->Name, RelativeAddress, FileName, LineNumber, FunctionName);
|
||||||
NextAddress = current->Length;
|
}
|
||||||
|
else
|
||||||
if ((Offset >= Symbol->RelativeAddress) &&
|
{
|
||||||
(Offset < NextAddress))
|
DbgPrint("<%ws: %x>", current->Name, RelativeAddress);
|
||||||
{
|
}
|
||||||
DbgPrint("<%ws: %x (%wZ)>", current->Name, Offset,
|
#else /* !DBG */
|
||||||
&Symbol->Name);
|
DbgPrint("<%ws: %x>", current->Name, RelativeAddress);
|
||||||
Printed = TRUE;
|
#endif /* !DBG */
|
||||||
break;
|
|
||||||
}
|
|
||||||
Symbol = NextSymbol;
|
|
||||||
}
|
|
||||||
if (!Printed)
|
|
||||||
DbgPrint("<%ws: %x>", current->Name, Offset);
|
|
||||||
|
|
||||||
#else /* KDBG */
|
|
||||||
|
|
||||||
DbgPrint("<%ws: %x>", current->Name,
|
|
||||||
address - current->Base);
|
|
||||||
|
|
||||||
#endif /* KDBG */
|
|
||||||
|
|
||||||
return(TRUE);
|
return(TRUE);
|
||||||
}
|
}
|
||||||
|
|
||||||
current_entry = current_entry->Flink;
|
current_entry = current_entry->Flink;
|
||||||
}
|
}
|
||||||
return(FALSE);
|
return(FALSE);
|
||||||
|
@ -338,6 +335,7 @@ KiDoubleFaultHandler(VOID)
|
||||||
{
|
{
|
||||||
print_address((PVOID)Frame[1]);
|
print_address((PVOID)Frame[1]);
|
||||||
Frame = (PULONG)Frame[0];
|
Frame = (PULONG)Frame[0];
|
||||||
|
DbgPrint("\n");
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
DbgPrint("Frames: ");
|
DbgPrint("Frames: ");
|
||||||
|
@ -504,9 +502,6 @@ KiDumpTrapFrame(PKTRAP_FRAME Tf, ULONG ExceptionNr, ULONG cr2)
|
||||||
print_address((PVOID)Frame[1]);
|
print_address((PVOID)Frame[1]);
|
||||||
Frame = (PULONG)Frame[0];
|
Frame = (PULONG)Frame[0];
|
||||||
i++;
|
i++;
|
||||||
}
|
|
||||||
if ((i % 8) != 0)
|
|
||||||
{
|
|
||||||
DbgPrint("\n");
|
DbgPrint("\n");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -592,9 +587,6 @@ KeDumpStackFrames(PULONG Frame)
|
||||||
print_address((PVOID)Frame[1]);
|
print_address((PVOID)Frame[1]);
|
||||||
Frame = (PULONG)Frame[0];
|
Frame = (PULONG)Frame[0];
|
||||||
i++;
|
i++;
|
||||||
}
|
|
||||||
if ((i % 8) != 0)
|
|
||||||
{
|
|
||||||
DbgPrint("\n");
|
DbgPrint("\n");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -114,6 +114,31 @@ _multiboot_entry:
|
||||||
movl $(V2P(kernel_pagetable+5*4096) + 0x7), 0xC14(%esi)
|
movl $(V2P(kernel_pagetable+5*4096) + 0x7), 0xC14(%esi)
|
||||||
movl $(V2P(kernel_pagetable+6*4096) + 0x7), 0xC18(%esi)
|
movl $(V2P(kernel_pagetable+6*4096) + 0x7), 0xC18(%esi)
|
||||||
movl $(V2P(kernel_pagetable+7*4096) + 0x7), 0xC1c(%esi)
|
movl $(V2P(kernel_pagetable+7*4096) + 0x7), 0xC1c(%esi)
|
||||||
|
movl $(V2P(kernel_pagetable+8*4096) + 0x7), 0xC20(%esi)
|
||||||
|
movl $(V2P(kernel_pagetable+9*4096) + 0x7), 0xC24(%esi)
|
||||||
|
movl $(V2P(kernel_pagetable+10*4096) + 0x7), 0xC28(%esi)
|
||||||
|
movl $(V2P(kernel_pagetable+11*4096) + 0x7), 0xC2c(%esi)
|
||||||
|
movl $(V2P(kernel_pagetable+12*4096) + 0x7), 0xC30(%esi)
|
||||||
|
movl $(V2P(kernel_pagetable+13*4096) + 0x7), 0xC34(%esi)
|
||||||
|
movl $(V2P(kernel_pagetable+14*4096) + 0x7), 0xC38(%esi)
|
||||||
|
movl $(V2P(kernel_pagetable+15*4096) + 0x7), 0xC3c(%esi)
|
||||||
|
movl $(V2P(kernel_pagetable+16*4096) + 0x7), 0xC40(%esi)
|
||||||
|
movl $(V2P(kernel_pagetable+17*4096) + 0x7), 0xC44(%esi)
|
||||||
|
movl $(V2P(kernel_pagetable+18*4096) + 0x7), 0xC48(%esi)
|
||||||
|
movl $(V2P(kernel_pagetable+19*4096) + 0x7), 0xC4c(%esi)
|
||||||
|
movl $(V2P(kernel_pagetable+20*4096) + 0x7), 0xC50(%esi)
|
||||||
|
movl $(V2P(kernel_pagetable+21*4096) + 0x7), 0xC54(%esi)
|
||||||
|
movl $(V2P(kernel_pagetable+22*4096) + 0x7), 0xC58(%esi)
|
||||||
|
movl $(V2P(kernel_pagetable+23*4096) + 0x7), 0xC5c(%esi)
|
||||||
|
movl $(V2P(kernel_pagetable+24*4096) + 0x7), 0xC60(%esi)
|
||||||
|
movl $(V2P(kernel_pagetable+25*4096) + 0x7), 0xC64(%esi)
|
||||||
|
movl $(V2P(kernel_pagetable+26*4096) + 0x7), 0xC68(%esi)
|
||||||
|
movl $(V2P(kernel_pagetable+27*4096) + 0x7), 0xC6c(%esi)
|
||||||
|
movl $(V2P(kernel_pagetable+28*4096) + 0x7), 0xC70(%esi)
|
||||||
|
movl $(V2P(kernel_pagetable+29*4096) + 0x7), 0xC74(%esi)
|
||||||
|
movl $(V2P(kernel_pagetable+30*4096) + 0x7), 0xC78(%esi)
|
||||||
|
movl $(V2P(kernel_pagetable+31*4096) + 0x7), 0xC7c(%esi)
|
||||||
|
|
||||||
movl $(V2P(lowmem_pagetable) + 0x7), 0xD00(%esi)
|
movl $(V2P(lowmem_pagetable) + 0x7), 0xD00(%esi)
|
||||||
movl $(V2P(startup_pagedirectory) + 0x7), 0xF00(%esi)
|
movl $(V2P(startup_pagedirectory) + 0x7), 0xF00(%esi)
|
||||||
#ifdef MP
|
#ifdef MP
|
||||||
|
@ -144,7 +169,7 @@ _multiboot_entry:
|
||||||
movl %eax, (%esi, %edi)
|
movl %eax, (%esi, %edi)
|
||||||
addl $0x1000, %eax
|
addl $0x1000, %eax
|
||||||
addl $4, %edi
|
addl $4, %edi
|
||||||
cmpl $2048, %edi
|
cmpl $8192, %edi
|
||||||
jl .l4
|
jl .l4
|
||||||
|
|
||||||
#ifdef MP
|
#ifdef MP
|
||||||
|
@ -315,7 +340,7 @@ lowmem_pagetable:
|
||||||
.fill 4096, 1, 0
|
.fill 4096, 1, 0
|
||||||
|
|
||||||
kernel_pagetable:
|
kernel_pagetable:
|
||||||
.fill 8*4096, 1, 0
|
.fill 32*4096, 1, 0
|
||||||
|
|
||||||
#ifdef MP
|
#ifdef MP
|
||||||
apic_pagetable:
|
apic_pagetable:
|
||||||
|
|
|
@ -45,6 +45,17 @@
|
||||||
|
|
||||||
/* GLOBALS *****************************************************************/
|
/* GLOBALS *****************************************************************/
|
||||||
|
|
||||||
|
#ifdef DBG
|
||||||
|
|
||||||
|
NTSTATUS
|
||||||
|
LdrGetAddressInformation(IN PIMAGE_SYMBOL_INFO SymbolInfo,
|
||||||
|
IN ULONG_PTR RelativeAddress,
|
||||||
|
OUT PULONG LineNumber,
|
||||||
|
OUT PCH FileName OPTIONAL,
|
||||||
|
OUT PCH FunctionName OPTIONAL);
|
||||||
|
|
||||||
|
#endif /* DBG */
|
||||||
|
|
||||||
static char *ExceptionTypeStrings[] =
|
static char *ExceptionTypeStrings[] =
|
||||||
{
|
{
|
||||||
"Divide Error",
|
"Divide Error",
|
||||||
|
@ -72,16 +83,17 @@ static char *ExceptionTypeStrings[] =
|
||||||
STATIC BOOLEAN
|
STATIC BOOLEAN
|
||||||
print_user_address(PVOID address)
|
print_user_address(PVOID address)
|
||||||
{
|
{
|
||||||
#ifdef KDBG
|
|
||||||
ULONG Offset;
|
|
||||||
PSYMBOL Symbol, NextSymbol;
|
|
||||||
BOOLEAN Printed = FALSE;
|
|
||||||
ULONG NextAddress;
|
|
||||||
#endif /* KDBG */
|
|
||||||
PLIST_ENTRY current_entry;
|
PLIST_ENTRY current_entry;
|
||||||
PLDR_MODULE current;
|
PLDR_MODULE current;
|
||||||
PEPROCESS CurrentProcess;
|
PEPROCESS CurrentProcess;
|
||||||
PPEB Peb = NULL;
|
PPEB Peb = NULL;
|
||||||
|
ULONG_PTR RelativeAddress;
|
||||||
|
#ifdef DBG
|
||||||
|
NTSTATUS Status;
|
||||||
|
ULONG LineNumber;
|
||||||
|
CHAR FileName[256];
|
||||||
|
CHAR FunctionName[256];
|
||||||
|
#endif
|
||||||
|
|
||||||
CurrentProcess = PsGetCurrentProcess();
|
CurrentProcess = PsGetCurrentProcess();
|
||||||
if (NULL != CurrentProcess)
|
if (NULL != CurrentProcess)
|
||||||
|
@ -106,37 +118,25 @@ print_user_address(PVOID address)
|
||||||
if (address >= (PVOID)current->BaseAddress &&
|
if (address >= (PVOID)current->BaseAddress &&
|
||||||
address < (PVOID)(current->BaseAddress + current->SizeOfImage))
|
address < (PVOID)(current->BaseAddress + current->SizeOfImage))
|
||||||
{
|
{
|
||||||
#ifdef KDBG
|
RelativeAddress = (ULONG_PTR) address - (ULONG_PTR)current->BaseAddress;
|
||||||
|
#ifdef DBG
|
||||||
Offset = (ULONG)(address - current->BaseAddress);
|
Status = LdrGetAddressInformation(¤t->SymbolInfo,
|
||||||
Symbol = current->Symbols.Symbols;
|
RelativeAddress,
|
||||||
while (Symbol != NULL)
|
&LineNumber,
|
||||||
{
|
FileName,
|
||||||
NextSymbol = Symbol->Next;
|
FunctionName);
|
||||||
if (NextSymbol != NULL)
|
if (NT_SUCCESS(Status))
|
||||||
NextAddress = NextSymbol->RelativeAddress;
|
{
|
||||||
else
|
DbgPrint("<%wZ: %x (%s:%d (%s))>",
|
||||||
NextAddress = current->SizeOfImage;
|
¤t->BaseDllName, RelativeAddress, FileName, LineNumber, FunctionName);
|
||||||
|
}
|
||||||
if ((Offset >= Symbol->RelativeAddress) &&
|
else
|
||||||
(Offset < NextAddress))
|
{
|
||||||
{
|
DbgPrint("<%wZ: %x>", ¤t->BaseDllName, RelativeAddress);
|
||||||
DbgPrint("<%wZ: %x (%wZ)>",
|
}
|
||||||
¤t->BaseDllName, Offset, &Symbol->Name);
|
#else /* !DBG */
|
||||||
Printed = TRUE;
|
DbgPrint("<%wZ: %x>", ¤t->BaseDllName, RelativeAddress);
|
||||||
break;
|
#endif /* !DBG */
|
||||||
}
|
|
||||||
Symbol = NextSymbol;
|
|
||||||
}
|
|
||||||
if (!Printed)
|
|
||||||
DbgPrint("<%wZ: %x>", ¤t->BaseDllName, Offset);
|
|
||||||
|
|
||||||
#else /* KDBG */
|
|
||||||
|
|
||||||
DbgPrint("<%wZ: %x>", ¤t->BaseDllName,
|
|
||||||
address - current->BaseAddress);
|
|
||||||
|
|
||||||
#endif /* KDBG */
|
|
||||||
|
|
||||||
return(TRUE);
|
return(TRUE);
|
||||||
}
|
}
|
||||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -96,7 +96,7 @@ NTSTATUS LdrpMapSystemDll(HANDLE ProcessHandle,
|
||||||
FILE_ALL_ACCESS,
|
FILE_ALL_ACCESS,
|
||||||
&FileObjectAttributes,
|
&FileObjectAttributes,
|
||||||
NULL,
|
NULL,
|
||||||
0,
|
FILE_SHARE_READ,
|
||||||
0);
|
0);
|
||||||
if (!NT_SUCCESS(Status))
|
if (!NT_SUCCESS(Status))
|
||||||
{
|
{
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
/* $Id: process.c,v 1.84 2002/07/04 19:56:36 dwelch Exp $
|
/* $Id: process.c,v 1.85 2002/07/13 12:44:08 chorns Exp $
|
||||||
*
|
*
|
||||||
* COPYRIGHT: See COPYING in the top level directory
|
* COPYRIGHT: See COPYING in the top level directory
|
||||||
* PROJECT: ReactOS kernel
|
* PROJECT: ReactOS kernel
|
||||||
|
@ -278,15 +278,14 @@ PsInitProcessManagment(VOID)
|
||||||
&SystemProcessHandle);
|
&SystemProcessHandle);
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef KDBG
|
#ifdef DBG
|
||||||
|
|
||||||
VOID
|
VOID
|
||||||
PiFreeSymbols(PPEB Peb)
|
PiFreeSymbols(PPEB Peb)
|
||||||
{
|
{
|
||||||
PLIST_ENTRY CurrentEntry;
|
PLIST_ENTRY CurrentEntry;
|
||||||
PLDR_MODULE Current;
|
PLDR_MODULE Current;
|
||||||
PSYMBOL NextSymbol;
|
PIMAGE_SYMBOL_INFO SymbolInfo;
|
||||||
PSYMBOL Symbol;
|
|
||||||
|
|
||||||
assert (Peb);
|
assert (Peb);
|
||||||
assert (Peb->Ldr);
|
assert (Peb->Ldr);
|
||||||
|
@ -297,21 +296,15 @@ PiFreeSymbols(PPEB Peb)
|
||||||
{
|
{
|
||||||
Current = CONTAINING_RECORD(CurrentEntry, LDR_MODULE,
|
Current = CONTAINING_RECORD(CurrentEntry, LDR_MODULE,
|
||||||
InLoadOrderModuleList);
|
InLoadOrderModuleList);
|
||||||
Symbol = Current->Symbols.Symbols;
|
|
||||||
while (Symbol != NULL)
|
SymbolInfo = &Current->SymbolInfo;
|
||||||
{
|
LdrUnloadModuleSymbols(SymbolInfo);
|
||||||
NextSymbol = Symbol->Next;
|
|
||||||
RtlFreeUnicodeString (&Symbol->Name);
|
|
||||||
ExFreePool (Symbol);
|
|
||||||
Symbol = NextSymbol;
|
|
||||||
}
|
|
||||||
Current->Symbols.SymbolCount = 0;
|
|
||||||
Current->Symbols.Symbols = NULL;
|
|
||||||
CurrentEntry = CurrentEntry->Flink;
|
CurrentEntry = CurrentEntry->Flink;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif /* KDBG */
|
#endif /* DBG */
|
||||||
|
|
||||||
VOID STDCALL
|
VOID STDCALL
|
||||||
PiDeleteProcess(PVOID ObjectBody)
|
PiDeleteProcess(PVOID ObjectBody)
|
||||||
|
@ -333,9 +326,9 @@ PiDeleteProcess(PVOID ObjectBody)
|
||||||
RemoveEntryList(&Process->ProcessListEntry);
|
RemoveEntryList(&Process->ProcessListEntry);
|
||||||
KeReleaseSpinLock(&PsProcessListLock, oldIrql);
|
KeReleaseSpinLock(&PsProcessListLock, oldIrql);
|
||||||
|
|
||||||
#ifdef KDBG
|
#ifdef DBG
|
||||||
PiFreeSymbols(Process->Peb);
|
PiFreeSymbols(Process->Peb);
|
||||||
#endif /* KDBG */
|
#endif /* DBG */
|
||||||
|
|
||||||
|
|
||||||
ObDereferenceObject(Process->Token);
|
ObDereferenceObject(Process->Token);
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
/* $Id: ctype.c,v 1.7 2002/06/16 17:25:58 chorns Exp $
|
/* $Id: ctype.c,v 1.8 2002/07/13 12:44:08 chorns Exp $
|
||||||
*
|
*
|
||||||
* COPYRIGHT: See COPYING in the top level directory
|
* COPYRIGHT: See COPYING in the top level directory
|
||||||
* PROJECT: ReactOS kernel
|
* PROJECT: ReactOS kernel
|
||||||
|
@ -13,6 +13,7 @@
|
||||||
|
|
||||||
#include <ctype.h>
|
#include <ctype.h>
|
||||||
|
|
||||||
|
#undef _pctype
|
||||||
|
|
||||||
#define upalpha ('A' - 'a')
|
#define upalpha ('A' - 'a')
|
||||||
|
|
||||||
|
|
|
@ -239,8 +239,12 @@ char *strncpy(char *dst, const char *src, size_t n)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
while (--n != 0);
|
while (--n != 0);
|
||||||
|
d[0] = 0;
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
dst[0] = 0;
|
||||||
|
}
|
||||||
return dst;
|
return dst;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -76,6 +76,7 @@ CP = $(TOOLS_PATH)/rcopy
|
||||||
RM = $(TOOLS_PATH)/rdel
|
RM = $(TOOLS_PATH)/rdel
|
||||||
RMDIR = $(TOOLS_PATH)/rrmdir
|
RMDIR = $(TOOLS_PATH)/rrmdir
|
||||||
RMKDIR = $(TOOLS_PATH)/rmkdir
|
RMKDIR = $(TOOLS_PATH)/rmkdir
|
||||||
|
RSYM = $(TOOLS_PATH)/rsym
|
||||||
MC = $(TOOLS_PATH)/wmc/wmc
|
MC = $(TOOLS_PATH)/wmc/wmc
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -6,7 +6,8 @@ TOOLS = \
|
||||||
rcopy$(EXE_POSTFIX) \
|
rcopy$(EXE_POSTFIX) \
|
||||||
rdel$(EXE_POSTFIX) \
|
rdel$(EXE_POSTFIX) \
|
||||||
rmkdir$(EXE_POSTFIX) \
|
rmkdir$(EXE_POSTFIX) \
|
||||||
rrmdir$(EXE_POSTFIX)
|
rrmdir$(EXE_POSTFIX) \
|
||||||
|
rsym$(EXE_POSTFIX)
|
||||||
|
|
||||||
CLEAN_FILES = $(TOOLS)
|
CLEAN_FILES = $(TOOLS)
|
||||||
|
|
||||||
|
@ -50,6 +51,15 @@ rrmdir$(EXE_POSTFIX): rrmdir.c
|
||||||
$(HOST_CC) $(CFLAGS) -DDOS_PATHS rrmdir.c -o rrmdir$(EXE_POSTFIX)
|
$(HOST_CC) $(CFLAGS) -DDOS_PATHS rrmdir.c -o rrmdir$(EXE_POSTFIX)
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
ifeq ($(HOST),mingw32-linux)
|
||||||
|
rsym$(EXE_POSTFIX): rsym.c
|
||||||
|
$(HOST_CC) $(CFLAGS) -DUNIX_PATHS rsym.c -o rsym$(EXE_POSTFIX)
|
||||||
|
endif
|
||||||
|
ifeq ($(HOST),mingw32-windows)
|
||||||
|
rsym$(EX_POSTFIX): rsym.c
|
||||||
|
$(HOST_CC) $(CFLAGS) -DDOS_PATHS rsym.c -o rsym$(EXE_POSTFIX)
|
||||||
|
endif
|
||||||
|
|
||||||
wmc_directory_target:
|
wmc_directory_target:
|
||||||
make -C wmc wmc$(EXE_POSTFIX)
|
make -C wmc wmc$(EXE_POSTFIX)
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
# $Id: helper.mk,v 1.18 2002/06/30 02:40:24 ei Exp $
|
# $Id: helper.mk,v 1.19 2002/07/13 12:44:09 chorns Exp $
|
||||||
#
|
#
|
||||||
# Helper makefile for ReactOS modules
|
# Helper makefile for ReactOS modules
|
||||||
# Variables this makefile accepts:
|
# Variables this makefile accepts:
|
||||||
|
@ -42,6 +42,9 @@
|
||||||
# $WINE_MODE = Compile using WINE headers (no,yes) (optional)
|
# $WINE_MODE = Compile using WINE headers (no,yes) (optional)
|
||||||
# $WINE_RC = Name of .rc file for WINE modules (optional)
|
# $WINE_RC = Name of .rc file for WINE modules (optional)
|
||||||
|
|
||||||
|
include $(PATH_TO_TOP)/config
|
||||||
|
|
||||||
|
|
||||||
ifeq ($(TARGET_PATH),)
|
ifeq ($(TARGET_PATH),)
|
||||||
TARGET_PATH := .
|
TARGET_PATH := .
|
||||||
endif
|
endif
|
||||||
|
@ -378,7 +381,8 @@ include $(PATH_TO_TOP)/config
|
||||||
TARGET_CFLAGS += $(MK_CFLAGS)
|
TARGET_CFLAGS += $(MK_CFLAGS)
|
||||||
TARGET_CFLAGS += -pipe -march=$(ARCH)
|
TARGET_CFLAGS += -pipe -march=$(ARCH)
|
||||||
ifeq ($(DBG),1)
|
ifeq ($(DBG),1)
|
||||||
#TARGET_CFLAGS += -g
|
TARGET_CFLAGS += -g
|
||||||
|
TARGET_LFLAGS += -g
|
||||||
endif
|
endif
|
||||||
|
|
||||||
TARGET_CPPFLAGS += $(MK_CPPFLAGS)
|
TARGET_CPPFLAGS += $(MK_CPPFLAGS)
|
||||||
|
@ -456,7 +460,7 @@ endif
|
||||||
-o $(MK_NOSTRIPNAME) \
|
-o $(MK_NOSTRIPNAME) \
|
||||||
$(MK_FULLRES) $(MK_OBJECTS) $(MK_LIBS) $(MK_GCCLIBS)
|
$(MK_FULLRES) $(MK_OBJECTS) $(MK_LIBS) $(MK_GCCLIBS)
|
||||||
- $(RM) temp.exp
|
- $(RM) temp.exp
|
||||||
- $(NM) --numeric-sort $(MK_NOSTRIPNAME) > $(MK_BASENAME).sym
|
- $(RSYM) $(MK_NOSTRIPNAME) $(MK_BASENAME).sym
|
||||||
|
|
||||||
$(MK_FULLNAME): $(MK_NOSTRIPNAME)
|
$(MK_FULLNAME): $(MK_NOSTRIPNAME)
|
||||||
$(CP) $(MK_NOSTRIPNAME) $(MK_FULLNAME)
|
$(CP) $(MK_NOSTRIPNAME) $(MK_FULLNAME)
|
||||||
|
@ -496,7 +500,7 @@ $(MK_NOSTRIPNAME): $(MK_FULLRES) $(TARGET_OBJECTS) $(MK_LIBS)
|
||||||
-o $(MK_NOSTRIPNAME) \
|
-o $(MK_NOSTRIPNAME) \
|
||||||
$(MK_FULLRES) $(MK_OBJECTS) $(MK_LIBS) $(MK_GCCLIBS)
|
$(MK_FULLRES) $(MK_OBJECTS) $(MK_LIBS) $(MK_GCCLIBS)
|
||||||
- $(RM) temp.exp
|
- $(RM) temp.exp
|
||||||
$(NM) --numeric-sort $(MK_NOSTRIPNAME) > $(MK_BASENAME).sym
|
$(RSYM) $(MK_NOSTRIPNAME) $(MK_BASENAME).sym
|
||||||
|
|
||||||
$(MK_FULLNAME): $(MK_FULLRES) $(TARGET_OBJECTS) $(MK_LIBS) $(MK_NOSTRIPNAME)
|
$(MK_FULLNAME): $(MK_FULLRES) $(TARGET_OBJECTS) $(MK_LIBS) $(MK_NOSTRIPNAME)
|
||||||
$(LD) -r -o $(MK_STRIPPED_OBJECT) $(MK_OBJECTS)
|
$(LD) -r -o $(MK_STRIPPED_OBJECT) $(MK_OBJECTS)
|
||||||
|
@ -583,6 +587,7 @@ $(INSTALL_DIR)/$(MK_INSTALLDIR)/$(MK_FULLNAME): $(MK_FULLNAME) $(MK_BASENAME).sy
|
||||||
$(CP) $(MK_FULLNAME) $(INSTALL_DIR)/$(MK_INSTALLDIR)/$(MK_FULLNAME)
|
$(CP) $(MK_FULLNAME) $(INSTALL_DIR)/$(MK_INSTALLDIR)/$(MK_FULLNAME)
|
||||||
$(CP) $(MK_BASENAME).sym $(INSTALL_DIR)/symbols/$(MK_BASENAME).sym
|
$(CP) $(MK_BASENAME).sym $(INSTALL_DIR)/symbols/$(MK_BASENAME).sym
|
||||||
|
|
||||||
|
|
||||||
dist: $(DIST_DIR)/$(MK_DISTDIR)/$(MK_FULLNAME)
|
dist: $(DIST_DIR)/$(MK_DISTDIR)/$(MK_FULLNAME)
|
||||||
|
|
||||||
$(DIST_DIR)/$(MK_DISTDIR)/$(MK_FULLNAME): $(MK_FULLNAME)
|
$(DIST_DIR)/$(MK_DISTDIR)/$(MK_FULLNAME): $(MK_FULLNAME)
|
||||||
|
|
255
reactos/tools/rsym.c
Normal file
255
reactos/tools/rsym.c
Normal file
|
@ -0,0 +1,255 @@
|
||||||
|
/*
|
||||||
|
* Usage: rsym input-file output-file
|
||||||
|
*/
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <string.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
|
||||||
|
#define NULL ((void*)0)
|
||||||
|
|
||||||
|
#define IMAGE_DOS_MAGIC 0x5a4d
|
||||||
|
#define IMAGE_PE_MAGIC 0x00004550
|
||||||
|
|
||||||
|
#define IMAGE_SIZEOF_SHORT_NAME 8
|
||||||
|
|
||||||
|
#define IMAGE_NUMBEROF_DIRECTORY_ENTRIES 16
|
||||||
|
|
||||||
|
typedef void* PVOID;
|
||||||
|
typedef unsigned char BYTE;
|
||||||
|
typedef unsigned short WORD;
|
||||||
|
typedef unsigned long DWORD;
|
||||||
|
typedef signed long LONG;
|
||||||
|
typedef unsigned long ULONG;
|
||||||
|
|
||||||
|
#pragma pack(push,2)
|
||||||
|
typedef struct _IMAGE_DOS_HEADER {
|
||||||
|
WORD e_magic;
|
||||||
|
WORD e_cblp;
|
||||||
|
WORD e_cp;
|
||||||
|
WORD e_crlc;
|
||||||
|
WORD e_cparhdr;
|
||||||
|
WORD e_minalloc;
|
||||||
|
WORD e_maxalloc;
|
||||||
|
WORD e_ss;
|
||||||
|
WORD e_sp;
|
||||||
|
WORD e_csum;
|
||||||
|
WORD e_ip;
|
||||||
|
WORD e_cs;
|
||||||
|
WORD e_lfarlc;
|
||||||
|
WORD e_ovno;
|
||||||
|
WORD e_res[4];
|
||||||
|
WORD e_oemid;
|
||||||
|
WORD e_oeminfo;
|
||||||
|
WORD e_res2[10];
|
||||||
|
LONG e_lfanew;
|
||||||
|
} IMAGE_DOS_HEADER,*PIMAGE_DOS_HEADER;
|
||||||
|
#pragma pack(pop)
|
||||||
|
#pragma pack(push,4)
|
||||||
|
typedef struct _IMAGE_DATA_DIRECTORY {
|
||||||
|
DWORD VirtualAddress;
|
||||||
|
DWORD Size;
|
||||||
|
} IMAGE_DATA_DIRECTORY,*PIMAGE_DATA_DIRECTORY;
|
||||||
|
typedef struct _IMAGE_OPTIONAL_HEADER {
|
||||||
|
WORD Magic;
|
||||||
|
BYTE MajorLinkerVersion;
|
||||||
|
BYTE MinorLinkerVersion;
|
||||||
|
DWORD SizeOfCode;
|
||||||
|
DWORD SizeOfInitializedData;
|
||||||
|
DWORD SizeOfUninitializedData;
|
||||||
|
DWORD AddressOfEntryPoint;
|
||||||
|
DWORD BaseOfCode;
|
||||||
|
DWORD BaseOfData;
|
||||||
|
DWORD ImageBase;
|
||||||
|
DWORD SectionAlignment;
|
||||||
|
DWORD FileAlignment;
|
||||||
|
WORD MajorOperatingSystemVersion;
|
||||||
|
WORD MinorOperatingSystemVersion;
|
||||||
|
WORD MajorImageVersion;
|
||||||
|
WORD MinorImageVersion;
|
||||||
|
WORD MajorSubsystemVersion;
|
||||||
|
WORD MinorSubsystemVersion;
|
||||||
|
DWORD Reserved1;
|
||||||
|
DWORD SizeOfImage;
|
||||||
|
DWORD SizeOfHeaders;
|
||||||
|
DWORD CheckSum;
|
||||||
|
WORD Subsystem;
|
||||||
|
WORD DllCharacteristics;
|
||||||
|
DWORD SizeOfStackReserve;
|
||||||
|
DWORD SizeOfStackCommit;
|
||||||
|
DWORD SizeOfHeapReserve;
|
||||||
|
DWORD SizeOfHeapCommit;
|
||||||
|
DWORD LoaderFlags;
|
||||||
|
DWORD NumberOfRvaAndSizes;
|
||||||
|
IMAGE_DATA_DIRECTORY DataDirectory[IMAGE_NUMBEROF_DIRECTORY_ENTRIES];
|
||||||
|
} IMAGE_OPTIONAL_HEADER,*PIMAGE_OPTIONAL_HEADER;
|
||||||
|
typedef struct _IMAGE_FILE_HEADER {
|
||||||
|
WORD Machine;
|
||||||
|
WORD NumberOfSections;
|
||||||
|
DWORD TimeDateStamp;
|
||||||
|
DWORD PointerToSymbolTable;
|
||||||
|
DWORD NumberOfSymbols;
|
||||||
|
WORD SizeOfOptionalHeader;
|
||||||
|
WORD Characteristics;
|
||||||
|
} IMAGE_FILE_HEADER, *PIMAGE_FILE_HEADER;
|
||||||
|
typedef struct _IMAGE_SECTION_HEADER {
|
||||||
|
BYTE Name[IMAGE_SIZEOF_SHORT_NAME];
|
||||||
|
union {
|
||||||
|
DWORD PhysicalAddress;
|
||||||
|
DWORD VirtualSize;
|
||||||
|
} Misc;
|
||||||
|
DWORD VirtualAddress;
|
||||||
|
DWORD SizeOfRawData;
|
||||||
|
DWORD PointerToRawData;
|
||||||
|
DWORD PointerToRelocations;
|
||||||
|
DWORD PointerToLinenumbers;
|
||||||
|
WORD NumberOfRelocations;
|
||||||
|
WORD NumberOfLinenumbers;
|
||||||
|
DWORD Characteristics;
|
||||||
|
} IMAGE_SECTION_HEADER,*PIMAGE_SECTION_HEADER;
|
||||||
|
#pragma pack(pop)
|
||||||
|
|
||||||
|
typedef struct _SYMBOLFILE_HEADER {
|
||||||
|
unsigned long StabsOffset;
|
||||||
|
unsigned long StabsLength;
|
||||||
|
unsigned long StabstrOffset;
|
||||||
|
unsigned long StabstrLength;
|
||||||
|
} SYMBOLFILE_HEADER, *PSYMBOLFILE_HEADER;
|
||||||
|
|
||||||
|
|
||||||
|
char* convert_path(char* origpath)
|
||||||
|
{
|
||||||
|
char* newpath;
|
||||||
|
int i;
|
||||||
|
|
||||||
|
newpath = strdup(origpath);
|
||||||
|
|
||||||
|
i = 0;
|
||||||
|
while (newpath[i] != 0)
|
||||||
|
{
|
||||||
|
#ifdef UNIX_PATHS
|
||||||
|
if (newpath[i] == '\\')
|
||||||
|
{
|
||||||
|
newpath[i] = '/';
|
||||||
|
}
|
||||||
|
#else
|
||||||
|
#ifdef DOS_PATHS
|
||||||
|
if (newpath[i] == '/')
|
||||||
|
{
|
||||||
|
newpath[i] = '\\';
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
i++;
|
||||||
|
}
|
||||||
|
return(newpath);
|
||||||
|
}
|
||||||
|
|
||||||
|
#define TRANSFER_SIZE (65536)
|
||||||
|
|
||||||
|
int main(int argc, char* argv[])
|
||||||
|
{
|
||||||
|
SYMBOLFILE_HEADER SymbolFileHeader;
|
||||||
|
IMAGE_DOS_HEADER PEDosHeader;
|
||||||
|
IMAGE_FILE_HEADER PEFileHeader;
|
||||||
|
PIMAGE_SECTION_HEADER PESectionHeaders;
|
||||||
|
PVOID SymbolsBase;
|
||||||
|
ULONG SymbolsLength;
|
||||||
|
PVOID SymbolStringsBase;
|
||||||
|
ULONG SymbolStringsLength;
|
||||||
|
ULONG Idx;
|
||||||
|
char* path1;
|
||||||
|
char* path2;
|
||||||
|
FILE* in;
|
||||||
|
FILE* out;
|
||||||
|
char* buf;
|
||||||
|
int n_in;
|
||||||
|
int n_out;
|
||||||
|
|
||||||
|
if (argc != 3)
|
||||||
|
{
|
||||||
|
fprintf(stderr, "Too many arguments\n");
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
|
|
||||||
|
path1 = convert_path(argv[1]);
|
||||||
|
path2 = convert_path(argv[2]);
|
||||||
|
|
||||||
|
in = fopen(path1, "rb");
|
||||||
|
if (in == NULL)
|
||||||
|
{
|
||||||
|
perror("Cannot open input file");
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
|
|
||||||
|
out = fopen(path2, "wb");
|
||||||
|
if (out == NULL)
|
||||||
|
{
|
||||||
|
perror("Cannot open output file");
|
||||||
|
fclose(in);
|
||||||
|
exit(1);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Check if MZ header exists */
|
||||||
|
n_in = fread(&PEDosHeader, 1, sizeof(PEDosHeader), in);
|
||||||
|
if (PEDosHeader.e_magic != IMAGE_DOS_MAGIC && PEDosHeader.e_lfanew != 0L)
|
||||||
|
{
|
||||||
|
perror("Input file is not a PE image.\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Read PE file header */
|
||||||
|
/* sizeof(ULONG) = sizeof(MAGIC) */
|
||||||
|
fseek(in, PEDosHeader.e_lfanew + sizeof(ULONG), SEEK_SET);
|
||||||
|
n_in = fread(&PEFileHeader, 1, sizeof(PEFileHeader), in);
|
||||||
|
|
||||||
|
/* Read PE section headers */
|
||||||
|
PESectionHeaders = malloc(PEFileHeader.NumberOfSections * sizeof(IMAGE_SECTION_HEADER));
|
||||||
|
fseek(in, PEDosHeader.e_lfanew + sizeof(ULONG) + sizeof(IMAGE_FILE_HEADER)
|
||||||
|
+ sizeof(IMAGE_OPTIONAL_HEADER), SEEK_SET);
|
||||||
|
n_in = fread(PESectionHeaders, 1, PEFileHeader.NumberOfSections * sizeof(IMAGE_SECTION_HEADER), in);
|
||||||
|
|
||||||
|
/* Copy .stab and .stabstr sections if available */
|
||||||
|
SymbolsBase = NULL;
|
||||||
|
SymbolsLength = 0;
|
||||||
|
SymbolStringsBase = NULL;
|
||||||
|
SymbolStringsLength = 0;
|
||||||
|
|
||||||
|
for (Idx = 0; Idx < PEFileHeader.NumberOfSections; Idx++)
|
||||||
|
{
|
||||||
|
//printf("section: '%.08s'\n", PESectionHeaders[Idx].Name);
|
||||||
|
if ((strncmp(PESectionHeaders[Idx].Name, ".stab", 5) == 0)
|
||||||
|
&& (PESectionHeaders[Idx].Name[5] == 0))
|
||||||
|
{
|
||||||
|
//printf(".stab section found. Size %d\n",
|
||||||
|
// PESectionHeaders[Idx].SizeOfRawData);
|
||||||
|
|
||||||
|
SymbolsLength = PESectionHeaders[Idx].SizeOfRawData;
|
||||||
|
SymbolsBase = malloc(SymbolsLength);
|
||||||
|
|
||||||
|
fseek(in, PESectionHeaders[Idx].PointerToRawData, SEEK_SET);
|
||||||
|
n_in = fread(SymbolsBase, 1, SymbolsLength, in);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (strncmp(PESectionHeaders[Idx].Name, ".stabstr", 8) == 0)
|
||||||
|
{
|
||||||
|
//printf(".stabstr section found. Size %d\n",
|
||||||
|
// PESectionHeaders[Idx].SizeOfRawData);
|
||||||
|
|
||||||
|
SymbolStringsLength = PESectionHeaders[Idx].SizeOfRawData;
|
||||||
|
SymbolStringsBase = malloc(SymbolStringsLength);
|
||||||
|
|
||||||
|
fseek(in, PESectionHeaders[Idx].PointerToRawData, SEEK_SET);
|
||||||
|
n_in = fread(SymbolStringsBase, 1, SymbolStringsLength, in);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
SymbolFileHeader.StabsOffset = sizeof(SYMBOLFILE_HEADER);
|
||||||
|
SymbolFileHeader.StabsLength = SymbolsLength;
|
||||||
|
SymbolFileHeader.StabstrOffset = SymbolFileHeader.StabsOffset + SymbolsLength;
|
||||||
|
SymbolFileHeader.StabstrLength = SymbolStringsLength;
|
||||||
|
|
||||||
|
n_out = fwrite(&SymbolFileHeader, 1, sizeof(SYMBOLFILE_HEADER), out);
|
||||||
|
n_out = fwrite(SymbolsBase, 1, SymbolsLength, out);
|
||||||
|
n_out = fwrite(SymbolStringsBase, 1, SymbolStringsLength, out);
|
||||||
|
|
||||||
|
exit(0);
|
||||||
|
}
|
Loading…
Reference in a new issue