Skip to content

Commit

Permalink
Revise approach for exporting consistent trace store type information.
Browse files Browse the repository at this point in the history
  • Loading branch information
tpn committed Apr 28, 2017
1 parent b9d2bda commit 4930fa6
Show file tree
Hide file tree
Showing 21 changed files with 613 additions and 738 deletions.
95 changes: 95 additions & 0 deletions ModuleLoaderExe/ModuleLoaderExe.vcxproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup Label="ProjectConfigurations">
<ProjectConfiguration Include="Debug|Win32">
<Configuration>Debug</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="PGOptimize|Win32">
<Configuration>PGOptimize</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="PGOptimize|x64">
<Configuration>PGOptimize</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|Win32">
<Configuration>Release</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Debug|x64">
<Configuration>Debug</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|x64">
<Configuration>Release</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="PGInstrument|Win32">
<Configuration>PGInstrument</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="PGInstrument|x64">
<Configuration>PGInstrument</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="PGUpdate|Win32">
<Configuration>PGUpdate</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="PGUpdate|x64">
<Configuration>PGUpdate</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
</ItemGroup>
<PropertyGroup Label="Globals">
<ProjectGuid>{17D8DCFB-E29E-4E53-9AB2-1E01CC811833}</ProjectGuid>
<RootNamespace>ModuleLoaderExe</RootNamespace>
<TargetPlatformVersion>10.0.14393.0</TargetPlatformVersion>
<PlatformToolset>v140</PlatformToolset>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
</PropertyGroup>
<Import Project="..\Tracer.props" />
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<ImportGroup Label="ExtensionSettings">
</ImportGroup>
<ImportGroup Label="Shared">
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Platform)'=='Win32'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Platform)'=='x64'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<PropertyGroup Label="UserMacros" />
<PropertyGroup>
<TargetName>ModuleLoader</TargetName>
<TargetExt>.exe</TargetExt>
</PropertyGroup>
<ItemDefinitionGroup>
<Link>
<SubSystem>Console</SubSystem>
<AdditionalDependencies>TracerHeapLib.lib;TracerConfigLib.lib;%(AdditionalDependencies)</AdditionalDependencies>
</Link>
<ClCompile>
<PreprocessorDefinitions>_TRACER_HEAP_STATIC_LIB;_TRACER_CONFIG_STATIC_LIB;_TRACER_CORE_NO_API_EXPORT_IMPORT;%(PreprocessorDefinitions)</PreprocessorDefinitions>
</ClCompile>
</ItemDefinitionGroup>
<ItemGroup>
<ClInclude Include="stdafx.h" />
<ClInclude Include="targetver.h" />
</ItemGroup>
<ItemGroup>
<ClCompile Include="ModuleLoaderExeMain.c" />
<ClCompile Include="stdafx.c">
<PrecompiledHeader>Create</PrecompiledHeader>
</ClCompile>
<ClCompile Include="main.c" />
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
</ImportGroup>
</Project>
42 changes: 42 additions & 0 deletions ModuleLoaderExe/ModuleLoaderExe.vcxproj.filters
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup>
<Filter Include="Source Files">
<UniqueIdentifier>{AB3707CE-FC84-4F71-AE08-CD0D62850648}</UniqueIdentifier>
<Extensions>cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx</Extensions>
</Filter>
<Filter Include="Header Files">
<UniqueIdentifier>{2B34BB95-0D79-4DF4-889B-A02E5CBC8000}</UniqueIdentifier>
<Extensions>h;hh;hpp;hxx;hm;inl;inc;xsd</Extensions>
</Filter>
<Filter Include="Resource Files">
<UniqueIdentifier>{568315A1-4F7E-420B-A3BB-0AB45C2BC800}</UniqueIdentifier>
<Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms</Extensions>
</Filter>
</ItemGroup>
<ItemGroup>
<ClInclude Include="targetver.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="stdafx.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="..\Rtl\__C_specific_handler.h">
<Filter>Header Files</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<ClCompile Include="main.c">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="stdafx.c">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\Rtl\__C_specific_handler.c">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="ModuleLoaderExeMain.c">
<Filter>Source Files</Filter>
</ClCompile>
</ItemGroup>
</Project>
70 changes: 70 additions & 0 deletions ModuleLoaderExe/ModuleLoaderExeMain.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
/*++
Copyright (c) 2017 Trent Nelson <[email protected]>
Module Name:
ModuleLoaderExeMain.c
Abstract:
This module implements ModuleLoaderExeMain(). It is intended to be
called from the mainCRTStartup() routine of an executable.
--*/

#include "stdafx.h"

ULONG
ModuleLoaderExeMain(VOID)
{
PRTL Rtl;
ALLOCATOR Allocator;
PTRACER_CONFIG TracerConfig;
PUNICODE_STRING RegistryPath;

//
// Initialize the default heap allocator. This is a thin wrapper around
// the generic Win32 Heap functions.
//

if (!DefaultHeapInitializeAllocator(&Allocator)) {
goto Error;
}

//
// Initialize TracerConfig and Rtl.
//

RegistryPath = (PUNICODE_STRING)&TracerRegistryPath;

CHECKED_MSG(
CreateAndInitializeTracerConfigAndRtl(
&Allocator,
RegistryPath,
&TracerConfig,
&Rtl
),
"CreateAndInitializeTracerConfigAndRtl()"
);

//
// Load all known tracer modules.
//

if (!LoadAllTracerModules(TracerConfig)) {
goto Error;
}

//
// Sleep until killed.
//

return SleepEx(INFINITE, TRUE);

Error:

return 1;
}

