Fixes for Windows.

This commit is contained in:
Deukhoofd 2021-10-23 15:15:08 +02:00
parent 1a29ae0c2a
commit 2fe2286df8
Signed by: Deukhoofd
GPG Key ID: F63E044490819F6F
6 changed files with 20 additions and 15 deletions

View File

@ -57,8 +57,9 @@ if (WINDOWS)
add_compile_options(-m64) add_compile_options(-m64)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wl,-allow-multiple-definition") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wl,-allow-multiple-definition")
if (SHARED) if (SHARED)
set_target_properties(pkmnLib PROPERTIES SUFFIX ".dll") set_target_properties(AngelscriptDebugger PROPERTIES SUFFIX ".dll")
endif(SHARED) endif(SHARED)
set(_LINKS ${_LINKS} -Wl,-Bstatic -lws2_32 -Wl,-Bdynamic)
endif (WINDOWS) endif (WINDOWS)
if (STATICC) if (STATICC)

View File

@ -4,6 +4,8 @@
#include "angelscript_addons/scriptbuilder/scriptbuilder.h" #include "angelscript_addons/scriptbuilder/scriptbuilder.h"
#include "angelscript_addons/scripthelper/scripthelper.h" #include "angelscript_addons/scripthelper/scripthelper.h"
#include "angelscript_addons/scriptstdstring/scriptstdstring.h" #include "angelscript_addons/scriptstdstring/scriptstdstring.h"
#include <chrono>
#include <thread>
static void print(const std::string& s) { std::cout << s << std::endl; } static void print(const std::string& s) { std::cout << s << std::endl; }
@ -22,7 +24,7 @@ int main() {
std::cout << "Waiting for debugger to attach." << std::endl; std::cout << "Waiting for debugger to attach." << std::endl;
while (!debugger.HasDebuggerAttached()) { while (!debugger.HasDebuggerAttached()) {
usleep(1000); std::this_thread::sleep_for(std::chrono::milliseconds(1));
} }
std::cout << "Debugger attached." << std::endl; std::cout << "Debugger attached." << std::endl;
@ -84,7 +86,7 @@ class TestClass {
ctx->Execute(); ctx->Execute();
while (ctx->GetState() != asEXECUTION_FINISHED && ctx->GetState() != asEXECUTION_EXCEPTION && while (ctx->GetState() != asEXECUTION_FINISHED && ctx->GetState() != asEXECUTION_EXCEPTION &&
ctx->GetState() != asEXECUTION_ABORTED && ctx->GetState() != asEXECUTION_ERROR) { ctx->GetState() != asEXECUTION_ABORTED && ctx->GetState() != asEXECUTION_ERROR) {
usleep(1000); std::this_thread::sleep_for(std::chrono::milliseconds(1));
} }
ctx->Release(); ctx->Release();

View File

@ -233,11 +233,11 @@ void ASVariableFormatter::GetChildDAPVariables(std::vector<DebugAdapterProtocol:
ctx->SetObject(address); ctx->SetObject(address);
ctx->Execute(); ctx->Execute();
if (t == asTYPEID_UINT64) { if (t == asTYPEID_UINT64) {
FormatArrayLike<uint64_t, &asIScriptContext::SetArgQWord, &asIScriptContext::GetReturnQWord>( FormatArrayLike<asQWORD, &asIScriptContext::SetArgQWord, &asIScriptContext::GetReturnQWord>(
vars, engine, ctx, address, debugger, indexFunc); vars, engine, ctx, address, debugger, indexFunc);
} }
else if (t == asTYPEID_INT32){ else if (t == asTYPEID_INT32){
FormatArrayLike<uint32_t, &asIScriptContext::SetArgDWord, &asIScriptContext::GetReturnDWord>( FormatArrayLike<asDWORD, &asIScriptContext::SetArgDWord, &asIScriptContext::GetReturnDWord>(
vars, engine, ctx, address, debugger, indexFunc); vars, engine, ctx, address, debugger, indexFunc);
} }
} }

View File

@ -321,7 +321,7 @@ void AngelscriptDebugger::OnRequest(asio::ip::tcp::socket* client, DebugAdapterP
auto response = new DebugAdapterProtocol::VariablesResponse(msg->seq); auto response = new DebugAdapterProtocol::VariablesResponse(msg->seq);
auto variables = std::vector<DebugAdapterProtocol::Variable>(); auto variables = std::vector<DebugAdapterProtocol::Variable>();
auto reference = t->arguments.value()->variablesReference - 1; auto reference = t->arguments.value()->variablesReference - 1;
if (reference >= _storedVariableReferences.size() || reference < 0) if (reference >= _storedVariableReferences.size())
return; return;
auto& variant = _storedVariableReferences[reference]; auto& variant = _storedVariableReferences[reference];

View File

@ -189,7 +189,7 @@ namespace DebugAdapterProtocol {
std::optional<std::vector<size_t>> hitBreakpointIds; std::optional<std::vector<size_t>> hitBreakpointIds;
explicit StoppedEventBody(std::string reason, size_t breakpoint) explicit StoppedEventBody(std::string reason, size_t breakpoint)
: reason(std::move(reason)), hitBreakpointIds({breakpoint}) {} : reason(std::move(reason)), hitBreakpointIds(std::vector<size_t>({breakpoint})) {}
explicit StoppedEventBody(std::string reason, std::string description, std::string text) explicit StoppedEventBody(std::string reason, std::string description, std::string text)
: reason(std::move(reason)), description(std::move(description)), text(std::move(text)) {} : reason(std::move(reason)), description(std::move(description)), text(std::move(text)) {}

View File

@ -248,20 +248,22 @@ namespace DebugAdapterProtocol {
presentationHint(presentationHint) {} presentationHint(presentationHint) {}
static Variable FromString(std::string name, std::string value) { static Variable FromString(std::string name, std::string value) {
return Variable( return Variable(name, value, "string",
name, value, "string", VariablePresentationHint{
VariablePresentationHint{.kind = "data", .attributes = std::vector<std::string>{"rawString"}}); .kind = "data", .attributes = std::vector<std::string>{"rawString"}, .visibility = {}});
} }
static Variable FromNull(std::string name, std::string type) { static Variable FromNull(std::string name, std::string type) {
return Variable(name, "null", type, return Variable(
VariablePresentationHint{.kind = "data", .attributes = std::vector<std::string>{}}); name, "null", type,
VariablePresentationHint{.kind = "data", .attributes = std::vector<std::string>{}, .visibility = {}});
} }
static Variable FromPointer(std::string name, std::string type, std::string display, size_t variableReference) { static Variable FromPointer(std::string name, std::string type, std::string display, size_t variableReference) {
auto v = Variable( auto v =
std::move(name), std::move(display), type, Variable(std::move(name), std::move(display), type,
VariablePresentationHint{.kind = "class", .attributes = std::vector<std::string>{"hasObjectId"}}); VariablePresentationHint{
.kind = "class", .attributes = std::vector<std::string>{"hasObjectId"}, .visibility = {}});
v.variablesReference = variableReference; v.variablesReference = variableReference;
return v; return v;
} }