Skip to content

Commit ad37f7c

Browse files
authored
Update kdmp-parser to v0.7.1 (#190)
The latest version of `kdmp-parser` now supports parsing the new kernel dumps types (8, 9, 10) that recent WinDbg generates.
1 parent 3106447 commit ad37f7c

36 files changed

+2020
-1292
lines changed

src/CMakeLists.txt

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ set(CMAKE_INTERPROCEDURAL_OPTIMIZATION TRUE)
77
project(wtf)
88
include_directories(${CMAKE_CURRENT_LIST_DIR}/libs/bochscpu-bins/include)
99
include_directories(${CMAKE_CURRENT_LIST_DIR}/libs/robin-map/include)
10-
include_directories(${CMAKE_CURRENT_LIST_DIR}/libs/kdmp-parser/src/lib)
10+
add_subdirectory(${CMAKE_CURRENT_LIST_DIR}/libs/kdmp-parser/)
1111
include_directories(${CMAKE_CURRENT_LIST_DIR}/libs/libfuzzer)
1212
include_directories(${CMAKE_CURRENT_LIST_DIR}/libs/readerwriterqueue)
1313
include_directories(${CMAKE_CURRENT_LIST_DIR}/libs/json/single_include)
@@ -22,12 +22,6 @@ file(
2222
wtf/*.cc
2323
)
2424

25-
file(
26-
GLOB_RECURSE
27-
kdmp_srcfiles
28-
${CMAKE_CURRENT_LIST_DIR}/libs/kdmp-parser/src/lib/*.cc
29-
)
30-
3125
file(
3226
GLOB_RECURSE
3327
libfuzzer_srcfiles
@@ -44,7 +38,6 @@ set(
4438
add_executable(
4539
wtf
4640
${wtf_srcfiles}
47-
${kdmp_srcfiles}
4841
${libfuzzer_srcfiles}
4942
${blake3_srcfiles}
5043
)
@@ -131,4 +124,5 @@ target_precompile_headers(
131124
target_link_libraries(
132125
wtf
133126
${CMAKE_CURRENT_LIST_DIR}/libs/bochscpu-bins/lib/${CMAKE_SHARED_MODULE_PREFIX}bochscpu_ffi${CMAKE_STATIC_LIBRARY_SUFFIX}
127+
kdmp-parser
134128
)
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
Function Invoke-CmdScript {
2+
param(
3+
[String] $scriptName
4+
)
5+
$cmdLine = """$scriptName"" $args & set"
6+
& $env:SystemRoot\system32\cmd.exe /c $cmdLine |
7+
Select-String '^([^=]*)=(.*)$' | ForEach-Object {
8+
$varName = $_.Matches[0].Groups[1].Value
9+
$varValue = $_.Matches[0].Groups[2].Value
10+
Set-Item Env:$varName $varValue
11+
}
12+
}
13+
14+
Function Invoke-VisualStudio2022win32 {
15+
Invoke-CmdScript "C:/Program Files/Microsoft Visual Studio/2022/Enterprise/VC/Auxiliary/Build/vcvars32.bat"
16+
}
17+
18+
Function Invoke-VisualStudio2022x64 {
19+
Invoke-CmdScript "C:/Program Files/Microsoft Visual Studio/2022/Enterprise/VC/Auxiliary/Build/vcvars64.bat"
20+
}
21+
22+
Function Invoke-VisualStudio2022arm64 {
23+
Invoke-CmdScript "C:/Program Files/Microsoft Visual Studio/2022/Enterprise/VC/Auxiliary/Build/vcvarsamd64_arm64.bat"
24+
}
Lines changed: 153 additions & 62 deletions
Original file line numberDiff line numberDiff line change
@@ -1,94 +1,185 @@
1-
# Axel '0vercl0k' Souchet - July 26 2020
21
name: Builds
32

43
on: [push, pull_request]
54

65
jobs:
7-
Ubuntu2004:
6+
testdatas:
7+
env:
8+
TESTDATA_URL: https://github.com/0vercl0k/kdmp-parser/releases/download/v0.1/testdatas.7z
9+
10+
name: Fetch Test Data
11+
runs-on: ubuntu-latest
12+
steps:
13+
- name: Cache Artifacts
14+
id: cache-testdatas
15+
uses: actions/cache@v3
16+
with:
17+
key: kdmp-parser-testdatas-cache
18+
path: .
19+
- if: steps.cache-testdatas.outputs.cache-hit != 'true'
20+
run: |
21+
sudo apt-get -y update; sudo apt-get install -y p7zip-full;
22+
curl ${{ env.TESTDATA_URL }} -O -L
23+
7z x testdatas.7z; rm testdatas.7z
24+
- name: Upload artifacts
25+
uses: actions/upload-artifact@v3
26+
with:
27+
if-no-files-found: error
28+
name: kdmp-parser-testdatas-cache
29+
path: .
30+
31+
parser:
32+
needs: testdatas
833
strategy:
934
fail-fast: false
1035
matrix:
11-
# Available versions: https://raw.githubusercontent.com/actions/python-versions/main/versions-manifest.json
12-
# We don't test below 3.6 because f'strings were implemented in 3.6 and we use them in build scripts, etc.
13-
pyver: ['3.6', '3.7', '3.8', '3.9', '3.x']
14-
compiler: ['clang', 'gcc']
36+
variant:
37+
- {os: windows-latest, generator: msvc, arch: x64, config: RelWithDebInfo}
38+
- {os: windows-latest, generator: ninja, arch: x64, config: RelWithDebInfo}
39+
- {os: windows-latest, generator: msvc, arch: win32, config: RelWithDebInfo}
40+
# - {os: windows-latest, generator: msvc, arch: arm64, config: RelWithDebInfo}
41+
- {os: ubuntu-latest, generator: gcc, arch: x64, config: RelWithDebInfo}
42+
- {os: ubuntu-latest, generator: clang, arch: x64, config: RelWithDebInfo}
43+
- {os: macos-latest, generator: clang, arch: x64, config: Release}
44+
runs-on: ${{ matrix.variant.os }}
45+
name: parser / ${{ matrix.variant.os }} / ${{ matrix.variant.generator }} / ${{ matrix.variant.arch }}
46+
env:
47+
CMAKE_FLAGS: "-DBUILD_PARSER:BOOL=ON -DBUILD_TESTS:BOOL=ON -DBUILD_PYTHON_BINDING:BOOL=OFF"
48+
CMAKE_ARCH: ""
1549

16-
name: Ubuntu 20.04 - Py${{ matrix.pyver }} / ${{ matrix.compiler }}
17-
runs-on: ubuntu-20.04
1850
steps:
1951
- name: Checkout
20-
uses: actions/checkout@v2
52+
uses: actions/checkout@v4
2153

22-
- name: Setup Python3
23-
uses: actions/setup-python@v2
54+
- name: Retrieve testdatas
55+
uses: actions/download-artifact@v3
2456
with:
25-
python-version: ${{ matrix.pyver }}
26-
architecture: 'x64'
57+
name: kdmp-parser-testdatas-cache
58+
path: .
2759

28-
- name: Install dependencies
60+
- name: Environment Setup (Windows)
61+
if: matrix.variant.os == 'windows-latest'
62+
run: |
63+
Import-Module .\.github\Invoke-VisualStudio.ps1
64+
Invoke-VisualStudio2022${{ matrix.variant.arch }}
65+
echo "CMAKE_ARCH='-A ${{ matrix.variant.arch }}'" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
66+
67+
- name: Environment Setup (Linux)
68+
if: matrix.variant.os == 'ubuntu-latest'
69+
run: |
70+
sudo apt update
71+
72+
- name: Build (Linux/GCC)
73+
if: matrix.variant.os == 'ubuntu-latest' && matrix.variant.generator == 'gcc'
74+
run: |
75+
sudo apt install -y g++
76+
echo CC=gcc >> $GITHUB_ENV
77+
echo CXX=g++ >> $GITHUB_ENV
78+
79+
- name: Environment Setup (Linux/CLang)
80+
if: matrix.variant.os == 'ubuntu-latest' && matrix.variant.generator == 'clang'
2981
run: |
30-
sudo apt-get -y update
31-
sudo apt install -y g++-10-multilib g++-10 ninja-build
3282
sudo bash -c "$(wget -O - https://apt.llvm.org/llvm.sh)"
83+
echo CC=clang >> $GITHUB_ENV
84+
echo CXX=clang++ >> $GITHUB_ENV
3385
34-
- name: Build with gcc
35-
if: matrix.compiler == 'gcc'
36-
run: python3 builder.py --run-tests
37-
env:
38-
CC: gcc-10
39-
CXX: g++-10
40-
41-
- name: Build with clang
42-
if: matrix.compiler == 'clang'
43-
run: python3 builder.py --run-tests
44-
env:
45-
CC: clang-11
46-
CXX: clang++-11
47-
48-
- name: Upload artifacts for rel/x64
49-
uses: actions/upload-artifact@v2
50-
with:
51-
name: linx64-RelWithDebInfo-py${{ matrix.pyver }}
52-
path: bin/linx64-RelWithDebInfo
86+
- name: Build
87+
run: |
88+
mkdir build
89+
mkdir artifact
90+
cmake -S . -B ./build ${{ env.CMAKE_ARCH }} ${{ env.CMAKE_FLAGS }}
91+
cmake --build ./build --verbose --config ${{ matrix.variant.config }}
92+
cmake --install ./build --config ${{ matrix.variant.config }} --prefix ./artifact
93+
94+
- name: Tests
95+
run: |
96+
mv *.dmp ./build/src/tests/
97+
ctest --progress --build-config ${{ matrix.variant.config }} -T test --test-dir ./build/src/tests/
5398
54-
- name: Upload artifacts for dbg/x64
55-
uses: actions/upload-artifact@v2
99+
- name: Upload artifacts
100+
uses: actions/upload-artifact@v3
56101
with:
57-
name: linx64-Debug-py${{ matrix.pyver }}
58-
path: bin/linx64-Debug
102+
name: parser-${{ matrix.variant.os }}.${{ matrix.variant.generator }}-${{ matrix.variant.arch }}.${{ matrix.variant.config }}-${{ github.sha }}
103+
path: artifact/
59104

60-
Windows:
105+
bindings:
106+
needs: testdatas
61107
strategy:
62108
fail-fast: false
63109
matrix:
64-
pyver: ['3.6', '3.7', '3.8', '3.9', '3.x']
65-
66-
name: Windows latest - Py${{ matrix.pyver }}
67-
runs-on: windows-latest
110+
# nanobind does not support Python < 3.8.
111+
python-version: ['3.8', '3.9', '3.10', '3.11', '3.12']
112+
variant:
113+
- {os: windows-latest, generator: msvc, arch: x64, config: RelWithDebInfo, py-arch: x64}
114+
- {os: windows-latest, generator: msvc, arch: win32, config: RelWithDebInfo, py-arch: x86}
115+
# - {os: windows-latest, generator: msvc, arch: arm64, config: RelWithDebInfo, py-arch: x64} # Unsupported (see https://raw.githubusercontent.com/actions/python-versions/main/versions-manifest.json)
116+
- {os: ubuntu-latest, generator: gcc, arch: x64, config: RelWithDebInfo, py-arch: x64}
117+
- {os: ubuntu-latest, generator: clang, arch: x64, config: RelWithDebInfo, py-arch: x64}
118+
- {os: macos-latest, generator: clang, arch: x64, config: Release, py-arch: x64}
119+
runs-on: ${{ matrix.variant.os }}
120+
name: bindings / ${{ matrix.variant.os }} / ${{ matrix.variant.generator }} / ${{ matrix.python-version }} / ${{ matrix.variant.arch }}
121+
env:
122+
CMAKE_FLAGS: "-DBUILD_PARSER:BOOL=OFF -DBUILD_TESTS:BOOL=OFF -DBUILD_PYTHON_BINDING:BOOL=ON"
68123
steps:
69124
- name: Checkout
70-
uses: actions/checkout@v2
125+
uses: actions/checkout@v4
71126

72-
- name: Setup Python3
73-
uses: actions/setup-python@v2
127+
- name: Retrieve testdatas
128+
uses: actions/download-artifact@v3
74129
with:
75-
python-version: ${{ matrix.pyver }}
76-
architecture: 'x64'
130+
name: kdmp-parser-testdatas-cache
131+
path: .
77132

78-
- name: Setup vs prompt
79-
uses: ilammy/msvc-dev-cmd@v1
133+
- name: Setup Python
134+
uses: actions/setup-python@v4
135+
with:
136+
python-version: ${{ matrix.python-version }}
137+
architecture: ${{ matrix.variant.py-arch }}
80138

81-
- name: Build
82-
run: python builder.py --run-tests
139+
- name: Environment Setup (Windows)
140+
if: matrix.variant.os == 'windows-latest'
141+
run: |
142+
Import-Module .\.github\Invoke-VisualStudio.ps1
143+
Invoke-VisualStudio2022${{ matrix.variant.arch }}
83144
84-
- name: Upload artifacts for rel/x64
85-
uses: actions/upload-artifact@v2
86-
with:
87-
name: winx64-RelWithDebInfo-py${{ matrix.pyver }}
88-
path: bin/winx64-RelWithDebInfo
145+
- name: Environment Setup (Linux)
146+
if: matrix.variant.os == 'ubuntu-latest'
147+
run: |
148+
sudo apt-get -y update
149+
150+
- name: Environment Setup (OSX)
151+
if: matrix.variant.os == 'macos-latest'
152+
run: |
153+
echo
154+
155+
- name: Environment Setup (Linux/GCC)
156+
if: matrix.variant.os == 'ubuntu-latest' && matrix.variant.generator == 'gcc'
157+
run: |
158+
sudo apt install -y g++
159+
echo CC=gcc >> $GITHUB_ENV
160+
echo CXX=g++ >> $GITHUB_ENV
161+
162+
- name: Environment Setup (Linux/CLang)
163+
if: matrix.variant.os == 'ubuntu-latest' && matrix.variant.generator == 'clang'
164+
run: |
165+
sudo bash -c "$(wget -O - https://apt.llvm.org/llvm.sh)"
166+
echo CC=clang >> $GITHUB_ENV
167+
echo CXX=clang++ >> $GITHUB_ENV
168+
169+
- name: Build wheel
170+
run: |
171+
mkdir wheel
172+
pip wheel src/python -w ./wheel
173+
174+
- name: Python Binding Tests
175+
run: |
176+
pip install --upgrade pip setuptools wheel
177+
pip install -U -r src/python/tests/requirements.txt
178+
pip install -U --user src/python
179+
pytest -vvv src/python/tests
89180
90-
- name: Upload artifacts for dbg/x64
91-
uses: actions/upload-artifact@v2
181+
- name: Upload wheel
182+
uses: actions/upload-artifact@v3
92183
with:
93-
name: winx64-Debug
94-
path: bin/winx64-Debug
184+
name: wheels
185+
path: wheel/*.whl

src/libs/kdmp-parser/.gitignore

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@
4141

4242
# vs directory
4343
**/.vs
44+
**/.vscode
4445

4546
# user files
4647
*.vcxproj.user
@@ -49,4 +50,18 @@
4950
bin/
5051

5152
# Build output
52-
build/
53+
build/
54+
wheel/
55+
56+
# Cache folders
57+
__pycache__/
58+
.pytest_cache/
59+
60+
# Test dumps
61+
*.dmp
62+
63+
# Version files
64+
src/lib/kdmp-parser-version.h
65+
66+
kdmp-parser-testdatas
67+

src/libs/kdmp-parser/CMakeLists.txt

Lines changed: 23 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -2,24 +2,35 @@
22
# CMakeList.txt : CMake project for kdmp-parser, include source and define
33
# project specific logic here.
44
#
5-
cmake_minimum_required (VERSION 3.8)
5+
cmake_minimum_required(VERSION 3.21)
66
set(CMAKE_CXX_STANDARD 17)
77
set(CMAKE_CXX_STANDARD_REQUIRED True)
88
set(CMAKE_POSITION_INDEPENDENT_CODE True)
99

10-
OPTION(BUILD_TESTS "Build and run tests" OFF)
11-
12-
project(kdmp-parser)
13-
add_compile_options(
14-
$<$<CXX_COMPILER_ID:MSVC>:/W4$<SEMICOLON>/WX>
15-
$<$<CXX_COMPILER_ID:GNU>:-Wall$<SEMICOLON>-Wextra$<SEMICOLON>-pedantic$<SEMICOLON>-Werror>
16-
$<$<CXX_COMPILER_ID:Clang>:-Wall$<SEMICOLON>-Wextra$<SEMICOLON>-pedantic$<SEMICOLON>-Werror>
10+
project(
11+
kdmp-parser
12+
DESCRIPTION "A Cross-Platform C++ parser library for Windows kernel minidumps."
13+
HOMEPAGE_URL https://github.com/0vercl0k/kdmp-parser
14+
VERSION 0.7.1
1715
)
1816

17+
set(PROJECT_AUTHOR 0vercl0k)
18+
set(PROJECT_LICENSE MIT)
19+
20+
option(BUILD_PARSER "Build the parser executable for kdmp-parser" ON)
21+
option(BUILD_TESTS "Build the test suite for kdmp-parser" OFF)
22+
option(BUILD_PYTHON_BINDING "Build the Python bindings for kdmp-parser" OFF)
23+
1924
add_subdirectory(src/lib)
20-
add_subdirectory(src/parser)
21-
add_subdirectory(src/testapp)
22-
add_subdirectory(src/python)
25+
26+
if(BUILD_PARSER)
27+
add_subdirectory(src/parser)
28+
endif(BUILD_PARSER)
29+
30+
if(BUILD_PYTHON_BINDING)
31+
add_subdirectory(src/python)
32+
endif(BUILD_PYTHON_BINDING)
33+
2334
if(BUILD_TESTS)
2435
add_subdirectory(src/tests)
25-
endif()
36+
endif(BUILD_TESTS)

0 commit comments

Comments
 (0)