[llvm-bugs] [Bug 32297] New: LLDB stopping before function arguments have been initialized

via llvm-bugs llvm-bugs at lists.llvm.org
Wed Mar 15 18:56:48 PDT 2017


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

            Bug ID: 32297
           Summary: LLDB stopping before function arguments have been
                    initialized
           Product: compiler-rt
           Version: 4.0
          Hardware: Macintosh
                OS: MacOS X
            Status: NEW
          Severity: normal
          Priority: P
         Component: compiler-rt
          Assignee: unassignedbugs at nondot.org
          Reporter: tblodt at icloud.com
                CC: llvm-bugs at lists.llvm.org

Compile this test program with -fsanitize=address -g:

struct foo {
    int foof;
};

struct bar {
    struct foo barf;
};

void baz(struct bar *bar) {
    struct foo foof = bar->barf;
}

int main() {
    struct bar bar = {};
    baz(&bar);
    return 0;
}

Then start lldb and do this:

(lldb) b baz
Breakpoint 1: where = morph`baz + 41 at generator.c:9, address =
0x0000000100000c49
(lldb) r
Process 45496 launched: '/Users/tbodt/Developer/csc180/fuck/morph' (x86_64)
AddressSanitizer debugger support is active. Memory error breakpoint has been
installed and you can now use the 'memory history' command.
Process 45496 stopped
* thread #1: tid = 0x13ab09, 0x0000000100000c49
morph`baz(bar=0x00007fff5fbff860) + 41 at generator.c:9, queue =
'com.apple.main-thread', stop reason = breakpoint 1.1
    frame #0: 0x0000000100000c49 morph`baz(bar=0x00007fff5fbff860) + 41 at
generator.c:9
   6        struct foo barf;
   7    };
   8
-> 9    void baz(struct bar *bar) {
   10       struct foo foof = bar->barf;
   11   }
   12
(lldb) p bar
(bar *) $0 = 0x00007fff5fbff860
(lldb) up
frame #1: 0x0000000100000e5a morph`main + 234 at generator.c:15
   12
   13   int main() {
   14       struct bar bar = {};
-> 15       baz(&bar);
   16       return 0;
   17   }
   18
(lldb) p &bar
warning: could not load any Objective-C class information. This will
significantly reduce the quality of type information available.
(bar *) $1 = 0x00007fff5fbff840

Notice that when the program stops the arrow is pointing to the top of the
function declaration, not the first line of the function. Also notice that at
that point, bar is not the pointer that was passed into the function. If you
step once in baz, it goes to the first line of the function and bar is now
correct.

I'm not sure whether the bug is ASAN generating code that LLDB can't handle, or
LLDB not correctly handling the code ASAN generates.

-- 
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/20170316/456f9d5b/attachment.html>


More information about the llvm-bugs mailing list