Using sanitizers with visual representation
已回答
simple example is here
int global_array[100] = {-1};
int main(int argc, char **argv) {
return global_array[argc + 100]; // global buffer overflow
}
and option:
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fsanitize=address")
sanitizer generates expected output in the console with summary:
0x55733f0411b4 is located 4 bytes to the right of global variable 'global_array' defined in '/home/amigo421/workspace/test1/main.cpp:2:5' (0x55733f041020) of size 400
SUMMARY: AddressSanitizer: global-buffer-overflow /home/amigo421/workspace/test1/main.cpp:6 in main
but if I enable visualize option:
then
what I'm doing wrong? why empty visualization?
version of GDB:
请先登录再写评论。
Hello! Do I understand correctly that you run the application again after enabling the visual representation and get "Nothing to show"? Please send the idea.log file (Help | Show Log in ...) to clion-support at jetbrains.com. Note that logs might contain private user's information (like file paths and names).
hi Anna
thank you for the reply ,
I'll send a log,
just one remark which I found , probably this is correct behavior?
1. Visualization has been switched ON
- nothing in Debug mode
- correct visual representation in Run mode (Shift+F10)
2. Visualization has been switched OFF
- both Debug/Run show correct sanitizer's plain output
Hi Anna,
I'm having the exact same problem. With Visualization switched ON I get no output in either the Console, or Visualization tabs. With Visualization off, I get the full output in the Console tab.
I'm using gcc 9.3.0.
Were you able to solve this problem for Ernst? If so, could you provide the solution here? Or do you need me to gather some more info and send to you?
Thanks,
--Barry
Hi Barry!
Please try using CLion 2020.2 EAP (https://www.jetbrains.com/clion/nextversion/). It seems to work fine in case of Debug on my side. Does it work on your side?
Same issue 2020.2.3
Sanitizer is working and visualization box is checked. GCC is greater than minimum number. Running without GDB.
Maym86 please send your project to clion-support at jetbrains.com so that we could take a look.
The whole project? or just the intellij .idea data?
We need a simple sample project with which the issue can be reproduced on our side. The .idea folder won't be enough.
https://drive.google.com/file/d/1JpGzDdxPByBF3hx_Vbs_UhacZ0VOdHMo/view?usp=sharing
Even this really basic test example has the same behavior.
Mike
Maym86 we can't reproduce the issue with the provided project on our side (Ubuntu, CLion 2020.2.3, gcc-9/gcc-10):
On what OS do you use CLion? What gcc version do you use?
Also please reproduce the issue and after that send the idea.log file (`Help | Show Log in ...`) to clion-support at jetbrains.com. Note that logs might contain private user's information (like file paths and names).
GCC:
maym86@computinator:~$ gcc -v
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-linux-gnu/7/lto-wrapper
OFFLOAD_TARGET_NAMES=nvptx-none
OFFLOAD_TARGET_DEFAULT=1
Target: x86_64-linux-gnu
Configured with: ../src/configure -v --with-pkgversion='Ubuntu 7.5.0-3ubuntu1~18.04' --with-bugurl=file:///usr/share/doc/gcc-7/README.Bugs --enable-languages=c,ada,c++,go,brig,d,fortran,objc,obj-c++ --prefix=/usr --with-gcc-major-version-only --program-suffix=-7 --program-prefix=x86_64-linux-gnu- --enable-shared --enable-linker-build-id --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --libdir=/usr/lib --enable-nls --enable-bootstrap --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --with-default-libstdcxx-abi=new --enable-gnu-unique-object --disable-vtable-verify --enable-libmpx --enable-plugin --enable-default-pie --with-system-zlib --with-target-system-zlib --enable-objc-gc=auto --enable-multiarch --disable-werror --with-arch-32=i686 --with-abi=m64 --with-multilib-list=m32,m64,mx32 --enable-multilib --with-tune=generic --enable-offload-targets=nvptx-none --without-cuda-driver --enable-checking=release --build=x86_64-linux-gnu --host=x86_64-linux-gnu --target=x86_64-linux-gnu
Thread model: posix
gcc version 7.5.0 (Ubuntu 7.5.0-3ubuntu1~18.04)
LOG:
https://drive.google.com/file/d/1H4wMa9K2whxm7Sb2Nf71okTT9csqGzVe/view?usp=sharing
Maym86 please comment or upvote https://youtrack.jetbrains.com/issue/CPP-13813 in order to get updates. See https://intellij-support.jetbrains.com/hc/en-us/articles/207241135-How-to-follow-YouTrack-issues-and-receive-notifications if you are not familiar with YouTrack.