FS#40223 - [gcc] [gdb] Compiling with AddressSanitizer with 4.9 breaks printng some variables in gdb
Attached to Project:
Arch Linux
Opened by Krzysztof Kundzicz (Athantor) - Monday, 05 May 2014, 11:16 GMT
Last edited by Allan McRae (Allan) - Saturday, 20 February 2016, 02:21 GMT
Opened by Krzysztof Kundzicz (Athantor) - Monday, 05 May 2014, 11:16 GMT
Last edited by Allan McRae (Allan) - Saturday, 20 February 2016, 02:21 GMT
|
Details
Description:
With certain configurations of variables on function's stack, when debugging 32bit binary compiled with '-fsanitize=address', some variables in gdb are printed out as '<optimized out>' despite passing '-O0 -ggdb3' in compilation switches. Problem occurres only when debugging 32bit binary; 64bit works OK. It doesn't matter if I'm cross compiling it 64b→32b nor if I compile it natively on i386 version of Arch. It was working OK with gcc <4.9. Additional info: gcc-multilib 4.9.0-1 / gcc 4.9.0-1 gdb 7.7-1 glibc 2.19-4 binutils 2.24-3 Linux kk 3.14.2-1-ARCH #1 SMP PREEMPT Sun Apr 27 11:28:44 CEST 2014 x86_64 GNU/Linux Steps to reproduce: Compile attached source file with gcc -m32 -Wall -Wextra -Wno-unused-variable -fsanitize=address -ggdb3 -O0 -o test test.c and gdb it with: gdb --ex 'b main' --ex 'r' --ex 'p d' --ex 'q' ./test If you'll compile with ASAN, gdb will show that variable 'd' is optimized out despite '-O0' in gcc switches: Breakpoint 1, main () at test.c:10 10 int d = 4; $1 = <optimized out> remove '-fsanitize=address' from switches and gdb works as it should (ignore uninitialized value): Breakpoint 1, main () at test.c:10 10 int d = 4; $1 = 134513883 What's funny if I'll remove zeroing of the 't' array or decrease its size to 36B, then gdb starts to print 'd' OK. In both cases debug info about the 'd' variable seems to be present in the binary: <2><be>: Abbrev Number: 8 (DW_TAG_variable) <bf> DW_AT_name : d <c1> DW_AT_decl_file : 1 <c2> DW_AT_decl_line : 11 <c3> DW_AT_type : <0x53> |
This task depends upon
Could you please send this message to ASAN maillist https://groups.google.com/forum/#!forum/address-sanitizer
And/or to GCC community as well?
https://code.google.com/p/address-sanitizer/issues/detail?id=390