* debugger/mcs51/cmd.c (cmdListFunctions): fixed bugs 1181163 and 1208515
[fw/sdcc] / debugger / mcs51 / sdcdb.h
index 84fe88c764463fdc78b1e56685ca6ff71ebb03fb..9e1268e2ab60ece5f5c0061ecc2fd6153832577e 100644 (file)
 #ifndef  SDCDB_H
 #define  SDCDB_H
 
-/* #define SDCDB_DEBUG */
+#define SDCDB_DEBUG
+
+#ifdef SDCDB_DEBUG
+// set D_x to 0 to turn off, 1 to turn on.
+#define D_break  0x01
+#define D_simi   0x02
+#define D_sdcdb  0x04
+#define D_symtab 0x08
+
+extern int sdcdbDebug;
+
+#define Dprintf(f, fs) {if (f & sdcdbDebug) printf fs ; }
+#else
+#define Dprintf(f, fs) { }
+#endif
 
 #include <stdio.h>
 #include <stdlib.h>
@@ -32,7 +46,6 @@
 #include <ctype.h>
 #include <limits.h>
 #include "sdccconf.h"
-#include "src/SDCCalloc.h"
 #include "src/SDCCset.h"
 #include "src/SDCChasht.h"
 
@@ -49,20 +62,23 @@ typedef short bool;
 #define min(a,b) (a < b ? a : b)
 #endif
 
-#ifndef ALLOC
-#define  ALLOC(x,sz) if (!(x = GC_malloc(sz)))                          \
-         {                                                           \
-            fprintf(stderr,"sdcdb: out of memory\n"); \
-            exit (1);                                                \
-         }
-#endif
-#ifndef ALLOC_ATOMIC
-#define ALLOC_ATOMIC(x,sz)   if (!(x = GC_malloc_atomic(sz)))   \
-         {                                               \
-            fprintf(stderr,"sdcdb: out of memory\n"); \
-            exit (1);                                    \
-         }
-#endif
+/* 
+ * #ifndef ALLOC
+ * #define  ALLOC(x,sz) if (!(x = calloc(1, sz)))                          \
+ *          {                                                           \
+ *             fprintf(stderr,"sdcdb: out of memory\n"); \
+ *             exit (1);                                                \
+ *          }
+ * #endif
+ * #ifndef ALLOC_ATOMIC
+ * #define ALLOC_ATOMIC(x,sz)   if (!(x = calloc(1, sz)))   \
+ *          {                                               \
+ *             fprintf(stderr,"sdcdb: out of memory\n"); \
+ *             exit (1);                                    \
+ *          }
+ * #endif
+ */
+
 /* generalpurpose stack related macros */
 #define  STACK_DCL(stack,type,size)                   \
          typedef  type  t_##stack   ;                 \
@@ -89,7 +105,7 @@ typedef short bool;
                               : STACK_PUSH_(stack,x)              )
 
 #define  STACK_POP(stack)     (STACK_EMPTY(stack)                 \
-                              ?((t_##stack)(long)(STACK_ERR(0)))  \
+                              ?((t_##stack) NULL)  \
                               : STACK_POP_(stack)                 )
 
 #define  STACK_PEEK(stack)    (STACK_EMPTY(stack)                 \
@@ -120,6 +136,14 @@ enum {
     MOD_REC
 };
 
+enum {
+    FMT_NON =  0,
+    FMT_BIN =  1,
+    FMT_OCT =  2,
+    FMT_DEZ =  3,
+    FMT_HEX =  4
+};
+
 enum { SRC_CMODE = 1, SRC_AMODE };
 
 /*-----------------------------------------------------------------*/
@@ -155,6 +179,7 @@ typedef struct module {
     int   nasmLines;         /* # of lines in the assembler file */
     srcLine  **cLines;       /* actual source lines */    
     srcLine  **asmLines;     /* actual assembler source lines*/
+    set       *cfpoints;     /* set of double line execution points */   
 } module;
 
 /*-----------------------------------------------------------------*/
@@ -182,6 +207,8 @@ typedef struct function {
     set       *afpoints     ;/* set of all ASM execution points in func */
     unsigned   int laddr    ;/* last executed address                   */
     int        lline        ;/* last executed linenumber                */
+    unsigned   int stkaddr  ;/* stackpointer at beginning of function
+                              * (not reentrant ! ) only actual */
 } function ;
 
 /*-----------------------------------------------------------------*/
@@ -206,20 +233,42 @@ typedef struct context {
     int      level ;          /* current level number       */
 } context ;
 
+/*-----------------------------------------------------------------*/
+/*                     symbol display information                  */
+/*-----------------------------------------------------------------*/
+typedef struct _dsymbol
+{
+    char *name;
+    int  dnum;
+    int  fmt;
+    char *rs;
+} dsymbol;
+
+
 extern cdbrecs *recsRoot ;
 extern context *currCtxt ;
 extern set *modules  ; /* set of modules   */
 extern set *functions; /* set of functions */
 extern set *symbols  ; /* set of symbols */
+extern set *sfrsymbols;/* set of symbols of sfr or sbit */
 
+extern char *currModName ;
+extern char userinterrupt ;
+extern char nointerrupt ;
+extern short showfull ;
 extern int nStructs ;
 extern struct structdef **structs ; /* all structures */
 extern char *ssdirl; /* source directory search path */
 void **resize (void **, int );
 char  *alloccpy(char *,int );
+char *gc_strdup(const char *s);
 srcLine **loadFile (char *name, int *nlines);
+
 extern short fullname;
 extern int srcMode;
+extern char contsim;
 char *searchDirsFname (char *);
-
+char *getNextCmdLine(void );
+void setCmdLine( char * );
+void stopCommandList( void );
 #endif