kopia lustrzana https://github.com/Hamlib/Hamlib
Clean up debug a bit
rodzic
dc1fa7f450
commit
ebedbbbfb5
|
@ -29,7 +29,7 @@
|
||||||
// Our shared secret password
|
// Our shared secret password
|
||||||
#define HAMLIB_SECRET_LENGTH 32
|
#define HAMLIB_SECRET_LENGTH 32
|
||||||
|
|
||||||
#define HAMLIB_TRACE rig_debug(RIG_DEBUG_TRACE,"%s(%d) trace\n", __FILE__, __LINE__)
|
#define HAMLIB_TRACE rig_debug(RIG_DEBUG_TRACE,"%.*s%s(%d) trace\n",rig->state.depth-1, spaces(), __FILE__, __LINE__)
|
||||||
#define __FILENAME__ (strrchr(__FILE__, '/') ? strrchr(__FILE__, '/') + 1 : __FILE__)
|
#define __FILENAME__ (strrchr(__FILE__, '/') ? strrchr(__FILE__, '/') + 1 : __FILE__)
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
@ -3552,7 +3552,7 @@ extern HAMLIB_EXPORT_VAR(char) debugmsgsave3[DEBUGMSGSAVE_SIZE]; // last-2 debu
|
||||||
|
|
||||||
// Measuring elapsed time -- local variable inside function when macro is used
|
// Measuring elapsed time -- local variable inside function when macro is used
|
||||||
#define ELAPSED1 struct timespec __begin; elapsed_ms(&__begin, HAMLIB_ELAPSED_SET);
|
#define ELAPSED1 struct timespec __begin; elapsed_ms(&__begin, HAMLIB_ELAPSED_SET);
|
||||||
#define ELAPSED2 rig_debug(RIG_DEBUG_TRACE, "%.*s%d:%s: elapsed=%.0lfms\n", rig->state.depth, spaces(), rig->state.depth, __func__, elapsed_ms(&__begin, HAMLIB_ELAPSED_GET));
|
#define ELAPSED2 rig_debug(RIG_DEBUG_TRACE, "%.*s%d:%s: elapsed=%.0lfms\n", rig->state.depth-1, spaces(), rig->state.depth, __func__, elapsed_ms(&__begin, HAMLIB_ELAPSED_GET));
|
||||||
|
|
||||||
// use this instead of snprintf for automatic detection of buffer limit
|
// use this instead of snprintf for automatic detection of buffer limit
|
||||||
#define SNPRINTF(s,n,...) { snprintf(s,n,##__VA_ARGS__);if (strlen(s) > n-1) fprintf(stderr,"****** %s(%d): buffer overflow ******\n", __func__, __LINE__); }
|
#define SNPRINTF(s,n,...) { snprintf(s,n,##__VA_ARGS__);if (strlen(s) > n-1) fprintf(stderr,"****** %s(%d): buffer overflow ******\n", __func__, __LINE__); }
|
||||||
|
|
|
@ -158,7 +158,7 @@ extern HAMLIB_EXPORT(char *)date_strget(char *buf, int buflen, int localtime);
|
||||||
void errmsg(int err, char *s, const char *func, const char *file, int line);
|
void errmsg(int err, char *s, const char *func, const char *file, int line);
|
||||||
#define ERRMSG(err, s) errmsg(err, s, __func__, __FILENAME__, __LINE__)
|
#define ERRMSG(err, s) errmsg(err, s, __func__, __FILENAME__, __LINE__)
|
||||||
#define ENTERFUNC { ++rig->state.depth; \
|
#define ENTERFUNC { ++rig->state.depth; \
|
||||||
rig_debug(RIG_DEBUG_VERBOSE, "%.*s%d:%s(%d):%s entered\n", rig->state.depth, spaces(), rig->state.depth, __FILENAME__, __LINE__, __func__); \
|
rig_debug(RIG_DEBUG_VERBOSE, "%.*s%d:%s(%d):%s entered\n", rig->state.depth-1, spaces(), rig->state.depth, __FILENAME__, __LINE__, __func__); \
|
||||||
}
|
}
|
||||||
#define ENTERFUNC2 { rig_debug(RIG_DEBUG_VERBOSE, "%s(%d):%s entered\n", __FILENAME__, __LINE__, __func__); \
|
#define ENTERFUNC2 { rig_debug(RIG_DEBUG_VERBOSE, "%s(%d):%s entered\n", __FILENAME__, __LINE__, __func__); \
|
||||||
}
|
}
|
||||||
|
@ -166,7 +166,7 @@ void errmsg(int err, char *s, const char *func, const char *file, int line);
|
||||||
// could be a function call
|
// could be a function call
|
||||||
#define RETURNFUNC(rc) {do { \
|
#define RETURNFUNC(rc) {do { \
|
||||||
int rctmp = rc; \
|
int rctmp = rc; \
|
||||||
rig_debug(RIG_DEBUG_VERBOSE, "%.*s%d:%s(%d):%s returning(%ld) %s\n", rig->state.depth, spaces(), rig->state.depth, __FILENAME__, __LINE__, __func__, (long int) (rctmp), rctmp<0?rigerror2(rctmp):""); \
|
rig_debug(RIG_DEBUG_VERBOSE, "%.*s%d:%s(%d):%s returning(%ld) %s\n", rig->state.depth-1, spaces(), rig->state.depth, __FILENAME__, __LINE__, __func__, (long int) (rctmp), rctmp<0?rigerror2(rctmp):""); \
|
||||||
if (rig->state.depth == 0) rig_debug(RIG_DEBUG_ERR, "%s(%d) depth=0 ******************\n", __func__, __LINE__); \
|
if (rig->state.depth == 0) rig_debug(RIG_DEBUG_ERR, "%s(%d) depth=0 ******************\n", __func__, __LINE__); \
|
||||||
--rig->state.depth; \
|
--rig->state.depth; \
|
||||||
return (rctmp); \
|
return (rctmp); \
|
||||||
|
|
|
@ -1117,7 +1117,6 @@ int main(int argc, char *argv[])
|
||||||
#ifdef HAVE_PTHREAD
|
#ifdef HAVE_PTHREAD
|
||||||
/* allow threads to finish current action */
|
/* allow threads to finish current action */
|
||||||
mutex_rigctld(1);
|
mutex_rigctld(1);
|
||||||
HAMLIB_TRACE;
|
|
||||||
|
|
||||||
if (client_count)
|
if (client_count)
|
||||||
{
|
{
|
||||||
|
@ -1125,17 +1124,13 @@ int main(int argc, char *argv[])
|
||||||
}
|
}
|
||||||
|
|
||||||
rig_close(my_rig);
|
rig_close(my_rig);
|
||||||
HAMLIB_TRACE;
|
|
||||||
mutex_rigctld(0);
|
mutex_rigctld(0);
|
||||||
HAMLIB_TRACE;
|
|
||||||
#else
|
#else
|
||||||
rig_close(my_rig); /* close port */
|
rig_close(my_rig); /* close port */
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
HAMLIB_TRACE;
|
|
||||||
network_multicast_publisher_stop(my_rig);
|
network_multicast_publisher_stop(my_rig);
|
||||||
|
|
||||||
HAMLIB_TRACE;
|
|
||||||
rig_cleanup(my_rig); /* if you care about memory */
|
rig_cleanup(my_rig); /* if you care about memory */
|
||||||
|
|
||||||
#ifdef __MINGW32__
|
#ifdef __MINGW32__
|
||||||
|
|
|
@ -1103,7 +1103,6 @@ int main(int argc, char *argv[])
|
||||||
#ifdef HAVE_PTHREAD
|
#ifdef HAVE_PTHREAD
|
||||||
/* allow threads to finish current action */
|
/* allow threads to finish current action */
|
||||||
mutex_rigctld(1);
|
mutex_rigctld(1);
|
||||||
HAMLIB_TRACE;
|
|
||||||
|
|
||||||
if (client_count)
|
if (client_count)
|
||||||
{
|
{
|
||||||
|
@ -1111,17 +1110,13 @@ int main(int argc, char *argv[])
|
||||||
}
|
}
|
||||||
|
|
||||||
rig_close(my_rig);
|
rig_close(my_rig);
|
||||||
HAMLIB_TRACE;
|
|
||||||
mutex_rigctld(0);
|
mutex_rigctld(0);
|
||||||
HAMLIB_TRACE;
|
|
||||||
#else
|
#else
|
||||||
rig_close(my_rig); /* close port */
|
rig_close(my_rig); /* close port */
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
HAMLIB_TRACE;
|
|
||||||
network_multicast_publisher_stop(my_rig);
|
network_multicast_publisher_stop(my_rig);
|
||||||
|
|
||||||
HAMLIB_TRACE;
|
|
||||||
rig_cleanup(my_rig); /* if you care about memory */
|
rig_cleanup(my_rig); /* if you care about memory */
|
||||||
|
|
||||||
#ifdef __MINGW32__
|
#ifdef __MINGW32__
|
||||||
|
|
Ładowanie…
Reference in New Issue