1
0
Fork 0
mirror of https://github.com/ossrs/srs.git synced 2025-03-09 15:49:59 +00:00

Asan: Set asan loging callback. v5.0.104

This commit is contained in:
chengh 2022-12-04 22:20:59 +08:00 committed by winlin
parent 41769308d2
commit 8be4c8e334
6 changed files with 39 additions and 1 deletions

View file

@ -9,6 +9,6 @@
#define VERSION_MAJOR 5
#define VERSION_MINOR 0
#define VERSION_REVISION 103
#define VERSION_REVISION 104
#endif

View file

@ -24,6 +24,10 @@ using namespace std;
#include <gperftools/malloc_extension.h>
#endif
#ifdef SRS_SANITIZER_LOG
#include <sanitizer/asan_interface.h>
#endif
#include <unistd.h>
using namespace std;
@ -77,6 +81,13 @@ const char* _srs_binary = NULL;
// Free global data, for address sanitizer.
extern void srs_free_global_system_ips();
#ifdef SRS_SANITIZER_LOG
void asan_report_callback(const char* str)
{
srs_trace("%s", str);
}
#endif
/**
* main entrance.
*/
@ -221,6 +232,10 @@ srs_error_t do_main(int argc, char** argv, char** envp)
srs_trace("tcmalloc: set release-rate %.2f=>%.2f", otrr, trr);
}
#endif
#ifdef SRS_SANITIZER_LOG
__asan_set_error_report_callback(asan_report_callback);
#endif
if ((err = run_directly_or_daemon()) != srs_success) {
return srs_error_wrap(err, "run");