Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Debugger launch and autoconfig #184

Draft
wants to merge 15 commits into
base: develop
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
44 changes: 39 additions & 5 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,26 @@
"args": [
"--extensionDevelopmentPath=${workspaceFolder}/src/papyrus-lang-vscode"
],
"outFiles": ["${workspaceFolder}/src/papyrus-lang-vscode/out/**/*.js"]
"outFiles": [
"${workspaceFolder}/src/papyrus-lang-vscode/dist/*.js"
],
},
{
"name": "Launch (Build extension and build and copy binaries only)",
"type": "extensionHost",
"request": "launch",
"runtimeExecutable": "${execPath}",
"preLaunchTask": "buildExtensionAndUpdateBin",
"args": [
"--extensionDevelopmentPath=${workspaceFolder}/src/papyrus-lang-vscode"
],
"sourceMaps": true,
"outFiles": [
"${workspaceFolder}/src/papyrus-lang-vscode/dist/*.js"
],
"cwd": "${workspaceFolder}/src/papyrus-lang-vscode",
"internalConsoleOptions": "openOnSessionStart",
"outputCapture": "console"
},
{
"name": "Launch (Build and copy binaries only)",
Expand All @@ -24,18 +43,29 @@
"args": [
"--extensionDevelopmentPath=${workspaceFolder}/src/papyrus-lang-vscode"
],
"outFiles": ["${workspaceFolder}/src/papyrus-lang-vscode/out/**/*.js"]
"sourceMaps": true,
"outFiles": [
"${workspaceFolder}/src/papyrus-lang-vscode/dist/*.js"
],
"cwd": "${workspaceFolder}/src/papyrus-lang-vscode",
"internalConsoleOptions": "openOnSessionStart",
"outputCapture": "console"
},
{
"name": "Launch (Build extension only)",
"type": "extensionHost",
"request": "launch",
"pauseForSourceMap": true,
"runtimeExecutable": "${execPath}",
"preLaunchTask": "buildExtension",
"args": [
"--extensionDevelopmentPath=${workspaceFolder}/src/papyrus-lang-vscode"
],
"outFiles": ["${workspaceFolder}/src/papyrus-lang-vscode/out/**/*.js"]
"outFiles": [
"${workspaceFolder}/src/papyrus-lang-vscode/dist/*.js"
],
"sourceMaps": true,
"internalConsoleOptions": "openOnSessionStart"
},
{
"name": "Launch (No build)",
Expand All @@ -45,7 +75,11 @@
"args": [
"--extensionDevelopmentPath=${workspaceFolder}/src/papyrus-lang-vscode"
],
"outFiles": ["${workspaceFolder}/src/papyrus-lang-vscode/out/**/*.js"]
"outFiles": [
"${workspaceFolder}/src/papyrus-lang-vscode/dist/*.js"
],
"sourceMaps": true,
"internalConsoleOptions": "openOnSessionStart"
}
]
}
}
66 changes: 60 additions & 6 deletions .vscode/tasks.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,13 @@
"cake"
]
},
"problemMatcher": ["$tsc", "$msCompile"]
"options": {
"cwd": "${workspaceFolder}"
},
"problemMatcher": [
"$tsc",
"$msCompile"
]
},
{
"label": "updateBin",
Expand All @@ -26,9 +32,38 @@
"--target=\"update-bin\""
]
},
"options": {
"cwd": "${workspaceFolder}"
},
"command": "./build.sh",
"args": [
"--target=\"update-bin\""
],
"problemMatcher": [
"$tsc",
"$msCompile"
]
},
{
"label": "buildExtensionAndUpdateBin",
"windows": {
"command": "dotnet",
"args": [
"cake",
"--target=\"build-extension-and-update-bin\""
]
},
"options": {
"cwd": "${workspaceFolder}"
},
"command": "./build.sh",
"args": ["--target=\"update-bin\""],
"problemMatcher": ["$tsc", "$msCompile"]
"args": [
"--target=\"build-extension-and-update-bin\""
],
"problemMatcher": [
"$tsc",
"$msCompile"
]
},
{
"label": "buildExtension",
Expand All @@ -39,9 +74,28 @@
"--target=\"build-extension\""
]
},
"options": {
"cwd": "${workspaceFolder}"
},
"command": "./build.sh",
"args": ["--target=\"build-extension\""],
"problemMatcher": ["$tsc", "$msCompile"]
"args": [
"--target=\"build-extension\""
],
"problemMatcher": [
"$tsc",
"$msCompile"
]
},
{
"label": "tsc",
"type": "shell",
"command": "tsc",
"options": {
"cwd": "${workspaceFolder}/src/papyrus-lang-vscode"
},
"problemMatcher": [
"$tsc"
]
}
]
}
}
16 changes: 12 additions & 4 deletions build.cake
Original file line number Diff line number Diff line change
Expand Up @@ -210,14 +210,17 @@ Task("copy-debug-plugin")
CreateDirectory("./src/papyrus-lang-vscode/debug-plugin");

