From b2821c1f536ce0282f397431533509253bbae7e8 Mon Sep 17 00:00:00 2001
From: Raymond Knopp <raymond.knopp@eurecom.fr>
Date: Mon, 9 Jul 2018 15:18:27 +0200
Subject: [PATCH] T tracer configuration identical for all executables, no ref
 to T Tracer config variables (T_port, T_wait...) outside the T tracer

---
 common/utils/T/T.h                   |  4 ++--
 targets/RT/USER/lte-softmodem.c      | 12 ++---------
 targets/RT/USER/lte-uesoftmodem.c    | 14 +------------
 targets/SIMU/USER/oaisim.c           | 13 +-----------
 targets/SIMU/USER/oaisim_functions.c | 31 ----------------------------
 5 files changed, 6 insertions(+), 68 deletions(-)

diff --git a/common/utils/T/T.h b/common/utils/T/T.h
index 5e7f53e081..ce6a535f05 100644
--- a/common/utils/T/T.h
+++ b/common/utils/T/T.h
@@ -571,6 +571,7 @@ extern T_cache_t *T_cache;
 #define CONFIG_HLP_TNOFORK       "to ease debugging with gdb\n"
 #define CONFIG_HLP_STDOUT        "print log messges on console\n"
 
+
 #define TTRACER_CONFIG_PREFIX   "TTracer"
 /*------------------------------------------------------------------------------------------------------------------------------------------*/
 /*                                            configuration parameters for TTRACE utility                                                   */
@@ -585,8 +586,7 @@ extern T_cache_t *T_cache;
 
 
 
-extern int *T_active;
-extern int T_stdout;         /* log on stdout */
+        /* log on stdout */
 void T_init(int remote_port, int wait_for_tracer, int dont_fork);
 void T_Config_Init(void);
 #else /* T_TRACER */
diff --git a/targets/RT/USER/lte-softmodem.c b/targets/RT/USER/lte-softmodem.c
index 73f5797327..dac53fc3f0 100644
--- a/targets/RT/USER/lte-softmodem.c
+++ b/targets/RT/USER/lte-softmodem.c
@@ -566,10 +566,7 @@ static void get_options(void) {
     logInit_log_mem();
   }
 
