Commit 31821838 authored by Haruki NAOI's avatar Haruki NAOI

Fix: --log-mem options is erased.

parent d44ef56e
This diff is collapsed.
...@@ -269,6 +269,20 @@ int is_newline( char *str, int size); ...@@ -269,6 +269,20 @@ int is_newline( char *str, int size);
int register_log_component(char *name, char *fext, int compidx); int register_log_component(char *name, char *fext, int compidx);
#define LOG_MEM_SIZE 500*1024*1024
#define LOG_MEM_FILE "./logmem.log"
void flush_mem_to_file(void);
void log_output_memory(const char *file, const char *func, int line, int comp, int level, const char* format,va_list args);
int logInit_log_mem(void);
void close_log_mem(void);
typedef struct {
char* buf_p;
int buf_index;
int enable_flag;
} log_mem_cnt_t;
/* @}*/ /* @}*/
/*!\fn int32_t write_file_matlab(const char *fname, const char *vname, void *data, int length, int dec, char format); /*!\fn int32_t write_file_matlab(const char *fname, const char *vname, void *data, int length, int dec, char format);
......
...@@ -28,3 +28,5 @@ extern mapping log_level_names[]; ...@@ -28,3 +28,5 @@ extern mapping log_level_names[];
extern mapping log_options[]; extern mapping log_options[];
extern mapping log_maskmap[]; extern mapping log_maskmap[];
extern int log_mem_flag;
extern char * log_mem_filename;
...@@ -35,7 +35,6 @@ ...@@ -35,7 +35,6 @@
#ifndef ASSERTIONS_H_ #ifndef ASSERTIONS_H_
#define ASSERTIONS_H_ #define ASSERTIONS_H_
void output_log_mem(void);
#define _Assert_Exit_ \ #define _Assert_Exit_ \
{ \ { \
fprintf(stderr, "\nExiting execution\n"); \ fprintf(stderr, "\nExiting execution\n"); \
......
...@@ -117,18 +117,21 @@ int signal_handle(int *end) ...@@ -117,18 +117,21 @@ int signal_handle(int *end)
case SIGUSR1: case SIGUSR1:
SIG_DEBUG("Received SIGUSR1\n"); SIG_DEBUG("Received SIGUSR1\n");
*end = 1; *end = 1;
close_log_mem();
break; break;
case SIGSEGV: /* Fall through */ case SIGSEGV: /* Fall through */
case SIGABRT: case SIGABRT:
SIG_DEBUG("Received SIGABORT\n"); SIG_DEBUG("Received SIGABORT\n");
backtrace_handle_signal(&info); backtrace_handle_signal(&info);
close_log_mem();
break; break;
case SIGINT: case SIGINT:
printf("Received SIGINT\n"); printf("Received SIGINT\n");
itti_send_terminate_message(TASK_UNKNOWN); itti_send_terminate_message(TASK_UNKNOWN);
*end = 1; *end = 1;
close_log_mem();
break; break;
default: default:
......
...@@ -70,6 +70,7 @@ ...@@ -70,6 +70,7 @@
unsigned short config_frames[4] = {2,9,11,13}; unsigned short config_frames[4] = {2,9,11,13};
#endif #endif
#include "common/utils/LOG/log.h" #include "common/utils/LOG/log.h"
#include "common/utils/LOG/log_extern.h"
#include "UTIL/OTG/otg_tx.h" #include "UTIL/OTG/otg_tx.h"
#include "UTIL/OTG/otg_externs.h" #include "UTIL/OTG/otg_externs.h"
#include "UTIL/MATH/oml.h" #include "UTIL/MATH/oml.h"
...@@ -141,7 +142,7 @@ static int8_t threequarter_fs=0; ...@@ -141,7 +142,7 @@ static int8_t threequarter_fs=0;
uint32_t downlink_frequency[MAX_NUM_CCs][4]; uint32_t downlink_frequency[MAX_NUM_CCs][4];
int32_t uplink_frequency_offset[MAX_NUM_CCs][4]; int32_t uplink_frequency_offset[MAX_NUM_CCs][4];
char logmem_filename[1024] = {0};
// This is a dummy declaration (dlsch_demodulation.c is no longer compiled for eNodeB) // This is a dummy declaration (dlsch_demodulation.c is no longer compiled for eNodeB)
int16_t dlsch_demod_shift = 0; int16_t dlsch_demod_shift = 0;
...@@ -550,7 +551,12 @@ static void get_options(void) { ...@@ -550,7 +551,12 @@ static void get_options(void) {
if (start_telnetsrv) { if (start_telnetsrv) {
load_module_shlib("telnetsrv",NULL,0); load_module_shlib("telnetsrv",NULL,0);
} }
if (strlen(logmem_filename) > 0) {
log_mem_filename = &logmem_filename[0];
log_mem_flag = 1;
printf("Enabling OPT for log save at memory %s\n",log_mem_filename);
logInit_log_mem();
}
if ( !(CONFIG_ISFLAGSET(CONFIG_ABORT)) ) { if ( !(CONFIG_ISFLAGSET(CONFIG_ABORT)) ) {
......
...@@ -202,6 +202,7 @@ ...@@ -202,6 +202,7 @@
{"R" , CONFIG_HLP_FLOG, 0, uptr:&online_log_messages, defintval:1, TYPE_INT, 0}, \ {"R" , CONFIG_HLP_FLOG, 0, uptr:&online_log_messages, defintval:1, TYPE_INT, 0}, \
{"g" , CONFIG_HLP_LOGL, 0, uptr:&glog_level, defintval:0, TYPE_UINT, 0}, \ {"g" , CONFIG_HLP_LOGL, 0, uptr:&glog_level, defintval:0, TYPE_UINT, 0}, \
{"telnetsrv", CONFIG_HLP_TELN, PARAMFLAG_BOOL, uptr:&start_telnetsrv, defintval:0, TYPE_UINT, 0}, \ {"telnetsrv", CONFIG_HLP_TELN, PARAMFLAG_BOOL, uptr:&start_telnetsrv, defintval:0, TYPE_UINT, 0}, \
{"log-mem", NULL, 0, strptr:(char **)&logmem_filename, defstrval:"./logmem.log", TYPE_STRING, sizeof(logmem_filename)}, \
} }
#define CMDLINE_ONLINELOG_IDX 0 #define CMDLINE_ONLINELOG_IDX 0
#define CMDLINE_GLOGLEVEL_IDX 1 #define CMDLINE_GLOGLEVEL_IDX 1
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment