Reproducing manually: (lldb) b malloc Breakpoint 1: no locations (pending). WARNING: Unable to resolve breakpoint to any actual locations. (lldb) run Process 64844 launched: '../tools/lldb/test/python_api/thread/a.out' (x86_64) 1 location added to breakpoint 1 Process 64844 stopped * thread #1: tid = 100740, 0x0000000800dda809 libc.so.7`malloc [inlined] malloc_init at malloc.c:5397, stop reason = breakpoint 1.1 frame #0: 0x0000000800dda809 libc.so.7`malloc [inlined] malloc_init at malloc.c:5397 5394 malloc_init(void) 5395 { 5396 -> 5397 if (malloc_initialized == false) 5398 return (malloc_init_hard()); 5399 5400 return (false); (lldb) c Process 64844 resuming Process 64844 stopped * thread #1: tid = 100740, 0x0000000800dda809 libc.so.7`malloc [inlined] malloc_init at malloc.c:5397, stop reason = breakpoint 1.1 frame #0: 0x0000000800dda809 libc.so.7`malloc [inlined] malloc_init at malloc.c:5397 5394 malloc_init(void) 5395 { 5396 -> 5397 if (malloc_initialized == false) 5398 return (malloc_init_hard()); 5399 5400 return (false); (lldb) c Process 64844 resuming ptr=0x801807400 a(1) returns 4 Process 64844 stopped * thread #1: tid = 100740, 0x0000000800dda809 libc.so.7`malloc [inlined] malloc_init at malloc.c:5397, stop reason = breakpoint 1.1 frame #0: 0x0000000800dda809 libc.so.7`malloc [inlined] malloc_init at malloc.c:5397 5394 malloc_init(void) 5395 { 5396 -> 5397 if (malloc_initialized == false) 5398 return (malloc_init_hard()); 5399 5400 return (false); (lldb) c Process 64844 resuming ptr=0x801807800 b(2) returns 5 a(3) returns 6 Process 64844 exited with status = 0 (0x00000000) NB: this test has an @expectedFailureLinux # llvm.org/pr14416 tag That PR is for watchpoints failing on i386 Linux, so perhaps a typo.
Our breakpoint ends up at the inlined malloc_init, so we have an extra frame in bt: (lldb) breakpoint list Current breakpoints: 1: name = 'malloc', locations = 1, resolved = 1, hit count = 1 1.1: where = libc.so.7`malloc + 9 [inlined] malloc_init at malloc.c:5949, address = 0x0000000800dda809, resolved, hit count = 1 (lldb) bt * thread #1: tid = 101976, 0x0000000800dda809 libc.so.7`malloc [inlined] malloc_init at malloc.c:5397, stop reason = breakpoint 1.1 * frame #0: 0x0000000800dda809 libc.so.7`malloc [inlined] malloc_init at malloc.c:5397 frame #1: 0x0000000800dda809 libc.so.7`malloc(size=1024) + 9 at malloc.c:5949 frame #2: 0x00000000008006e5 a.out`b(val=1) + 37 at main2.cpp:29 frame #3: 0x0000000000800680 a.out`a(val=1) + 32 at main2.cpp:19 frame #4: 0x0000000000800772 a.out`main(argc=1, argv=0x00007fffffffd510) + 34 at main2.cpp:44 frame #5: 0x00000000008005d1 a.out`_start(ap=<unavailable>, cleanup=<unavailable>) + 161 at crt1.c:97 malloc.c 5388 /* 5389 * FreeBSD's pthreads implementation calls malloc(3), so the malloc 5390 * implementation has to take pains to avoid infinite recursion during 5391 * initialization. 5392 */ 5393 static inline bool 5394 malloc_init(void) 5395 { 5396 5397 if (malloc_initialized == false) 5398 return (malloc_init_hard()); 5399 5400 return (false); 5401 } 5944 void * 5945 malloc(size_t size) 5946 { 5947 void *ret; 5948 5949 if (malloc_init()) { 5950 ret = NULL; 5951 goto OOM; 5952 }
Fixed in: Sending test/python_api/thread/TestThreadAPI.py Transmitting file data . Committed revision 203268.