mirror of
https://github.com/ddnet/ddnet.git
synced 2024-11-10 01:58:19 +00:00
3107: Log close error to console r=Jupeyy a=def- 3155: Add memcheck/asan/ubsan to readme r=Jupeyy a=def- To be linked from https://github.com/ddnet/ddnet/pull/3133 Co-authored-by: def <dennis@felsin9.de>
This commit is contained in:
commit
b17fb2827c
19
README.md
19
README.md
|
@ -111,6 +111,25 @@ sudo cp *.a /usr/lib
|
||||||
To run the tests you must target `run_tests` with make:
|
To run the tests you must target `run_tests` with make:
|
||||||
`make run_tests`
|
`make run_tests`
|
||||||
|
|
||||||
|
Using AddressSanitizer + UndefinedBehaviourSanitizer or Valgrind's Memcheck
|
||||||
|
---------------------------------------------------------------------------
|
||||||
|
ASan+UBSan and Memcheck are useful to find code problems more easily. Please use them to test your changes if you can.
|
||||||
|
|
||||||
|
For ASan+UBSan compile with:
|
||||||
|
```bash
|
||||||
|
CC=clang CXX=clang++ CXXFLAGS="-fsanitize=address,undefined -fsanitize-recover=address,undefined -fno-omit-frame-pointer" CFLAGS="-fsanitize=address,undefined -fsanitize-recover=address,undefined -fno-omit-frame-pointer" cmake -DCMAKE_BUILD_TYPE=Debug .
|
||||||
|
make
|
||||||
|
```
|
||||||
|
and run with:
|
||||||
|
```bash
|
||||||
|
UBSAN_OPTIONS=log_path=./SAN:print_stacktrace=1:halt_on_errors=0 ASAN_OPTIONS=log_path=./SAN:print_stacktrace=1:check_initialization_order=1:detect_leaks=1:halt_on_errors=0 ./DDNet
|
||||||
|
```
|
||||||
|
|
||||||
|
Check the SAN.\* files afterwards. This finds more problems than memcheck, runs faster, but requires a modern GCC/Clang compiler.
|
||||||
|
|
||||||
|
For valgrind's memcheck compile a normal Debug build and run with: `valgrind --tool=memcheck ./DDNet`
|
||||||
|
Expect a large slow down.
|
||||||
|
|
||||||
Building on Windows with Visual Studio
|
Building on Windows with Visual Studio
|
||||||
--------------------------------------
|
--------------------------------------
|
||||||
|
|
||||||
|
|
|
@ -287,6 +287,7 @@ int CGetFile::OnCompletion(int State)
|
||||||
{
|
{
|
||||||
if(m_File && io_close(m_File) != 0)
|
if(m_File && io_close(m_File) != 0)
|
||||||
{
|
{
|
||||||
|
dbg_msg("http", "i/o error, cannot close file: %s", m_aDest);
|
||||||
State = HTTP_ERROR;
|
State = HTTP_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue