added core debug api
authorDavid Anderson <dvander@alliedmods.net>
Sun Aug 06 18:37:14 2006 +0000 (2006-08-06)
changeset 55ccaca168c18f
parent 54 abf88d46dbd1
child 56 f7015a2e9024
added core debug api
added missing setstring function
sourcepawn/include/sp_vm_types.h
sourcepawn/vm/msvc8/vm.vcproj
sourcepawn/vm/sp_vm.c
sourcepawn/vm/sp_vm.h
     1.1 --- a/sourcepawn/include/sp_vm_types.h	Sun Aug 06 02:16:03 2006 +0000
     1.2 +++ b/sourcepawn/include/sp_vm_types.h	Sun Aug 06 18:37:14 2006 +0000
     1.3 @@ -168,6 +168,11 @@
     1.4  							uint32_t,
     1.5  							cell_t *res);
     1.6  
     1.7 +/**
     1.8 + * Breaks into a debugger
     1.9 + */
    1.10 +typedef int (*SPVM_DEBUGBREAK)(struct sp_context_s *);
    1.11 +
    1.12  #define SP_CONTEXT_DEBUG			(1<<0)		/* in debug mode */
    1.13  #define SP_CONTEXT_INHERIT_MEMORY	(1<<1)		/* inherits memory pointers */
    1.14  #define SP_CONTEXT_INHERIT_CODE		(1<<2)		/* inherits code pointers */
    1.15 @@ -179,11 +184,13 @@
    1.16   */
    1.17  typedef struct sp_context_s
    1.18  {
    1.19 -	/* parent information */
    1.20 +	/* general/parent information */
    1.21  	void			*base;		/* base of generated code and memory */
    1.22  	sp_plugin_t		*plugin;	/* pointer back to parent information */
    1.23  	struct sp_context_s *parent;	/* pointer to parent context */
    1.24  	uint32_t		flags;		/* context flags */
    1.25 +	SPVM_DEBUGBREAK dbreak;		/* debug break function */
    1.26 +	void			*user;		/* user specific pointer */
    1.27  	/* execution specific data */
    1.28  	SPVM_EXEC		exec;		/* execution base */
    1.29  	cell_t			pri;		/* PRI register */
     2.1 --- a/sourcepawn/vm/msvc8/vm.vcproj	Sun Aug 06 02:16:03 2006 +0000
     2.2 +++ b/sourcepawn/vm/msvc8/vm.vcproj	Sun Aug 06 18:37:14 2006 +0000
     2.3 @@ -194,6 +194,10 @@
     2.4  				>
     2.5  			</File>
     2.6  			<File
     2.7 +				RelativePath="..\sp_vm_debug.h"
     2.8 +				>
     2.9 +			</File>
    2.10 +			<File
    2.11  				RelativePath="..\..\include\sp_vm_types.h"
    2.12  				>
    2.13  			</File>
     3.1 --- a/sourcepawn/vm/sp_vm.c	Sun Aug 06 02:16:03 2006 +0000
     3.2 +++ b/sourcepawn/vm/sp_vm.c	Sun Aug 06 18:37:14 2006 +0000
     3.3 @@ -1,6 +1,7 @@
     3.4  #include <limits.h>
     3.5  #include <string.h>
     3.6  #include <assert.h>
     3.7 +#include <malloc.h>
     3.8  #include "sp_vm.h"
     3.9  
    3.10  #define CELLBOUNDMAX	(INT_MAX/sizeof(cell_t))
     4.1 --- a/sourcepawn/vm/sp_vm.h	Sun Aug 06 02:16:03 2006 +0000
     4.2 +++ b/sourcepawn/vm/sp_vm.h	Sun Aug 06 18:37:14 2006 +0000
     4.3 @@ -187,6 +187,19 @@
     4.4  					size_t maxlength);
     4.5  
     4.6  /**
     4.7 + * Converts a physical string to a local address.
     4.8 + * Note that SourcePawn does not support packed strings.
     4.9 + * @param ctx			Context pointer
    4.10 + * @param local_addr	Local address in plugin.
    4.11 + * @param chars			Number of chars to write, including NULL terminator.
    4.12 + * @param source		Source string to copy.
    4.13 + */
    4.14 +int SP_StringToLocal(sp_context_t *ctx,
    4.15 +					 cell_t local_addr,
    4.16 +					 size_t chars,
    4.17 +					 const char *source);
    4.18 +
    4.19 +/**
    4.20   * Pushes a cell onto the stack.  Increases the parameter count by one.
    4.21   *
    4.22   * @param ctx			Context pointer.