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)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wl,-allow-multiple-definition")
if (SHARED)
set_target_properties(pkmnLib PROPERTIES SUFFIX ".dll")
set_target_properties(AngelscriptDebugger PROPERTIES SUFFIX ".dll")
endif(SHARED)
set(_LINKS ${_LINKS} -Wl,-Bstatic -lws2_32 -Wl,-Bdynamic)
endif (WINDOWS)
if (STATICC)

View File

@ -4,6 +4,8 @@
#include "angelscript_addons/scriptbuilder/scriptbuilder.h"
#include "angelscript_addons/scripthelper/scripthelper.h"
#include "angelscript_addons/scriptstdstring/scriptstdstring.h"
#include <chrono>
#include <thread>
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;
while (!debugger.HasDebuggerAttached()) {
usleep(1000);
std::this_thread::sleep_for(std::chrono::milliseconds(1));
}
std::cout << "Debugger attached." << std::endl;
@ -84,7 +86,7 @@ class TestClass {
ctx->Execute();
while (ctx->GetState() != asEXECUTION_FINISHED && ctx->GetState() != asEXECUTION_EXCEPTION &&
ctx->GetState() != asEXECUTION_ABORTED && ctx->GetState() != asEXECUTION_ERROR) {
usleep(1000);
std::this_thread::sleep_for(std::chrono::milliseconds(1));
}
ctx->Release();

View File

@ -233,11 +233,11 @@ void ASVariableFormatter::GetChildDAPVariables(std::vector<DebugAdapterProtocol:
ctx->SetObject(address);
ctx->Execute();
if (t == asTYPEID_UINT64) {
FormatArrayLike<uint64_t, &asIScriptContext::SetArgQWord, &asIScriptContext::GetReturnQWord>(
FormatArrayLike<asQWORD, &asIScriptContext::SetArgQWord, &asIScriptContext::GetReturnQWord>(
vars, engine, ctx, address, debugger, indexFunc);
}
else if (t == asTYPEID_INT32){
FormatArrayLike<uint32_t, &asIScriptContext::SetArgDWord, &asIScriptContext::GetReturnDWord>(
FormatArrayLike<asDWORD, &asIScriptContext::SetArgDWord, &asIScriptContext::GetReturnDWord>(
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 variables = std::vector<DebugAdapterProtocol::Variable>();
auto reference = t->arguments.value()->variablesReference - 1;
if (reference >= _storedVariableReferences.size() || reference < 0)
if (reference >= _storedVariableReferences.size())
return;
auto& variant = _storedVariableReferences[reference];

View File

@ -189,7 +189,7 @@ namespace DebugAdapterProtocol {
std::optional<std::vector<size_t>> hitBreakpointIds;
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)
: reason(std::move(reason)), description(std::move(description)), text(std::move(text)) {}

View File

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