2007-12-30 17:41:49 +01:00
|
|
|
/***************************************************************************
|
|
|
|
|
|
|
|
gb.debug.h
|
|
|
|
|
2018-02-12 02:53:46 +01:00
|
|
|
(c) 2000-2017 Benoît Minisini <g4mba5@gmail.com>
|
2007-12-30 17:41:49 +01:00
|
|
|
|
|
|
|
This program is free software; you can redistribute it and/or modify
|
|
|
|
it under the terms of the GNU General Public License as published by
|
2009-08-17 12:41:51 +02:00
|
|
|
the Free Software Foundation; either version 2, or (at your option)
|
2007-12-30 17:41:49 +01:00
|
|
|
any later version.
|
|
|
|
|
|
|
|
This program is distributed in the hope that it will be useful,
|
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
GNU General Public License for more details.
|
|
|
|
|
|
|
|
You should have received a copy of the GNU General Public License
|
|
|
|
along with this program; if not, write to the Free Software
|
2011-06-03 02:51:09 +02:00
|
|
|
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
|
2011-12-31 03:39:20 +01:00
|
|
|
MA 02110-1301, USA.
|
2007-12-30 17:41:49 +01:00
|
|
|
|
|
|
|
***************************************************************************/
|
|
|
|
|
|
|
|
#ifndef __GB_DEBUG_H
|
|
|
|
#define __GB_DEBUG_H
|
|
|
|
|
|
|
|
#include <stdlib.h>
|
|
|
|
#include "gambas.h"
|
|
|
|
#include "gbx_class.h"
|
|
|
|
#include "gbx_value.h"
|
|
|
|
#include "gb_pcode.h"
|
|
|
|
|
|
|
|
#define DEBUG_INTERFACE_VERSION 1
|
|
|
|
|
|
|
|
typedef
|
|
|
|
struct {
|
|
|
|
unsigned stop : 1;
|
|
|
|
unsigned leave : 1;
|
|
|
|
FUNCTION *fp;
|
|
|
|
VALUE *bp;
|
2013-05-30 03:10:59 +02:00
|
|
|
VALUE *pp;
|
2007-12-30 17:41:49 +01:00
|
|
|
void *op;
|
|
|
|
CLASS *cp;
|
|
|
|
PCODE *ec;
|
|
|
|
VALUE *ep;
|
|
|
|
}
|
|
|
|
DEBUG_INFO;
|
|
|
|
|
2009-02-16 22:39:07 +01:00
|
|
|
enum
|
|
|
|
{
|
|
|
|
GB_DEBUG_ACCESS_NORMAL = 0,
|
|
|
|
GB_DEBUG_ACCESS_ARRAY = 1,
|
|
|
|
GB_DEBUG_ACCESS_COLLECTION = 2
|
|
|
|
};
|
|
|
|
|
2009-08-24 16:19:32 +02:00
|
|
|
enum
|
|
|
|
{
|
|
|
|
GB_DEBUG_SET_OK = 0,
|
|
|
|
GB_DEBUG_SET_ERROR = 1,
|
|
|
|
GB_DEBUG_SET_READ_ONLY = 2
|
|
|
|
};
|
|
|
|
|
2014-04-05 02:28:41 +02:00
|
|
|
typedef
|
|
|
|
void (*GB_DEBUG_ENUM_CB)(char *key, int len);
|
|
|
|
|
2007-12-30 17:41:49 +01:00
|
|
|
typedef
|
|
|
|
struct {
|
|
|
|
void *(*GetExec)(void);
|
|
|
|
void *(*GetStack)(int frame);
|
|
|
|
void (*PrintError)(FILE *where, bool msgonly, bool newline);
|
2011-07-24 11:45:44 +02:00
|
|
|
void (*SaveError)(void *, void *);
|
|
|
|
void (*RestoreError)(void *, void *);
|
2007-12-30 17:41:49 +01:00
|
|
|
void (*ToString)(GB_VALUE *value, char **addr, int *len);
|
|
|
|
int (*FormatDate)(GB_DATE_SERIAL *date, int fmt_type, const char *fmt, int len_fmt, char **str, int *len_str);
|
|
|
|
int (*FormatNumber)(double number, int fmt_type, const char *fmt, int len_fmt, char **str, int *len_str, bool local);
|
|
|
|
bool (*GetValue)(const char *sym, int len, GB_VARIANT *ret);
|
2009-08-24 16:19:32 +02:00
|
|
|
int (*SetValue)(const char *sym, int len, VALUE *value);
|
2007-12-30 17:41:49 +01:00
|
|
|
void (*GetArrayValue)(GB_ARRAY array, int index, GB_VALUE *value);
|
2014-04-05 02:28:41 +02:00
|
|
|
void (*EnumKeys)(void *collection, GB_DEBUG_ENUM_CB cb);
|
2007-12-30 17:41:49 +01:00
|
|
|
void *(*GetNextSortedSymbol)(void *klass, int *index);
|
2009-02-16 22:39:07 +01:00
|
|
|
int (*GetObjectAccessType)(void *object, CLASS *klass, int *count);
|
2009-07-29 02:16:48 +02:00
|
|
|
GB_CLASS (*FindClass)(const char *name);
|
2011-03-16 23:16:19 +01:00
|
|
|
int *(*GetArrayBounds)(void *array);
|
2013-12-18 12:21:01 +01:00
|
|
|
void (*BreakOnError)(bool);
|
2014-04-05 02:28:41 +02:00
|
|
|
void (*EnterEval)(void);
|
|
|
|
void (*LeaveEval)(void);
|
2007-12-30 17:41:49 +01:00
|
|
|
}
|
|
|
|
GB_DEBUG_INTERFACE;
|
|
|
|
|
|
|
|
typedef
|
|
|
|
struct {
|
2008-03-11 14:29:47 +01:00
|
|
|
intptr_t version;
|
2009-05-22 16:52:36 +02:00
|
|
|
DEBUG_INFO *(*Init)(GB_DEBUG_INTERFACE *debug, int fifo, const char *fifo_name);
|
2007-12-30 17:41:49 +01:00
|
|
|
void (*Exit)(void);
|
|
|
|
void (*Welcome)(void);
|
|
|
|
void (*Main)(int error);
|
|
|
|
void (*Where)(void);
|
|
|
|
void (*Backtrace)(FILE *out);
|
|
|
|
void (*Breakpoint)(int id);
|
|
|
|
void (*BreakOnNextLine)(void);
|
|
|
|
const char *(*GetPosition)(void *klass, void *func, void *pcode);
|
|
|
|
const char *(*GetCurrentPosition)(void);
|
|
|
|
void (*InitBreakpoints)(void *klass);
|
2012-05-19 04:55:05 +02:00
|
|
|
struct {
|
2012-06-10 16:58:45 +02:00
|
|
|
void (*Init)(const char *path);
|
2012-05-19 04:55:05 +02:00
|
|
|
void (*Add)(void *cp, void *fp, void *pc);
|
|
|
|
void (*Exit)(void);
|
|
|
|
void (*Begin)(void *cp, void *fp);
|
|
|
|
void (*End)(void *cp, void *fp);
|
2014-08-22 21:31:51 +02:00
|
|
|
void (*Cancel)(void);
|
2012-05-19 04:55:05 +02:00
|
|
|
}
|
|
|
|
Profile;
|
2007-12-30 17:41:49 +01:00
|
|
|
void *_null;
|
|
|
|
}
|
|
|
|
DEBUG_INTERFACE;
|
|
|
|
|
2009-08-01 17:13:50 +02:00
|
|
|
#define DEBUG_OUTPUT_MAX_SIZE 65536
|
2010-01-28 11:55:24 +01:00
|
|
|
#define DEBUG_FIFO_PATH_MAX 64
|
|
|
|
|
2007-12-30 17:41:49 +01:00
|
|
|
#endif
|