[llvm-bugs] [Bug 26673] New: Wrong debugging information with -fsanitize=address (and memset?)

via llvm-bugs llvm-bugs at lists.llvm.org
Fri Feb 19 14:58:33 PST 2016


https://llvm.org/bugs/show_bug.cgi?id=26673

            Bug ID: 26673
           Summary: Wrong debugging information with -fsanitize=address
                    (and memset?)
           Product: clang
           Version: 3.7
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: -New Bugs
          Assignee: unassignedclangbugs at nondot.org
          Reporter: peter at lekensteyn.nl
                CC: llvm-bugs at lists.llvm.org
    Classification: Unclassified

Created attachment 15921
  --> https://llvm.org/bugs/attachment.cgi?id=15921&action=edit
Minimal test case (with commands and output in comments)

Since a while (months), Clang with ASAN on Arch Linux generates objects which
have wrong debugging information. The addresses seems incorrect and will result
in wrong debugging output.

I have reduced it to a function containing a memset (printf does not trigger
the issue for example). See the following output (argc is expected to be 1,
argv an address like 0x7fffffffe418).

$ clang -fsanitize=address -g test.c && gdb -ex start -batch ./a.out
Temporary breakpoint 1 at 0x4d8ce7: file test.c, line 15.
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/usr/lib/libthread_db.so.1".

Temporary breakpoint 1, main (argc=4289312, argv=0x4d8e6d <__libc_csu_init+77>)
at test.c:35
35      int main(int argc, char *argv[]) {

$ lldb ./a.out
(lldb) target create "./a.out"
Current executable set to './a.out' (x86_64).
(lldb) breakpoint set -name main
Breakpoint 1: where = a.out`main + 23 at test.c:35, address =
0x00000000004d8ce7
(lldb) r
AddressSanitizer debugger support is active. Memory error breakpoint has been
installed and you can now use the 'memory history' command.
Process 4799 launched: './a.out' (x86_64)
Process 4799 stopped
* thread #1: tid = 4919, 0x00000000004d8ce7 a.out`main(argc=4289312,
argv=0x00000000004d8e6d) + 23 at test.c:35, name = 'a.out', stop reason =
breakpoint 1.1
    frame #0: 0x00000000004d8ce7 a.out`main(argc=4289312,
argv=0x00000000004d8e6d) + 23 at test.c:35
   32   */
   33   extern void *memset(void *, int, unsigned long);
   34  
-> 35   int main(int argc, char *argv[]) {
   36       int action;
   37       memset(&action, 0, sizeof(action));
   38       return 0;

$ pacman -Q clang lldb gdb
clang 3.7.1-1
lldb 3.7.1-1
gdb 7.10.1-1

$ clang --version
clang version 3.7.1 (tags/RELEASE_371/final)
Target: x86_64-unknown-linux-gnu
Thread model: posix

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20160219/2715cd5a/attachment.html>


More information about the llvm-bugs mailing list