- record all line numbers during function generation. This is useful for error reporting and eventually debugging.

- throw a useful exception when a VM abort occurs, the simple enum was incapable of reporting anything more than the barest minimum, which at least for array index out of bounds errors was insufficient.

The current exception mechanism is still insufficient. It really has to report a proper crash location and print a stack trace to the maximum extent possible. Instead it just prints a message and happily goes on. This is not a good solution.
This commit is contained in:
Christoph Oelckers 2016-12-02 17:36:29 +01:00
commit 1e01e6e4df
10 changed files with 159 additions and 78 deletions

View file

@ -5,6 +5,7 @@
#include "autosegs.h"
#include "vectors.h"
#include "cmdlib.h"
#include "doomerrors.h"
#define MAX_RETURNS 8 // Maximum number of results a function called by script code can return
#define MAX_TRY_DEPTH 8 // Maximum number of nested TRYs in a single function
@ -189,6 +190,13 @@ enum EVMAbortException
X_BAD_SELF,
};
class CVMAbortException : public CDoomError
{
public:
static FString stacktrace;
CVMAbortException(EVMAbortException reason, const char *moreinfo, ...);
};
enum EVMOpMode
{
MODE_ASHIFT = 0,
@ -813,6 +821,7 @@ public:
const VM_ATAG *KonstATags() const { return (VM_UBYTE *)(KonstA + NumKonstA); }
VMOP *Code;
FString SourceFileName;
int *KonstD;
double *KonstF;
FString *KonstS;