// vim:set ts=8 sw=4 sts=4 tw=80 expandtab :
28 changes: 28 additions & 0 deletions ModuleLoaderExe/main.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
/*++
Copyright (c) 2017 Trent Nelson <[email protected]>
Module Name:
main.c
Abstract:
This module is the main entry point for the tracer executable.
It implements mainCRTStartup(), which simply calls LoadModulesExeMain().
--*/

#include "stdafx.h"

LONG ModuleLoaderExeMain(VOID);

DECLSPEC_NORETURN
VOID
WINAPI
mainCRTStartup()
{
ExitProcess(ModuleLoaderExeMain());
}

// vim:set ts=8 sw=4 sts=4 tw=80 expandtab :
1 change: 1 addition & 0 deletions ModuleLoaderExe/stdafx.c
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
#include "stdafx.h"
26 changes: 26 additions & 0 deletions ModuleLoaderExe/stdafx.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
/*++
Copyright (c) 2017 Trent Nelson <[email protected]>
Module Name:
stdafx.h
Abstract:
This is the precompiled header file for the ModuleLoaderExe component.
--*/

#pragma once

#include "targetver.h"

#include <Windows.h>
#include "../Rtl/Rtl.h"
#include "../Rtl/__C_specific_handler.h"
#include "../TracerHeap/TracerHeap.h"
#include "../TracerConfig/TracerConfig.h"
#include "../TracerConfig/TracerConfigPrivate.h"

// vim:set ts=8 sw=4 sts=4 tw=80 expandtab :
1 change: 1 addition & 0 deletions ModuleLoaderExe/targetver.h
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
#include <SDKDDKVer.h>
41 changes: 33 additions & 8 deletions Python/PythonTypes.c
Original file line number Diff line number Diff line change
Expand Up @@ -8,18 +8,43 @@ Module Name:
Abstract:
Define trace store variable types. See TraceStore/TraceStoreTypes.c for
more information.
Define trace store types.
--*/

#include "stdafx.h"

PYTHON_DATA CONST PPYTHON_FUNCTION_TABLE PythonFunctionTable = 0;
PYTHON_DATA CONST PPYTHON_FUNCTION_TABLE_ENTRY PythonFunctionTableEntry = 0;
PYTHON_DATA CONST PPYTHON_PATH_TABLE PythonPathTable = 0;
PYTHON_DATA CONST PPYTHON_PATH_TABLE_ENTRY PythonPathTableEntry = 0;

PYTHON_DATA CONST PPYTHON_FUNCTION PythonFunction = 0;
//
// Define the trace store types owned by this module.
//

//
// N.B. Keep these sorted alphabetically. In vim, mark the start and end brace
// with ma and mb, then issue the command:
//
// :'a,'b !sort -b -k 2
//

typedef struct _TRACE_STORE_TYPES {
PPYTHON_FUNCTION_TABLE PythonFunctionTable;
PPYTHON_FUNCTION_TABLE_ENTRY PythonFunctionTableEntry;
PPYTHON_PATH_TABLE PythonPathTable;
PPYTHON_PATH_TABLE_ENTRY PythonPathTableEntry;
PPYTHON_FUNCTION PythonFunction;
} TRACE_STORE_TYPES;
typedef TRACE_STORE_TYPES *PTRACE_STORE_TYPES;

//
// Type exposure functions.
//

DECLSPEC_DLLEXPORT
VOID
TraceStoreTypes(
PTRACE_STORE_TYPES Types
)
{
UNREFERENCED_PARAMETER(Types);
}

// vim:set ts=8 sw=4 sts=4 tw=80 expandtab :
1 change: 1 addition & 0 deletions PythonTracerInjection/stdafx.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ Module Name:
#include "../DebugEngine/DebugEngine.h"
#include "../DebugEngine/DebugEngineInterfaces.h"
#include "../TracerConfig/TracerConfig.h"
#include "../TracerCore/TracerCore.h"
#include "../TracerHeap/TracerHeap.h"
#include "../TraceStore/TraceStore.h"
#include "../StringTable/StringTable.h"
Expand Down
1 change: 1 addition & 0 deletions StringTable/StringTable.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,7 @@
</ClCompile>
<ClCompile Include="StringTableAllocator.c" />
<ClCompile Include="StringTableConstants_C.c" />
<ClCompile Include="StringTableTypes.c" />
</ItemGroup>
<ItemGroup>
<MASM Include="StringTable_x64.asm" Condition="'$(Platform)' == 'x64'" />
Expand Down
8 changes: 3 additions & 5 deletions StringTable/StringTable.vcxproj.filters
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,9 @@
<ClCompile Include="StringTableAllocator.c">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="StringTableTypes.c">
<Filter>Source Files</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<ClInclude Include="StringTable.h">
Expand Down Expand Up @@ -75,9 +78,4 @@
<Filter>Header Files</Filter>
</None>
</ItemGroup>
<ItemGroup>
<MASM Include="StringTable_x64.asm">
<Filter>Source Files</Filter>
</MASM>
</ItemGroup>
</Project>
Loading

0 comments on commit 4930fa6

Please sign in to comment.