added lib/debugsup

added      lib/debugsup/debugsup-ntos.def
added      lib/debugsup/debugsup.rbuild
modified   lib/lib.rbuild
   New import-only library. Links modules that need low-level debugging functions (DbgBreakPoint, DbgBreakPointWithStatus, DbgPrint, DbgPrompt, DbgPrintEx, RtlAssert, RtlUnwind) to the correct low-level library (ntdll for user mode and ntoskrnl for kernel mode). This ensures debugging macros will always work, everywhere, and it doesn't force all modules with debugging information to link to ntdll/ntoskrnl. TODO: link RtlUnwind to kernel32 for Win32 modules

modified   tools/rbuild/backend/mingw/modulehandler.cpp
modified   tools/rbuild/backend/mingw/modulehandler.h
   Add debugsup_ntdll/debugsup_ntoskrnl as an implicit library for all executable modules (minus the kernel)


svn path=/trunk/; revision=26051
This commit is contained in:
KJK::Hyperion 2007-03-10 03:51:27 +00:00
parent 2ce0a2f2ed
commit f5891f221e
5 changed files with 107 additions and 28 deletions

View file

@ -0,0 +1,10 @@
EXPORTS
DbgBreakPoint@0
DbgBreakPointWithStatus@4
DbgPrint
DbgPrompt@12
DbgPrintEx
RtlAssert@16
RtlUnwind@16
;EOF

View file

@ -0,0 +1,8 @@
<group>
<module name="debugsup_ntoskrnl" type="staticlibrary">
<importlibrary definition="debugsup-ntos.def" dllname="ntoskrnl.exe" />
</module>
<module name="debugsup_ntdll" type="staticlibrary">
<importlibrary definition="debugsup-ntos.def" dllname="ntdll.dll" />
</module>
</group>

View file

@ -64,5 +64,8 @@
<directory name="wdmguid">
<xi:include href="wdmguid/wdmguid.rbuild" />
</directory>
<directory name="debugsup">
<xi:include href="debugsup/debugsup.rbuild" />
</directory>
</group>

View file

@ -2256,6 +2256,33 @@ MingwModuleHandler::GetDefinitionDependencies (
}
}
enum DebugSupportType
{
DebugKernelMode,
DebugUserMode
};
static void
MingwAddDebugSupportLibraries ( Module& module, DebugSupportType type )
{
Library* pLibrary;
switch(type)
{
case DebugKernelMode:
pLibrary = new Library ( module, "debugsup_ntoskrnl" );
break;
case DebugUserMode:
pLibrary = new Library ( module, "debugsup_ntdll" );
break;
default:
assert(0);
}
module.non_if_data.libraries.push_back(pLibrary);
}
MingwBuildToolModuleHandler::MingwBuildToolModuleHandler ( const Module& module_ )
: MingwModuleHandler ( module_ )
@ -2395,6 +2422,12 @@ MingwKernelModeDLLModuleHandler::MingwKernelModeDLLModuleHandler (
{
}
void
MingwKernelModeDLLModuleHandler::AddImplicitLibraries ( Module& module )
{
MingwAddDebugSupportLibraries ( module, DebugKernelMode );
}
void
MingwKernelModeDLLModuleHandler::Process ()
{
@ -2442,6 +2475,12 @@ MingwKernelModeDriverModuleHandler::MingwKernelModeDriverModuleHandler (
{
}
void
MingwKernelModeDriverModuleHandler::AddImplicitLibraries ( Module& module )
{
MingwAddDebugSupportLibraries ( module, DebugKernelMode );
}
void
MingwKernelModeDriverModuleHandler::Process ()
{
@ -2490,6 +2529,12 @@ MingwNativeDLLModuleHandler::MingwNativeDLLModuleHandler (
{
}
void
MingwNativeDLLModuleHandler::AddImplicitLibraries ( Module& module )
{
MingwAddDebugSupportLibraries ( module, DebugUserMode );
}
void
MingwNativeDLLModuleHandler::Process ()
{
@ -2537,6 +2582,12 @@ MingwNativeCUIModuleHandler::MingwNativeCUIModuleHandler (
{
}
void
MingwNativeCUIModuleHandler::AddImplicitLibraries ( Module& module )
{
MingwAddDebugSupportLibraries ( module, DebugUserMode );
}
void
MingwNativeCUIModuleHandler::Process ()
{
@ -2618,6 +2669,7 @@ void
MingwWin32DLLModuleHandler::AddImplicitLibraries ( Module& module )
{
MingwAddImplicitLibraries ( module );
MingwAddDebugSupportLibraries ( module, DebugUserMode );
}
void
@ -2677,6 +2729,7 @@ void
MingwWin32CUIModuleHandler::AddImplicitLibraries ( Module& module )
{
MingwAddImplicitLibraries ( module );
MingwAddDebugSupportLibraries ( module, DebugUserMode );
}
void
@ -2736,6 +2789,7 @@ void
MingwWin32GUIModuleHandler::AddImplicitLibraries ( Module& module )
{
MingwAddImplicitLibraries ( module );
MingwAddDebugSupportLibraries ( module, DebugUserMode );
}
void

View file

@ -280,6 +280,7 @@ public:
virtual void Process ();
std::string TypeSpecificCFlags() { return "-D_SEH_NO_NATIVE_NLG"; }
std::string TypeSpecificLinkerFlags() { return "-nostartfiles -nostdlib"; }
void AddImplicitLibraries ( Module& module );
private:
void GenerateKernelModeDLLModuleTarget ();
};
@ -293,6 +294,7 @@ public:
virtual void Process ();
std::string TypeSpecificCFlags() { return "-D__NTDRIVER__ -D_SEH_NO_NATIVE_NLG"; }
std::string TypeSpecificLinkerFlags() { return "-nostartfiles -nostdlib"; }
void AddImplicitLibraries ( Module& module );
private:
void GenerateKernelModeDriverModuleTarget ();
};
@ -306,6 +308,7 @@ public:
virtual void Process ();
std::string TypeSpecificCFlags() { return "-D_SEH_NO_NATIVE_NLG"; }
std::string TypeSpecificLinkerFlags() { return "-nostartfiles -nostdlib"; }
void AddImplicitLibraries ( Module& module );
private:
void GenerateNativeDLLModuleTarget ();
};
@ -319,6 +322,7 @@ public:
virtual void Process ();
std::string TypeSpecificCFlags() { return "-D__NTAPP__ -D_SEH_NO_NATIVE_NLG"; }
std::string TypeSpecificLinkerFlags() { return "-nostartfiles -nostdlib"; }
void AddImplicitLibraries ( Module& module );
private:
void GenerateNativeCUIModuleTarget ();
};