diff --git a/sourcepawn/include/sp_vm_types.h b/sourcepawn/include/sp_vm_types.h index ee0663e8..fa8aed3e 100644 --- a/sourcepawn/include/sp_vm_types.h +++ b/sourcepawn/include/sp_vm_types.h @@ -168,6 +168,11 @@ typedef int (*SPVM_EXEC)(struct sp_context_s *, uint32_t, cell_t *res); +/** + * Breaks into a debugger + */ +typedef int (*SPVM_DEBUGBREAK)(struct sp_context_s *); + #define SP_CONTEXT_DEBUG (1<<0) /* in debug mode */ #define SP_CONTEXT_INHERIT_MEMORY (1<<1) /* inherits memory pointers */ #define SP_CONTEXT_INHERIT_CODE (1<<2) /* inherits code pointers */ @@ -179,11 +184,13 @@ typedef int (*SPVM_EXEC)(struct sp_context_s *, */ typedef struct sp_context_s { - /* parent information */ + /* general/parent information */ void *base; /* base of generated code and memory */ sp_plugin_t *plugin; /* pointer back to parent information */ struct sp_context_s *parent; /* pointer to parent context */ uint32_t flags; /* context flags */ + SPVM_DEBUGBREAK dbreak; /* debug break function */ + void *user; /* user specific pointer */ /* execution specific data */ SPVM_EXEC exec; /* execution base */ cell_t pri; /* PRI register */ diff --git a/sourcepawn/vm/msvc8/vm.vcproj b/sourcepawn/vm/msvc8/vm.vcproj index 66fe7b10..2516a305 100644 --- a/sourcepawn/vm/msvc8/vm.vcproj +++ b/sourcepawn/vm/msvc8/vm.vcproj @@ -193,6 +193,10 @@ RelativePath="..\sp_vm.h" > + + diff --git a/sourcepawn/vm/sp_vm.c b/sourcepawn/vm/sp_vm.c index 69a356fe..3e7ac7a3 100644 --- a/sourcepawn/vm/sp_vm.c +++ b/sourcepawn/vm/sp_vm.c @@ -1,6 +1,7 @@ #include #include #include +#include #include "sp_vm.h" #define CELLBOUNDMAX (INT_MAX/sizeof(cell_t)) diff --git a/sourcepawn/vm/sp_vm.h b/sourcepawn/vm/sp_vm.h index 69fec20d..1128bc04 100644 --- a/sourcepawn/vm/sp_vm.h +++ b/sourcepawn/vm/sp_vm.h @@ -186,6 +186,19 @@ int SP_LocalToString(sp_context_t *ctx, char *buffer, size_t maxlength); +/** + * Converts a physical string to a local address. + * Note that SourcePawn does not support packed strings. + * @param ctx Context pointer + * @param local_addr Local address in plugin. + * @param chars Number of chars to write, including NULL terminator. + * @param source Source string to copy. + */ +int SP_StringToLocal(sp_context_t *ctx, + cell_t local_addr, + size_t chars, + const char *source); + /** * Pushes a cell onto the stack. Increases the parameter count by one. *