master
Xavier Arteaga 7 years ago
commit f377b12f91

@ -163,6 +163,8 @@ int main(int argc, char **argv) {
float cfo = 0; float cfo = 0;
bool acks[SRSLTE_MAX_CODEWORDS] = {false}; bool acks[SRSLTE_MAX_CODEWORDS] = {false};
srslte_debug_handle_crash(argc, argv);
if (parse_args(&prog_args, argc, argv)) { if (parse_args(&prog_args, argc, argv)) {
exit(-1); exit(-1);
} }

@ -153,6 +153,8 @@ int main(int argc, char **argv) {
uint32_t freq; uint32_t freq;
uint32_t n_found_cells=0; uint32_t n_found_cells=0;
srslte_debug_handle_crash(argc, argv);
parse_args(argc, argv); parse_args(argc, argv);
printf("Opening RF device...\n"); printf("Opening RF device...\n");

@ -701,6 +701,8 @@ int main(int argc, char **argv) {
srslte_refsignal_t csr_refs; srslte_refsignal_t csr_refs;
srslte_refsignal_t mbsfn_refs; srslte_refsignal_t mbsfn_refs;
srslte_debug_handle_crash(argc, argv);
#ifdef DISABLE_RF #ifdef DISABLE_RF
if (argc < 3) { if (argc < 3) {
usage(argv[0]); usage(argv[0]);

@ -341,6 +341,8 @@ int main(int argc, char **argv) {
int sfn_offset; int sfn_offset;
float cfo = 0; float cfo = 0;
srslte_debug_handle_crash(argc, argv);
parse_args(&prog_args, argc, argv); parse_args(&prog_args, argc, argv);
for (int i = 0; i< SRSLTE_MAX_CODEWORDS; i++) { for (int i = 0; i< SRSLTE_MAX_CODEWORDS; i++) {

@ -70,4 +70,6 @@ SRSLTE_API extern int srslte_verbose;
#define ERROR(_fmt, ...) fprintf(stderr, "[ERROR in %s]:" _fmt "\n", __FUNCTION__, ##__VA_ARGS__) #define ERROR(_fmt, ...) fprintf(stderr, "[ERROR in %s]:" _fmt "\n", __FUNCTION__, ##__VA_ARGS__)
#endif /* CMAKE_BUILD_TYPE==Debug */ #endif /* CMAKE_BUILD_TYPE==Debug */
void srslte_debug_handle_crash(int argc, char **argv);
#endif // DEBUG_H #endif // DEBUG_H

@ -449,7 +449,12 @@ static inline simd_f_t srslte_simd_f_sqrt(simd_f_t a) {
#ifdef HAVE_NEON #ifdef HAVE_NEON
float32x4_t sqrt_reciprocal = vrsqrteq_f32(a); float32x4_t sqrt_reciprocal = vrsqrteq_f32(a);
sqrt_reciprocal = vmulq_f32(vrsqrtsq_f32(vmulq_f32(a,sqrt_reciprocal), sqrt_reciprocal),sqrt_reciprocal); sqrt_reciprocal = vmulq_f32(vrsqrtsq_f32(vmulq_f32(a,sqrt_reciprocal), sqrt_reciprocal),sqrt_reciprocal);
return vmulq_f32(a,sqrt_reciprocal); float32x4_t result = vmulq_f32(a,sqrt_reciprocal);
/* Detect zeros in NEON 1/sqrtf for preventing NaN */
float32x4_t zeros = vmovq_n_f32(0); /* Zero vector */
uint32x4_t mask = vceqq_f32(a, zeros); /* Zero vector mask */
return vbslq_f32(mask, zeros, result); /* Force zero results and return */
#endif /* HAVE_NEON */ #endif /* HAVE_NEON */
#endif /* LV_HAVE_SSE */ #endif /* LV_HAVE_SSE */
#endif /* LV_HAVE_AVX2 */ #endif /* LV_HAVE_AVX2 */

@ -24,7 +24,14 @@
* *
*/ */
#include <pthread.h>
#include <stdio.h>
#include <execinfo.h>
#include <signal.h>
#include <stdlib.h>
#include "srslte/phy/utils/debug.h" #include "srslte/phy/utils/debug.h"
#include "srslte/version.h"
int srslte_verbose = 0; int srslte_verbose = 0;
@ -37,3 +44,57 @@ void get_time_interval(struct timeval * tdata) {
tdata[0].tv_usec += 1000000; tdata[0].tv_usec += 1000000;
} }
} }
const static char crash_file_name[] = "./srsLTE.backtrace.crash";
static int bt_argc;
static char **bt_argv;
static void crash_handler(int sig) {
void *array[128];
int size;
/* Get all stack traces */
size = backtrace(array, 128);
FILE *f = fopen(crash_file_name, "a");
if (!f) {
printf("srsLTE crashed... we could not save backtrace in '%s'...\n", crash_file_name);
} else {
char **symbols = backtrace_symbols(array, size);
time_t lnTime;
struct tm *stTime;
char strdate[32];
time(&lnTime);
stTime = localtime(&lnTime);
strftime(strdate, 32, "%d/%m/%Y %H:%M:%S", stTime);
fprintf(f, "--- command='");
for (int i = 0; i < bt_argc; i++) {
fprintf(f, "%s%s", (i == 0) ? "" : " ", bt_argv[i]);
}
fprintf(f, "' version=%s signal=%d date='%s' ---\n", SRSLTE_VERSION_STRING, sig, strdate);
for (int i = 0; i < size; i++) {
fprintf(f, "\t%s\n", symbols[i]);
}
fprintf(f, "\n");
printf("srsLTE crashed... backtrace saved in '%s'...\n", crash_file_name);
fclose(f);
}
printf("--- exiting ---\n");
exit(1);
}
void srslte_debug_handle_crash(int argc, char **argv) {
bt_argc = argc;
bt_argv = argv;
signal(SIGSEGV, crash_handler);
signal(SIGABRT, crash_handler);
signal(SIGILL, crash_handler);
signal(SIGFPE, crash_handler);
}

@ -502,6 +502,7 @@ TEST(srslte_vec_abs_cf,
for (int i = 0; i < block_size; i++) { for (int i = 0; i < block_size; i++) {
x[i] = RANDOM_CF(); x[i] = RANDOM_CF();
} }
x[0] = 0.0f;
TEST_CALL(srslte_vec_abs_cf(x, z, block_size)) TEST_CALL(srslte_vec_abs_cf(x, z, block_size))

@ -353,6 +353,8 @@ int main(int argc, char *argv[])
metrics_stdout metrics; metrics_stdout metrics;
enb *enb = enb::get_instance(); enb *enb = enb::get_instance();
srslte_debug_handle_crash(argc, argv);
cout << "--- Software Radio Systems LTE eNodeB ---" << endl << endl; cout << "--- Software Radio Systems LTE eNodeB ---" << endl << endl;
parse_args(&args, argc, argv); parse_args(&args, argc, argv);

@ -374,6 +374,9 @@ int main(int argc, char *argv[])
srslte::metrics_hub<ue_metrics_t> metricshub; srslte::metrics_hub<ue_metrics_t> metricshub;
signal(SIGINT, sig_int_handler); signal(SIGINT, sig_int_handler);
all_args_t args; all_args_t args;
srslte_debug_handle_crash(argc, argv);
parse_args(&args, argc, argv); parse_args(&args, argc, argv);
srsue_instance_type_t type = LTE; srsue_instance_type_t type = LTE;

Loading…
Cancel
Save