diff options
author | Harald Welte <laforge@osmocom.org> | 2021-04-04 11:16:58 +0200 |
---|---|---|
committer | Harald Welte <laforge@osmocom.org> | 2021-04-04 11:16:58 +0200 |
commit | a82fe56aea7c879970551ac48367ec6aa259044d (patch) | |
tree | 3d2a5056b36102f8055f955133bea153bbe1c31f /contrib | |
parent | 949c23796302eeccb63670daa1e9802b692fca51 (diff) |
e1d-prbs-test: Initialize libosmocore logging
Fixes the following crash when libosmo-e1d wants to log something:
ERROR: osmo_log_info == NULL! You must call log_init() before using logging in log_check_level()!
Assert failed osmo_log_info logging.c:299
backtrace() returned 13 addresses
/usr/local/lib/libosmocore.so.17(osmo_generate_backtrace+0x1c) [0x7ff4ed29d6cf]
/usr/local/lib/libosmocore.so.17(+0x263c7) [0x7ff4ed29d3c7]
/usr/local/lib/libosmocore.so.17(osmo_panic+0xe0) [0x7ff4ed29d4ac]
/usr/local/lib/libosmocore.so.17(assert_loginfo+0x74) [0x7ff4ed298f57]
/usr/local/lib/libosmocore.so.17(log_check_level+0x1e) [0x7ff4ed29b091]
/usr/local/lib/libosmo-e1d.so.1(osmo_e1dp_send+0xf2) [0x7ff4ed2727a2]
/usr/local/lib/libosmo-e1d.so.1(+0x19d4) [0x7ff4ed2729d4]
/usr/local/lib/libosmo-e1d.so.1(+0x1c37) [0x7ff4ed272c37]
/usr/local/lib/libosmo-e1d.so.1(osmo_e1dp_client_ts_open+0x1d) [0x7ff4ed2730ed]
./e1-prbs-test(+0x1841) [0x55e00daeb841]
/lib/x86_64-linux-gnu/libc.so.6(__libc_start_main+0xf3) [0x7ff4ed0a60b3]
./e1-prbs-test(+0x192e) [0x55e00daeb92e]
Aborted
Change-Id: Ia305b008711c15383c84f7cf2acedd20b568ef8a
Diffstat (limited to 'contrib')
-rw-r--r-- | contrib/e1-prbs-test/main.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/contrib/e1-prbs-test/main.c b/contrib/e1-prbs-test/main.c index c65fcc6..d0809bf 100644 --- a/contrib/e1-prbs-test/main.c +++ b/contrib/e1-prbs-test/main.c @@ -39,6 +39,7 @@ #include <osmocom/core/utils.h> #include <osmocom/core/bits.h> #include <osmocom/core/prbs.h> +#include <osmocom/core/application.h> #include <osmocom/e1d/proto_clnt.h> @@ -238,6 +239,7 @@ int main(int argc, char **argv) { char *basedir; int rc; + void *g_ctx; handle_options(argc, argv); @@ -248,6 +250,10 @@ int main(int argc, char **argv) } basedir = argv[optind]; + g_ctx = talloc_named_const(NULL, 0, "g_ctx"); + OSMO_ASSERT(g_ctx); + osmo_init_logging2(g_ctx, NULL); + set_realtime(10); rc = open_slots(&g_tst, basedir); if (rc < 0) |