From 84e5d6d813c6563fac7dfdb40d5b6bb29cb2c68a Mon Sep 17 00:00:00 2001 From: sandeep Date: Sat, 29 Apr 2000 22:25:05 +0000 Subject: [PATCH] debugger build okay git-svn-id: https://sdcc.svn.sourceforge.net/svnroot/sdcc/trunk/sdcc@238 4a8a32a2-be11-0410-ad9d-d568d2c75423 --- debugger/mcs51/Makefile.in | 3 ++- debugger/mcs51/sdcdb.c | 16 ++++++++++++++++ debugger/mcs51/sdcdb.h | 8 +++++++- 3 files changed, 25 insertions(+), 2 deletions(-) diff --git a/debugger/mcs51/Makefile.in b/debugger/mcs51/Makefile.in index a3d0d59d..086ce97d 100644 --- a/debugger/mcs51/Makefile.in +++ b/debugger/mcs51/Makefile.in @@ -36,7 +36,8 @@ LIBDIRS = -L$(PRJDIR)/support/gc OBJECTS = sdcdb.o symtab.o simi.o $(PRJDIR)/src/SDCCset.o \ - break.o cmd.o $(PRJDIR)/src/SDCChasht.o + break.o cmd.o $(PRJDIR)/src/SDCChasht.o \ + $(PRJDIR)/src/SDCCerr.o SOURCES = $(patsubst %.o,%.c,$(OBJECTS)) TARGET = $(PRJDIR)/bin/sdcdb diff --git a/debugger/mcs51/sdcdb.c b/debugger/mcs51/sdcdb.c index d86dcfc8..423e37eb 100644 --- a/debugger/mcs51/sdcdb.c +++ b/debugger/mcs51/sdcdb.c @@ -42,6 +42,11 @@ char *ssdirl = SDCC_LIB_DIR ":" SDCC_LIB_DIR "/small" ; char *simArgs[8]; int nsimArgs = 0; +/* fake filename & lineno to make linker */ +char *filename=NULL; +int lineno = 0; +int fatalError = 0; + /* command table */ struct cmdtab { @@ -142,6 +147,17 @@ struct cmdtab { "q" , cmdQuit , NULL } }; +/*-----------------------------------------------------------------*/ +/* gc_strdup - make a string duplicate garbage collector aware */ +/*-----------------------------------------------------------------*/ +char *gc_strdup(const char *s) +{ + char *ret; + ALLOC_ATOMIC(ret, strlen(s)+1); + strcpy(ret, s); + return ret; +} + /*-----------------------------------------------------------------*/ /* alloccpy - allocate copy and return a new string */ /*-----------------------------------------------------------------*/ diff --git a/debugger/mcs51/sdcdb.h b/debugger/mcs51/sdcdb.h index 1077cbec..9d155678 100644 --- a/debugger/mcs51/sdcdb.h +++ b/debugger/mcs51/sdcdb.h @@ -67,7 +67,13 @@ typedef short bool; 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 /* generalpurpose stack related macros */ #define STACK_DCL(stack,type,size) \ typedef type t_##stack ; \ -- 2.30.2