-#if T_TRACER
-  paramdef_t cmdline_ttraceparams[] =CMDLINE_TTRACEPARAMS_DESC ;
-  config_process_cmdline( cmdline_ttraceparams,sizeof(cmdline_ttraceparams)/sizeof(paramdef_t),NULL);   
-#endif
+
 
   if ( !(CONFIG_ISFLAGSET(CONFIG_ABORT)) ) {
       memset((void*)&RC,0,sizeof(RC));
@@ -590,11 +587,6 @@ static void get_options(void) {
 }
 
 
-#if T_TRACER
-int T_nowait = 0;     /* by default we wait for the tracer */
-int T_port = 2021;    /* default port to listen to to wait for the tracer */
-int T_dont_fork = 0;  /* default is to fork, see 'T_init' to understand */
-#endif
 
 
 
@@ -969,7 +961,7 @@ int main( int argc, char **argv )
 
 
 #if T_TRACER
-  T_init(T_port, 1-T_nowait, T_dont_fork);
+  T_Config_Init();
 #endif
 
 
diff --git a/targets/RT/USER/lte-uesoftmodem.c b/targets/RT/USER/lte-uesoftmodem.c
index 46d47e076c..27fe6ebe8a 100644
--- a/targets/RT/USER/lte-uesoftmodem.c
+++ b/targets/RT/USER/lte-uesoftmodem.c
@@ -578,10 +578,6 @@ static void get_options(void) {
     	tx_gain[0][CC_id] = tx_gain[0][0];
   }
 
-#if T_TRACER
-  paramdef_t cmdline_ttraceparams[] =CMDLINE_TTRACEPARAMS_DESC ;
-  config_process_cmdline( cmdline_ttraceparams,sizeof(cmdline_ttraceparams)/sizeof(paramdef_t),NULL);   
-#endif
 
   if ( !(CONFIG_ISFLAGSET(CONFIG_ABORT))  && (!(CONFIG_ISFLAGSET(CONFIG_NOOOPT))) ) {
     // Here the configuration file is the XER encoded UE capabilities
@@ -594,14 +590,6 @@ static void get_options(void) {
 }
 
 
-#if T_TRACER
-int T_nowait = 0;     /* by default we wait for the tracer */
-int T_port = 2021;    /* default port to listen to to wait for the tracer */
-int T_dont_fork = 0;  /* default is to fork, see 'T_init' to understand */
-#endif
-
-
-
 void set_default_frame_parms(LTE_DL_FRAME_PARMS *frame_parms[MAX_NUM_CCs]) {
 
   int CC_id;
@@ -841,7 +829,7 @@ int main( int argc, char **argv )
 
 
 #if T_TRACER
-  T_init(T_port, 1-T_nowait, T_dont_fork);
+  T_Config_Init();
 #endif
 
 
diff --git a/targets/SIMU/USER/oaisim.c b/targets/SIMU/USER/oaisim.c
index 659463e8bc..c37a95a95a 100644
--- a/targets/SIMU/USER/oaisim.c
+++ b/targets/SIMU/USER/oaisim.c
@@ -283,11 +283,6 @@ help (void)
   printf ("-Z Reserved\n");
   printf ("--xforms Activate the grapical scope\n");
 
-#if T_TRACER
-  printf ("--T_port [port]    use given port\n");
-  printf ("--T_nowait         don't wait for tracer, start immediately\n");
-  printf ("--T_dont_fork      to ease debugging with gdb\n");
-#endif
 }
 
 pthread_t log_thread;
@@ -993,12 +988,6 @@ int restart_L1L2(int enb_id)
   return 0;
 }
 
-#if T_TRACER
-int T_wait = 1;       /* by default we wait for the tracer */
-int T_port = 2021;    /* default port to listen to to wait for the tracer */
-int T_dont_fork = 0;  /* default is to fork, see 'T_init' to understand */
-#endif
-
 
 void wait_RUs(void)
 {
@@ -1120,7 +1109,7 @@ int main (int argc, char **argv)
   get_simulation_options (argc, argv); //Command-line options
 
 #if T_TRACER
-  T_init(T_port, T_wait, T_dont_fork);
+  T_Config_Init();
 #endif
 
   // Initialize VCD LOG module
diff --git a/targets/SIMU/USER/oaisim_functions.c b/targets/SIMU/USER/oaisim_functions.c
index 3bc180a014..c159f11371 100644
--- a/targets/SIMU/USER/oaisim_functions.c
+++ b/targets/SIMU/USER/oaisim_functions.c
@@ -198,11 +198,6 @@ void get_simulation_options(int argc, char *argv[])
     LONG_OPTION_PHYTEST,
     LONG_OPTION_XFORMS,
 
-#if T_TRACER
-    LONG_OPTION_T_PORT,
-    LONG_OPTION_T_NOWAIT,
-    LONG_OPTION_T_DONT_FORK,
-#endif
   };
 
   static struct option long_options[] = {
@@ -237,12 +232,6 @@ void get_simulation_options(int argc, char *argv[])
     {"phy-test", no_argument, NULL, LONG_OPTION_PHYTEST},
     {"xforms",                 no_argument,       0, LONG_OPTION_XFORMS},
 
-#if T_TRACER
-    {"T_port",                 required_argument, 0, LONG_OPTION_T_PORT},
-    {"T_nowait",               no_argument,       0, LONG_OPTION_T_NOWAIT},
-    {"T_dont_fork",            no_argument,       0, LONG_OPTION_T_DONT_FORK},
-#endif
-
     {NULL, 0, NULL, 0}
   };
 
@@ -410,26 +399,6 @@ void get_simulation_options(int argc, char *argv[])
       xforms=1;
       break;
 
-#if T_TRACER
-    case LONG_OPTION_T_PORT: {
-      extern int T_port;
-      if (optarg == NULL) abort();  /* should not happen */
-      T_port = atoi(optarg);
-      break;
-    }
-
-    case LONG_OPTION_T_NOWAIT: {
-      extern int T_wait;
-      T_wait = 0;
-      break;
-    }
-
-    case LONG_OPTION_T_DONT_FORK: {
-      extern int T_dont_fork;
-      T_dont_fork = 1;
-      break;
-    }
-#endif
 
     case 'a':
       abstraction_flag = 1;
-- 
GitLab