added core debug api

added missing setstring function

--HG--
extra : convert_revision : svn%3A39bc706e-5318-0410-9160-8a85361fbb7c/trunk%4060
This commit is contained in:
David Anderson 2006-08-06 18:37:14 +00:00
parent 2665d13475
commit 28736ae60c
4 changed files with 26 additions and 1 deletions

View File

@ -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 */

View File

@ -193,6 +193,10 @@
RelativePath="..\sp_vm.h"
>
</File>
<File
RelativePath="..\sp_vm_debug.h"
>
</File>
<File
RelativePath="..\..\include\sp_vm_types.h"
>

View File

@ -1,6 +1,7 @@
#include <limits.h>
#include <string.h>
#include <assert.h>
#include <malloc.h>
#include "sp_vm.h"
#define CELLBOUNDMAX (INT_MAX/sizeof(cell_t))

View File

@ -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.
*