For v2003.06.01 Release $Revision: 1.13 $ Support: ------- Language : C - C++ Features : Component Testing - Code Coverage - Performance Profiling - Memory Profiling - Trace Tested Against: ------------ Host Machine : Sun Solaris 2.8 Compiler : DiabData Compiler 4.4a Linker : DiabData Linker 4.4a Debugger : SingleStep Debugger 7.6.6 OS : None Target : PowerPC 604 Simulator c o elf /over/diab/4.4a/include -tPPC604ES:simple -g -tPPC604ES:simple /over/diab/4.4a/ppces -lc -lm -Xelf SDSPATH /over/sds766/sun_sol2/cmd ENV_PATH /over/diab/4.4a/SUNS/bin:$Ini{'SDSPATH'}:$ENV{'PATH'} Compiler used : dcc COMPILER dcc Preprocessor used PREPROCESSOR dcc Linker used LINKER dcc Debugger used DEBUGGER $Ini{'SDSPATH'}/simppc STD_INCLUDE /over/diab/4.4a/include cpp o elf /over/diab/4.4a/include -tPPC604ES:simple -g -Xexceptions -tPPC604ES:simple /over/diab/4.4a/ppces -lc -lm -Xelf SDSPATH /over/sds766/sun_sol2/cmd ENV_PATH /over/diab/4.4a/SUNS/bin:$Ini{'SDSPATH'}:$ENV{'PATH'} Compiler used COMPILER dplus Preprocessor used PREPROCESSOR dplus Linker used LINKER dplus Debugger used DEBUGGER $Ini{'SDSPATH'}/simppc STD_INCLUDE /over/diab/4.4a/include sub atl_cc($$$$\@\@) { my ( $lang,$src,$out,$cflags,$Defines,$Includes) = @_; my $includes=""; my $defines=""; foreach(@$Includes) { $includes.=" -I\"$_\""; } foreach(@$Defines) { $defines.=" -D$_"; } my $cc=$Ini{'COMPILER'}; unlink($out); SystemP("$cc -c $cflags $defines $includes \"$src\" -o\"$out\""); } sub atl_cpp($$$$\@\@) { my ( $lang,$src,$out,$cflags,$Defines,$Includes) = @_; my $includes=""; my $defines=""; foreach(@$Includes) { $includes.=" -I\"$_\""; } foreach(@$Defines) { $defines.=" -D$_"; } my $cc=$Ini{'PREPROCESSOR'}; unlink($out); SystemP("$cc -E $cflags $defines $includes \"$src\" > atltmp.i"); return($Status) if ($Status!=0); SystemP("$BINDIR/fixlines","atltmp.i",$out); unlink("atltmp.i"); return($Status); } 1; sub atl_link($\@$\@$) { my ($exe,$Objects,$ldflags,$LibPath,$libs) = @_; my $libpath=""; my $objects=""; foreach(@$LibPath) { $libpath.=" -L\"$_\""; } foreach(@$Objects) { $objects.=" \"$_\""; } my $linker=$Ini{'LINKER'}; SystemP("$linker $ldflags $objects $libpath $libs -o\"$exe\""); } 1; sub atl_exec($$$) { my ($exe,$out,$parameters) = @_; my $Debugger=$Ini{'DEBUGGER'}; unlink($out); unlink("log.txt"); copy("$exe","Rtrt.$Ini{'EXEEXT'}"); copy("$TARGETDIR/cmd/run.cmd","run.cmd"); SystemP("$Debugger run.cmd"); unlink("Rtrt.$Ini{'EXEEXT'}"); open(IN,"<log.txt"); open(OU,">$out"); while(<IN>) { s/$/;/; s/^/\$/; eval($_); print OU $atl_buffer; } close(IN); close(OU); unlink("run.dbg"); unlink("log.txt"); return(0); } sub atl_execdbg($$$) { my ($exe,$out,$parameters) = @_; my $Debugger=$Ini{'DEBUGGER'}; unlink($out); unlink("log.txt"); copy("$exe","Rtrt.$Ini{'EXEEXT'}"); copy("$TARGETDIR/cmd/rund.cmd","rund.cmd"); SystemP("$Debugger -r rund.cmd"); unlink("Rtrt.$Ini{'EXEEXT'}"); open(IN,"<log.txt"); open(OU,">$out"); while(<IN>) { s/$/;/; s/^/\$/; eval($_); print OU $atl_buffer; } close(IN); close(OU); unlink("run.dbg"); unlink("log.txt"); return(0); } 1; Command file used to launch the execution in normal mode debug Rtrt.elf break __exit break priv_writeln -g -c "read atl_buffer >> log.txt" go break -D * exit Command file used to launch the execution in debug mode debug Rtrt.elf break __exit break priv_writeln -g -c "read atl_buffer >> log.txt" /* Insert any includes */ /* Insert Here any includes free functions or macros */ #include <stdlib.h> #include <time.h> a##b static static extern extern "C" virtual char unsigned char short unsigned short long unsigned long unsigned int ((RTRT_U_INT32)p) RTRT_NONE RTRT_STD RTRT_USR void usr_exit(RTRT_INT32 x) { /* Code here your own exit function, returning x */ ; } RTRT_NONE RTRT_USR char *usr_date() { /* Code here your own get date function */ return ((char *)0); } RTRT_NONE RTRT_STD RTRT_USR void *usr_memcpy(void *dest,const void *src,RTRT_SIZE_T s) { int i; /* Code here your memcpy function */ i=0; for(i=0;i<s;i++) ((char *)(dest))[i]=((char *)(src))[i]; return dest; } RTRT_NONE RTRT_STD RTRT_USR void *usr_gethostname(char *p) { /* Code here your gethostname function */ /* The p parameter is a 50-bytes long allocated pointer */ } RTRT_NONE RTRT_STD RTRT_USR int usr_rdv(char *p) { /* Code here your rendez-vous function */ /* The p parameter contains the name of the rendez-vous */ /* THis function should block until all the members are at the same point */ } RTRT_NONE RTRT_STD RTRT_USR int usr_atexit(void (handler)(void)) { /* Code here your atexit function */ /* The p parameter contains the name of a function that should be */ /* called at normal program termination */ } RTRT_NONE RTRT_STD RTRT_USR char *usr_getenv(char *s) { /* Code here your getenv function */ /* The s parameter contains the name of the environment variable */ /* that should be retrieved from the environment */ } RTRT_NONE RTRT_STD RTRT_USR int usr_getpid() { /* Code here your getpid function */ return(0); } RTRT_NONE RTRT_STD RTRT_USR void usr_signal(int sig,void (handler)(int)) { /* Code here your signal function */ /* The sig parameter contains the signal number to be registered */ /* The f parameter is a function pointer to the handler */ } RTRT_NONE RTRT_USR void _atl_stack_jump(void *,short); #define STACK_GOING_UP 0 #define STACK_GOING_DOWN 1 #include <setjmp.h> void RTRT_longjmp(jmp_buf env,int val) { /* Call the actual longjmp function */ /* after having called _atl_stack_jump ( [Stack Pointer Register Address], [STACK_GOING_UP|STACK_GOING_DOWN] ); */ _atl_stack_jump(env[0],STACK_GOING_UP); longjmp(env,val); } void RTRT__longjmp(jmp_buf env,int val) { /* Call the actual longjmp function */ /* after having called _atl_stack_jump ( [Stack Pointer Register Address], [STACK_GOING_UP|STACK_GOING_DOWN] ); */ _atl_stack_jump(env[0],STACK_GOING_UP); _longjmp(env,val); } #define longjmp RTRT_longjmp #define _longjmp RTRT__longjmp int main(int argc,char *argv[]) { return(0); 6 15 15 SingleStep will do the job to upload required traces from the program. RTRT_NONE is selected here RTRT_NONE RTRT_STD RTRT_USR int RTRT_FILE_TYPE usr_init(char *fileName) { /* Code here the open function */ /* The fileName parameter contains the name of the file */ /* to be opened on the host */ } RTRT_FILE_TYPE usr_open(char *fileName) { /* Code here the open function */ /* The fileName parameter contains the name of the file */ /* to be opened on the host */ } void usr_writeln(RTRT_FILE_TYPE f,char *s) { /* Code here the write function */ /* The f parameter contains the file */ /* The s parameter contains the string to be printed */ printf("%s",s); } void usr_close(RTRT_FILE_TYPE f) { /* Code here the close function */ /* The f parameter contains the file to be closed */ } RTRT_NONE RTRT_STD RTRT_USR void usr_error(const char *s) { /* Code the error function here */ } RTRT_STD RTRT_USR RTRT_NONE void *usr_malloc(RTRT_SIZE_T size) { /* Code here your own allocation function here */ } void usr_free(void *ptr) { /* Code here your own free function here */ } RTRT_USR RTRT_NONE void *lowlevel_malloc(RTRT_SIZE_T size) { /* Code the low level allocation function here */ return(__libc_malloc(size)); } void *lowlevel_calloc(RTRT_SIZE_T x,RTRT_SIZE_T y) { /* Code the low level allocation function here */ return(__libc_calloc(x,y)); } void *lowlevel_realloc(void *ptr,RTRT_SIZE_T s) { /* Code the low level allocation function here */ return(__libc_realloc(ptr,s)); } void lowlevel_free(void *ptr) { /* Code the low level allocation function here */ __libc_free(ptr); } RTRT_NONE RTRT_USR #include "atpapi.h" void *RTRT_memPartAlloc(int id,unsigned n) { void *r; unsigned x=_PurifyLTHeapActualSize(n); r=memPartAlloc(id,x); return(_PurifyLTHeapAction(_PurifyLT_API_ALLOC,r,n,0)); } void memPartFree(int id,char *ptr) { void *r=_PurifyLTHeapAction(_PurifyLT_API_FREE,ptr,0,0)); memPartFree(id,ret); } #define memPartAlloc RTRT_memPartAlloc #define memPartFree RTRT_memPartFree Although the clock interface seems to be not implemented using the SingleStep simulator, this adaptation allows to use QuantifyLT if the clock function which is used for usr_clock would not return 0. RTRT_NONE RTRT_STD RTRT_USR clock_t void usr_clock(RTRT_CLOCK_TYPE *p) { /* Code here the funtion which reads the clock */ /* and sets (*p) to the current clock value */ (*p)=clock(); } void usr_clock_init(void) { /* This function will be called only once when starting the program */ /* You may code here clock resolution computation */ } RTRT_U_INT32 4 "Clock Ticks" "3" (c) ((r)=((a)-(b))) RTRT_U_INT32 "3" (c) 1000 void usr_sleep(RTRT_TIME_TYPE p) { /* Code here the funtion which sleeps for a while */ /* p contains the duration, represented in a RTRT_TIME_TYPE item */ } RTRT_STD RTRT_SOLARIS RTRT_USR RTRT_NONE thread_t thread_self() thread_equals((t1),(t2)) thread_exit((int)(v)); thread_mutex_t v; thread_mutex_init(&v) thread_mutex_lock(&v) thread_mutex_unlock(&v) thread_mutex_destroy(&v) thread_key_t key; thread_key_create(key,NULL); thread_key_delete(key); v=thread_getspecifics(key); thread_setspecifics(key,v); /* Add your code */ /* Specify the list of #pragmas and #defines adapted to your compiler here */ #define __DCC__ 1 /* __STRICT_ANSI__ The constant 1 if -Xstrict-ansi. */ #define __STRICT_ANSI__ 1 /* Get passed extra keywords */ #define __interrupt__ #define interrupt #define packed #define __packed__ #define __inline__ #define inline /* Specify the list of #pragmas and #defines adapted to your compiler here */ /* The constant 1 when compiling C++ code, otherwise undefined. */ #define __cplusplus 1 /* __DCC__ The constant 1. */ #define __DCC__ 1 /* __DCPLUSPLUS__ The constant 1 when compiling C++ code, otherwise undefined. */ #define __DCPLUSPLUS__ 1 /* __STDC__ The constant 0 if -Xansi and the constant 1 if -Xstrict-ansi is given in C mode. It cannot be undefined if -Xstrict-ansi is set. It is never defined in C++ mode. /* #undef__STDC__ */ /* __STRICT_ANSI__ The constant 1 if -Xstrict-ansi. */ #define __STRICT_ANSI__ 1 /* __wchar_t The constant 1 if type wchar_t is defined when compiling C++ code, otherwise undefined. Option -Xno-wchar disables the wchar_t keyword. */ #define __wchar_t 1 /* Get passed extra keywords */ #define __interrupt__ #define interrupt #define packed #define __packed__ #define __inline__ #define inline #pragma attol exit_instr = "_exit" #pragma attol nointerpret #define __DCC__ 1 /* __STRICT_ANSI__ The constant 1 if -Xstrict-ansi. */ #define __STRICT_ANSI__ 1 /* Get passed extra keywords */ #define __interrupt__ #define interrupt #define packed #define __packed__ #define __inline__ #define inline --dollar --no_restrict --ignore_std --special_subscript_cost --no_alternative_tokens --extended_variadic_macros --void_star_null_pointer --guiding_decls --old_specialization --old_style_preprocessing --diag_warning 14,34,46,174,375,427,549,737,795,830,837,940 --diag_warning 289,349,397 --diag_suppress 177 --diag_suppress 80,550