Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test_step_out_of_malloc_into_function_b_with_dwarf (TestThreadAPI.ThreadAPITestCase) fails with FreeBSD malloc #18318

Closed
emaste opened this issue Nov 15, 2013 · 3 comments
Assignees
Labels
bugzilla Issues migrated from bugzilla lldb

Comments

@emaste
Copy link
Member

emaste commented Nov 15, 2013

Bugzilla Link 17944
Resolution FIXED
Resolved on Mar 07, 2014 13:02
Version unspecified
OS FreeBSD

Extended Description

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.7malloc [inlined] malloc_init at malloc.c:5397, stop reason = breakpoint 1.1 frame #​0: 0x0000000800dda809 libc.so.7malloc [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.7malloc [inlined] malloc_init at malloc.c:5397, stop reason = breakpoint 1.1 frame #​0: 0x0000000800dda809 libc.so.7malloc [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.7malloc [inlined] malloc_init at malloc.c:5397, stop reason = breakpoint 1.1 frame #​0: 0x0000000800dda809 libc.so.7malloc [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.

@emaste
Copy link
Member Author

emaste commented Nov 15, 2013

assigned to @emaste

@emaste
Copy link
Member Author

emaste commented Nov 15, 2013

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.7malloc [inlined] malloc_init at malloc.c:5397 frame #​1: 0x0000000800dda809 libc.so.7malloc(size=1024) + 9 at malloc.c:5949
      frame #​2: 0x00000000008006e5 a.outb(val=1) + 37 at main2.cpp:29 frame #​3: 0x0000000000800680 a.outa(val=1) + 32 at main2.cpp:19
      frame #​4: 0x0000000000800772 a.outmain(argc=1, argv=0x00007fffffffd510) + 34 at main2.cpp:44 frame #​5: 0x00000000008005d1 a.out_start(ap=, cleanup=) + 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 }

@emaste
Copy link
Member Author

emaste commented Mar 7, 2014

Fixed in:

Sending test/python_api/thread/TestThreadAPI.py
Transmitting file data .
Committed revision 203268.

@llvmbot llvmbot transferred this issue from llvm/llvm-bugzilla-archive Dec 9, 2021
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bugzilla Issues migrated from bugzilla lldb
Projects
None yet
Development

No branches or pull requests

1 participant