var configuration = isRelease ? "Release" : "Debug";
var skyrimPath = $"src/DarkId.Papyrus.DebugServer/bin/DarkId.Papyrus.DebugServer.Skyrim/x64/{configuration}/DarkId.Papyrus.DebugServer.Skyrim.dll";
var fallout4Path = $"src/DarkId.Papyrus.DebugServer/bin/DarkId.Papyrus.DebugServer.Fallout4/x64/{configuration}/DarkId.Papyrus.DebugServer.Fallout4.dll";
var copyDir = "./src/papyrus-lang-vscode/debug-plugin";

CopyFileToDirectory(
$"src/DarkId.Papyrus.DebugServer/bin/DarkId.Papyrus.DebugServer.Skyrim/x64/{configuration}/DarkId.Papyrus.DebugServer.Skyrim.dll",
"./src/papyrus-lang-vscode/debug-plugin");
skyrimPath,
copyDir);

CopyFileToDirectory(
$"src/DarkId.Papyrus.DebugServer/bin/DarkId.Papyrus.DebugServer.Fallout4/x64/{configuration}/DarkId.Papyrus.DebugServer.Fallout4.dll",
"./src/papyrus-lang-vscode/debug-plugin");
fallout4Path,
copyDir);
}
catch (Exception)
{
Expand Down Expand Up @@ -353,6 +356,11 @@ Task("update-bin")
Task("build-extension")
.IsDependentOn("npm-build");

Task("build-extension-and-update-bin")
.IsDependentOn("build-debugger")
.IsDependentOn("update-bin")
.IsDependentOn("build-extension");

Task("build-test")
.IsDependentOn("build")
.IsDependentOn("test");
Expand Down
2 changes: 1 addition & 1 deletion src/DarkId.Papyrus.DebugServer/PexCache.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ namespace DarkId::Papyrus::DebugServer
}
data.name = normname;
data.path = headerSrcName;
data.sourceReference = sourceReference;
data.sourceReference = sourceReference; // TODO: Remember to remove this when we get script references from the extension working
return true;
}

Expand Down
2 changes: 1 addition & 1 deletion src/DarkId.Papyrus.DebugServer/RuntimeEvents.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -523,7 +523,7 @@ namespace DarkId::Papyrus::DebugServer
if (tasklet->topFrame)
{
// We don't need to set the instruction pointer because Fallout 4 assigns the IP every time an opcode is executed
g_InstructionExecutionEvent(tasklet, tasklet->topFrame->STACK_FRAME_IP);
g_InstructionExecutionEvent(tasklet);
}
}
// TODO: There's a second CreateStack() @ 1427422C0, do we need to hook that?
Expand Down
9 changes: 7 additions & 2 deletions src/papyrus-lang-vscode/.eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,15 @@ module.exports = {
overrides: [
{
files: ['*.ts'],
plugins: ['@typescript-eslint'],
plugins: ['@typescript-eslint', "unused-imports"],
extends: ['plugin:@typescript-eslint/recommended'],
rules: {
'@typescript-eslint/no-unused-vars': ['error', { argsIgnorePattern: '^_' }],
'@typescript-eslint/no-unused-vars': "off",
"unused-imports/no-unused-imports": "error",
"unused-imports/no-unused-vars": [
"error",
{ "vars": "all", "varsIgnorePattern": "^_", "args": "after-used", "argsIgnorePattern": "^_" }
]
},
},
],
Expand Down
1 change: 1 addition & 0 deletions src/papyrus-lang-vscode/.gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
debug-bin
debug-plugin
debug-address-library
pyro
out
node_modules
Expand Down
Loading