diff --git a/CMakeLists.txt b/CMakeLists.txt index 185398c24e..6d06d30c17 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -256,8 +256,11 @@ add_definitions("-DPACKAGE_BUGREPORT=\"openair4g-devel@lists.eurecom.fr\"") # Debug related options ######################################### -add_boolean_option(DEBUG_ASN1 False "ASN1 coder/decoder Debug" OFF) -#add_boolean_option(DEBUG_MAC_INTERFACE False "print MAC-RLC PDU exchange to stdout") # if true, make sure that global and PDCP log levels are trace, not found in code, commented out, to be removed +add_boolean_option(DEBUG_ASN1 False "Enable ASN1 debug logs" OFF) +# asn1c skeletons have hardcoded this flag to make customized debug logs +# OAI uses this feature to re-use OAI LOG_I(ASN1, ...) +# see common/utils/config.h +add_boolean_option(TRACE_ASN1C_ENC_DEC OFF "Enable ASN1 encoder/decoder debug traces via OAI logging system" ON) add_boolean_option(T_TRACER True "Activate the T tracer, a debugging/monitoring framework" ON) add_boolean_option(UE_AUTOTEST_TRACE False "Activate UE autotest specific logs" ON) add_boolean_option(UE_DEBUG_TRACE False "Activate UE debug trace" ON) @@ -267,12 +270,6 @@ set (OCP_ITTI ${OPENAIR_DIR}/common/utils/ocp_itti) add_library(ITTI ${OCP_ITTI}/intertask_interface.cpp) target_link_libraries(ITTI PRIVATE asn1_lte_rrc_hdrs asn1_nr_rrc_hdrs) -# asn1c skeletons have hardcoded this flag to make customized debug logs -# OAI uses this feature to re-use OAI LOG_I(ASN1, ...) -if (DEBUG_ASN1C) - add_definitions(-DHAVE_CONFIG_H) -endif() - # asn1c skeletons need this add_definitions(-DHAVE_NETINET_IN_H) diff --git a/cmake_targets/build_oai b/cmake_targets/build_oai index cb66d4f862..a9241bf3b3 100755 --- a/cmake_targets/build_oai +++ b/cmake_targets/build_oai @@ -120,6 +120,8 @@ Options: Builds Coverity-Scan objects for upload --disable-deadline Disables deadline scheduler of Linux kernel (>=3.14.x). +--trace-asn1c-enc-dec + Output asn1c logging traces via OAI logging system. --enable-deadline Enable deadline scheduler of Linux kernel (>=3.14.x). --disable-cpu-affinity @@ -416,6 +418,10 @@ function main() { sleep 2 CMAKE_CMD="$CMAKE_CMD -DSANITIZE_MEMORY=ON -DSANITIZE_ADDRESS=OFF -DSANITIZE_UNDEFINED=OFF" shift;; + --trace-asn1c-enc-dec) + CMAKE_CMD="$CMAKE_CMD -DTRACE_ASN1C_ENC_DEC=ON" + echo_info "Enabling asn1c internal traces via OAI logging system" + shift 1;; -h | --help) print_help exit 1;; diff --git a/common/utils/T/T_messages.txt b/common/utils/T/T_messages.txt index c535f36f5e..71cd8a5486 100644 --- a/common/utils/T/T_messages.txt +++ b/common/utils/T/T_messages.txt @@ -969,25 +969,25 @@ ID = LEGACY_OSA_TRACE GROUP = ALL:LEGACY_OSA:LEGACY_GROUP_TRACE:LEGACY FORMAT = string,log -ID = LEGACY_ASN_INFO - DESC = ASN legacy logs - info level - GROUP = ALL:LEGACY_ASN:LEGACY_GROUP_INFO:LEGACY +ID = LEGACY_ASN1_INFO + DESC = ASN1 legacy logs - info level + GROUP = ALL:LEGACY_ASN1:LEGACY_GROUP_INFO:LEGACY FORMAT = string,log -ID = LEGACY_ASN_ERROR - DESC = ASN legacy logs - error level - GROUP = ALL:LEGACY_ASN:LEGACY_GROUP_ERROR:LEGACY +ID = LEGACY_ASN1_ERROR + DESC = ASN1 legacy logs - error level + GROUP = ALL:LEGACY_ASN1:LEGACY_GROUP_ERROR:LEGACY FORMAT = string,log -ID = LEGACY_ASN_WARNING - DESC = ASN legacy logs - warning level - GROUP = ALL:LEGACY_ASN:LEGACY_GROUP_WARNING:LEGACY +ID = LEGACY_ASN1_WARNING + DESC = ASN1 legacy logs - warning level + GROUP = ALL:LEGACY_ASN1:LEGACY_GROUP_WARNING:LEGACY FORMAT = string,log -ID = LEGACY_ASN_DEBUG - DESC = ASN legacy logs - debug level - GROUP = ALL:LEGACY_ASN:LEGACY_GROUP_DEBUG:LEGACY +ID = LEGACY_ASN1_DEBUG + DESC = ASN1 legacy logs - debug level + GROUP = ALL:LEGACY_ASN1:LEGACY_GROUP_DEBUG:LEGACY FORMAT = string,log -ID = LEGACY_ASN_TRACE - DESC = ASN legacy logs - trace level - GROUP = ALL:LEGACY_ASN:LEGACY_GROUP_TRACE:LEGACY +ID = LEGACY_ASN1_TRACE + DESC = ASN1 legacy logs - trace level + GROUP = ALL:LEGACY_ASN1:LEGACY_GROUP_TRACE:LEGACY FORMAT = string,log ID = LEGACY_SIM_INFO diff --git a/common/utils/T/tracer/CMakeLists.txt b/common/utils/T/tracer/CMakeLists.txt index b60649d2d4..a587b00243 100644 --- a/common/utils/T/tracer/CMakeLists.txt +++ b/common/utils/T/tracer/CMakeLists.txt @@ -1,4 +1,4 @@ -add_library(tracer_utils OBJECT config.c database.c event.c handler.c utils.c) +add_library(tracer_utils OBJECT configuration.c database.c event.c handler.c utils.c) target_link_libraries(tracer_utils PUBLIC m pthread) add_library(tracer_events OBJECT event_selector.c) diff --git a/common/utils/T/tracer/Makefile b/common/utils/T/tracer/Makefile index 0713d9a3df..6ddf05e65b 100644 --- a/common/utils/T/tracer/Makefile +++ b/common/utils/T/tracer/Makefile @@ -10,7 +10,7 @@ all: record replay extract_config textlog enb ue vcd macpdu2wireshark \ extract_input_subframe extract_output_subframe to_vcd extract multi \ gnb -record: utils.o record.o database.o config.o +record: utils.o record.o database.o configuration.o $(CC) $(CFLAGS) -o record $^ $(LIBS) replay: utils.o replay.o @@ -20,48 +20,48 @@ extract_config: extract_config.o $(CC) $(CFLAGS) -o extract_config $^ $(LIBS) extract_input_subframe: extract_input_subframe.o database.o event.o utils.o \ - config.o + configuration.o $(CC) $(CFLAGS) -o $@ $^ $(LIBS) extract_output_subframe: extract_output_subframe.o database.o event.o utils.o \ - config.o + configuration.o $(CC) $(CFLAGS) -o $@ $^ $(LIBS) -extract: extract.o database.o event.o utils.o config.o +extract: extract.o database.o event.o utils.o configuration.o $(CC) $(CFLAGS) -o $@ $^ $(LIBS) -textlog: utils.o textlog.o database.o event.o handler.o config.o \ +textlog: utils.o textlog.o database.o event.o handler.o configuration.o \ event_selector.o view/view.a gui/gui.a logger/logger.a \ filter/filter.a $(CC) $(CFLAGS) -o textlog $^ $(LIBS) $(XLIBS) -enb: utils.o enb.o database.o event.o handler.o config.o \ +enb: utils.o enb.o database.o event.o handler.o configuration.o \ event_selector.o view/view.a gui/gui.a logger/logger.a \ filter/filter.a $(CC) $(CFLAGS) -o enb $^ $(LIBS) $(XLIBS) -ue: utils.o ue.o database.o event.o handler.o config.o \ +ue: utils.o ue.o database.o event.o handler.o configuration.o \ event_selector.o view/view.a gui/gui.a logger/logger.a \ filter/filter.a $(CC) $(CFLAGS) -o ue $^ $(LIBS) $(XLIBS) -vcd: utils.o vcd.o database.o event.o handler.o config.o \ +vcd: utils.o vcd.o database.o event.o handler.o configuration.o \ event_selector.o view/view.a gui/gui.a logger/logger.a \ filter/filter.a $(CC) $(CFLAGS) -o vcd $^ $(LIBS) $(XLIBS) -to_vcd: to_vcd.o database.o event.o handler.o utils.o config.o \ +to_vcd: to_vcd.o database.o event.o handler.o utils.o configuration.o \ logger/logger.a filter/filter.a $(CC) $(CFLAGS) -o to_vcd $^ $(LIBS) macpdu2wireshark: macpdu2wireshark.o database.o utils.o handler.o event.o \ - config.o + configuration.o $(CC) $(CFLAGS) -o $@ $^ $(LIBS) -multi: multi.o utils.o database.o config.o +multi: multi.o utils.o database.o configuration.o $(CC) $(CFLAGS) -o multi $^ $(LIBS) -gnb: utils.o gnb.o database.o event.o handler.o config.o \ +gnb: utils.o gnb.o database.o event.o handler.o configuration.o \ view/view.a gui/gui.a logger/logger.a \ filter/filter.a $(CC) $(CFLAGS) -o gnb $^ $(LIBS) $(XLIBS) diff --git a/common/utils/T/tracer/config.c b/common/utils/T/tracer/configuration.c similarity index 97% rename from common/utils/T/tracer/config.c rename to common/utils/T/tracer/configuration.c index 723902ec9c..701043c05e 100644 --- a/common/utils/T/tracer/config.c +++ b/common/utils/T/tracer/configuration.c @@ -1,4 +1,4 @@ -#include "config.h" +#include "configuration.h" #include #include #include diff --git a/common/utils/T/tracer/config.h b/common/utils/T/tracer/configuration.h similarity index 100% rename from common/utils/T/tracer/config.h rename to common/utils/T/tracer/configuration.h diff --git a/common/utils/T/tracer/enb.c b/common/utils/T/tracer/enb.c index ea499a68f8..9a4751b67e 100644 --- a/common/utils/T/tracer/enb.c +++ b/common/utils/T/tracer/enb.c @@ -14,7 +14,7 @@ #include "utils.h" #include "event_selector.h" #include "openair_logo.h" -#include "config.h" +#include "configuration.h" /****************************************************************************/ /* conversion from rnti to "ue_id" (which does not really exists) */ diff --git a/common/utils/T/tracer/event.c b/common/utils/T/tracer/event.c index f5d12e472c..41da5c0823 100644 --- a/common/utils/T/tracer/event.c +++ b/common/utils/T/tracer/event.c @@ -1,7 +1,7 @@ #include "event.h" #include "database.h" #include "utils.h" -#include "config.h" +#include "configuration.h" #include #include #include diff --git a/common/utils/T/tracer/extract.c b/common/utils/T/tracer/extract.c index bd1649a31a..fe3177b74a 100644 --- a/common/utils/T/tracer/extract.c +++ b/common/utils/T/tracer/extract.c @@ -4,7 +4,7 @@ #include #include "database.h" #include "event.h" -#include "config.h" +#include "configuration.h" void usage(void) { diff --git a/common/utils/T/tracer/extract_input_subframe.c b/common/utils/T/tracer/extract_input_subframe.c index 48e3ec07f9..78bc288df1 100644 --- a/common/utils/T/tracer/extract_input_subframe.c +++ b/common/utils/T/tracer/extract_input_subframe.c @@ -4,7 +4,7 @@ #include #include "database.h" #include "event.h" -#include "config.h" +#include "configuration.h" void usage(void) { diff --git a/common/utils/T/tracer/extract_output_subframe.c b/common/utils/T/tracer/extract_output_subframe.c index d7f9ff95ed..5c5abb768e 100644 --- a/common/utils/T/tracer/extract_output_subframe.c +++ b/common/utils/T/tracer/extract_output_subframe.c @@ -4,7 +4,7 @@ #include #include "database.h" #include "event.h" -#include "config.h" +#include "configuration.h" void usage(void) { diff --git a/common/utils/T/tracer/gnb.c b/common/utils/T/tracer/gnb.c index 6629a1efd6..a2953cb00d 100644 --- a/common/utils/T/tracer/gnb.c +++ b/common/utils/T/tracer/gnb.c @@ -6,7 +6,7 @@ #include "database.h" #include "event.h" #include "handler.h" -#include "config.h" +#include "configuration.h" #include "logger/logger.h" #include "gui/gui.h" #include "utils.h" diff --git a/common/utils/T/tracer/hacks/Makefile b/common/utils/T/tracer/hacks/Makefile index af2663e48f..f345bb4499 100644 --- a/common/utils/T/tracer/hacks/Makefile +++ b/common/utils/T/tracer/hacks/Makefile @@ -5,18 +5,18 @@ LIBS=-lX11 -lm -lpng -lXft all: dump_nack_signal time_meas timeplot multi-rru-clean -dump_nack_signal: ../utils.o ../database.o ../config.o ../event.o \ +dump_nack_signal: ../utils.o ../database.o ../configuration.o ../event.o \ dump_nack_signal.o $(CC) $(CFLAGS) -o dump_nack_signal $^ $(LIBS) -time_meas: ../utils.o ../database.o ../config.o ../event.o \ +time_meas: ../utils.o ../database.o ../configuration.o ../event.o \ time_meas.o $(CC) $(CFLAGS) -o time_meas $^ $(LIBS) timplot: timeplot.o $(CC) $(CFLAGS) -o timeplot $^ $(LIBS) -multi-rru-clean: ../utils.o ../database.o ../event.o ../config.o multi-rru-clean.o +multi-rru-clean: ../utils.o ../database.o ../event.o ../configuration.o multi-rru-clean.o $(CC) $(CFLAGS) -o $@ $^ $(LIBS) .PHONY: all diff --git a/common/utils/T/tracer/macpdu2wireshark.c b/common/utils/T/tracer/macpdu2wireshark.c index 195bf33335..02720e01f3 100644 --- a/common/utils/T/tracer/macpdu2wireshark.c +++ b/common/utils/T/tracer/macpdu2wireshark.c @@ -7,7 +7,7 @@ #include "database.h" #include "event.h" #include "handler.h" -#include "config.h" +#include "configuration.h" #include "utils.h" #include "packet-mac-lte.h" diff --git a/common/utils/T/tracer/multi.c b/common/utils/T/tracer/multi.c index 6a9de838c6..73fadc37d3 100644 --- a/common/utils/T/tracer/multi.c +++ b/common/utils/T/tracer/multi.c @@ -8,7 +8,7 @@ #include "database.h" #include "utils.h" #include "../T.h" -#include "config.h" +#include "configuration.h" #define DEFAULT_LOCAL_PORT 2022 diff --git a/common/utils/T/tracer/record.c b/common/utils/T/tracer/record.c index a565884e52..e4c059a5ca 100644 --- a/common/utils/T/tracer/record.c +++ b/common/utils/T/tracer/record.c @@ -6,7 +6,7 @@ #include "database.h" #include "utils.h" #include "../T_defs.h" -#include "config.h" +#include "configuration.h" void usage(void) { diff --git a/common/utils/T/tracer/textlog.c b/common/utils/T/tracer/textlog.c index 99cddaf43a..71a928ce80 100644 --- a/common/utils/T/tracer/textlog.c +++ b/common/utils/T/tracer/textlog.c @@ -11,7 +11,7 @@ #include "gui/gui.h" #include "utils.h" #include "event_selector.h" -#include "config.h" +#include "configuration.h" typedef struct { int socket; diff --git a/common/utils/T/tracer/to_vcd.c b/common/utils/T/tracer/to_vcd.c index a3c13aebf9..be3c839115 100644 --- a/common/utils/T/tracer/to_vcd.c +++ b/common/utils/T/tracer/to_vcd.c @@ -8,7 +8,7 @@ #include "database.h" #include "utils.h" #include "handler.h" -#include "config.h" +#include "configuration.h" #include "logger/logger.h" #include "view/view.h" diff --git a/common/utils/T/tracer/ue.c b/common/utils/T/tracer/ue.c index bafa0384f2..31584e0215 100644 --- a/common/utils/T/tracer/ue.c +++ b/common/utils/T/tracer/ue.c @@ -14,7 +14,7 @@ #include "utils.h" #include "event_selector.h" #include "openair_logo.h" -#include "config.h" +#include "configuration.h" typedef struct { view *phyview; diff --git a/common/utils/T/tracer/vcd.c b/common/utils/T/tracer/vcd.c index d4faa5fd84..c57798c4c4 100644 --- a/common/utils/T/tracer/vcd.c +++ b/common/utils/T/tracer/vcd.c @@ -11,7 +11,7 @@ #include "gui/gui.h" #include "utils.h" #include "event_selector.h" -#include "config.h" +#include "configuration.h" typedef struct { int socket; diff --git a/common/utils/config.h b/common/utils/config.h index 6d15a309c9..91aabe1347 100644 --- a/common/utils/config.h +++ b/common/utils/config.h @@ -22,12 +22,15 @@ #ifndef UTILS_CONFIG_H_ASN1 #define UTILS_CONFIG_H_ASN1 -// This is hard coded file name "config.h" and HAVE_CONFIG_H_ in asn1c skeletons +// This is hard coded file name "config.h" in asn1c skeletons /* * This file "config.h" will be used by asn1c if HAVE_CONFIG_H_ is defined and - * included. This logs asn1c encoder and decoder traces at execution time using - * the regular OAI logging system, i.e., LOG_I(ASN1...); + * included (this is the case for OAI). + * This allows to trace the asn1c encoder and decoder at execution time using + * the regular OAI logging system, i.e., LOG_I(ASN1, ...); + * + * to enable it, at compilation time, see ./build_oai --enable-asn1c-debug * * As it is very verbose, note that you can change the log level per module in * source or in gdb, e.g., to only activate it for a short time. @@ -47,7 +50,7 @@ */ #include "common/utils/LOG/log.h" -#if DEBUG_ASN1C +#if TRACE_ASN1C_ENC_DEC #define ASN_DEBUG(x...) do{ LOG_I(ASN1,x);LOG_I(ASN1,"\n"); } while(false) #else #define ASN_DEBUG(x...)