2007-12-30 17:41:49 +01:00
|
|
|
/***************************************************************************
|
|
|
|
|
|
|
|
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 __DEBUG_H
|
|
|
|
#define __DEBUG_H
|
|
|
|
|
|
|
|
#include "gambas.h"
|
|
|
|
#include "main.h"
|
|
|
|
#include "gb.debug.h"
|
|
|
|
#include "gb_pcode.h"
|
|
|
|
#include "gbx_value.h"
|
|
|
|
|
|
|
|
typedef
|
|
|
|
struct {
|
|
|
|
int id;
|
|
|
|
FUNCTION *func;
|
|
|
|
PCODE *addr;
|
|
|
|
CLASS *class;
|
|
|
|
ushort line;
|
|
|
|
VALUE *bp;
|
|
|
|
FUNCTION *fp;
|
|
|
|
}
|
|
|
|
DEBUG_BREAK;
|
|
|
|
|
|
|
|
typedef
|
|
|
|
enum {
|
|
|
|
TC_NONE = 0,
|
|
|
|
TC_STEP = 1,
|
|
|
|
TC_NEXT = 2,
|
|
|
|
TC_GO = 3,
|
|
|
|
TC_FROM = 4
|
|
|
|
}
|
|
|
|
DEBUG_TYPE;
|
|
|
|
|
|
|
|
typedef
|
|
|
|
struct {
|
|
|
|
char *pattern;
|
|
|
|
DEBUG_TYPE type;
|
|
|
|
void (*func)(const char *);
|
2011-05-16 04:16:22 +02:00
|
|
|
bool loop;
|
2007-12-30 17:41:49 +01:00
|
|
|
}
|
|
|
|
DEBUG_COMMAND;
|
|
|
|
|
|
|
|
|
|
|
|
#ifndef __GBX_DEBUG_C
|
|
|
|
EXTERN DEBUG_INFO DEBUG_info;
|
|
|
|
EXTERN GB_DEBUG_INTERFACE *DEBUG_interface;
|
|
|
|
EXTERN char DEBUG_buffer[];
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#define DEBUG_BUFFER_MAX 255
|
|
|
|
|
|
|
|
#define GB_DEBUG (*DEBUG_interface)
|
|
|
|
|
|
|
|
#define DEBUG_WELCOME "Welcome to the Gambas debugger.\n"
|
|
|
|
|
2011-05-16 04:16:22 +02:00
|
|
|
void DEBUG_breakpoint(int id);
|
|
|
|
void DEBUG_main(bool error);
|
2007-12-30 17:41:49 +01:00
|
|
|
|
2012-05-19 04:55:05 +02:00
|
|
|
bool DEBUG_calc_line_from_position(CLASS *class, FUNCTION *func, PCODE *addr, ushort *line);
|
2011-05-16 04:16:22 +02:00
|
|
|
const char *DEBUG_get_position(CLASS *cp, FUNCTION *fp, PCODE *pc);
|
2012-07-17 18:24:48 +02:00
|
|
|
const char *DEBUG_get_profile_position(CLASS *cp, FUNCTION *fp, PCODE *pc);
|
2011-05-16 04:16:22 +02:00
|
|
|
const char *DEBUG_get_current_position(void);
|
|
|
|
void DEBUG_init_breakpoints(CLASS *class);
|
2007-12-30 17:41:49 +01:00
|
|
|
|
2011-05-16 04:16:22 +02:00
|
|
|
void DEBUG_break_on_next_line(void);
|
2007-12-30 17:41:49 +01:00
|
|
|
|
2011-05-16 04:16:22 +02:00
|
|
|
DEBUG_INFO *DEBUG_init(GB_DEBUG_INTERFACE *debug, bool fifo, const char*fifo_name);
|
|
|
|
void DEBUG_exit(void);
|
|
|
|
void DEBUG_welcome(void);
|
|
|
|
void DEBUG_where(void);
|
|
|
|
void DEBUG_backtrace(FILE *out);
|
2007-12-30 17:41:49 +01:00
|
|
|
|
|
|
|
#endif
|