Difference between revisions of "For Eos System Developers"

From EosPedia
Jump to: navigation, search
(DEBUGPRINT function)
(DEBUGPRINT function)
Line 81: Line 81:
 
     ................
 
     ................
  
    or
+
or
  
 
     #define DEBUG2
 
     #define DEBUG2

Revision as of 01:55, 17 September 2012

Eos System Developers

Eos Enviroment Setting

Eos default setting

   EOS_HOME
       Eos home directory 
   EOS_HOST
       Eos working station type
       When you want to create a new tool on another Eos,
       EOS_ANOTHER_HOME
           Anonther Eos home directory 

When you create a new tool,

Rule

create new directories and proto-type source codes

$ maketool classname toolname new

change a working directory.

$ cd $EOS_HOME/src/Tools/classname/toolname/src

When you want to add new arguments, you need to modify a file of ../Config/OptionControlFile. Now we are creating a interactive tool, makeOptionControlFile. Wait a moment please. If you modify a file of OptionControlFile, you must update your new source codes.

$ make update

modify toolname.c (a main-source file) This step is essential but cannot be auto-made.

Check file-dependency.

$ make depend

build a new tool

$ make

fix bugs in a main-source file. This step is essential, too. It may take many hours to fix bugs. Eos supplies some techniques for the purpose of quick bug-fix, while the bug-fix step cannot be auto.

install a new tool

$ make install 

When you create a new object

$ protoObjectMethodCreate 


Control File Format

This control file is used to generate prototype-source code.

Main Source File

   Main source file
       Default: Tool.c 
   ToolInfo
       This struct includes the information of argmunets (argv) of main function 
   init0 (init.c)
       Assign default values to ToolInfo 
   argCheck (argCheck.c)
       Assign values to ToolInfo using the information of arguments (argv) 
   init1 (init.c)
       Initialize ToolInfo following the information of arguments (ToolInfo). 

Some Techiniques for Quick Bug-fix

DEBUGPRINT function

  1. include "genUtil.h"

If you begin to debug programs,

Example:

   #define DEBUG
   #include "genUtil.h"
   ................
   DEBUGPRINT("This step is OK");
   DEBUGPRINT1("This step is OK: %ld \n", mode);
   ................
   DEBUGPRINT6("This step is OK: %ld %ld %ld %ld %ld %ld\n", mode1, mode2, mode3, mode4, mode5, mode6);
   ................

or

   #define DEBUG2
   #include "genUtil.h"
   ................
   DEBUG2PRINT("This step is OK");
   DEBUG2PRINT1("This step is OK: %ld \n", mode);
   ................
   DEBUG2PRINT6("This step is OK: %ld %ld %ld %ld %ld %ld\n", mode1, mode2, mode3, mode4, mode5, mode6);
   ................

If you finish to debug programs,

   #undef DEBUG or #undef DEBUG2
   #include "genUtil.h"
   ................
   DEBUGPRINT("This step is OK");
   DEBUGPRINT1("This step is OK: %ld \n", mode);
   ................
   DEBUGPRINT6("This step is OK: %ld %ld %ld %ld %ld %ld\n", mode1, mode2, mode3, mode4, mode5, mode6);
   ................

How to use gdb.

   Example (core analysis)
   	OS: HP, Order: mrcImagePrint -i test -o test2
   	gdb ~/Eos/bin/HP/mrcImagePrint.HP core
   	or
   	gdb ~/Eos/bin/HP/mrcImagePrint.HP
   	run -i test -o test2
   	(command list)
   	where
   	list 
   	up, down
   	print
   	break
   	next
   	

Log print

   Example
   	#define LOGPRINT4(fpt,ID,ID2,x,d1,d2,d3,d4) \
   	fprintf(fpt, "%-6s %-15s ",ID,ID2); \
   	fprintf(fpt, x, d1,d2,d3,d4); \
   	fprintf(fpt, "\n"); fflush(fpt); \
   	fprintf(stdout, "%-6s %-15s ",ID,ID2); \
   	fprintf(stdout, x, d1,d2,d3,d4); \
   	fprintf(stdout, "\n"); fflush(stdout);