Bug 513131

Summary: Failure to attach to a process
Product: [Applications] Heaptrack Reporter: dev
Component: generalAssignee: Milian Wolff <mail>
Status: REPORTED ---    
Severity: normal    
Priority: NOR    
Version First Reported In: 1.2.0   
Target Milestone: ---   
Platform: Debian stable   
OS: Linux   
Latest Commit: Version Fixed/Implemented In:
Sentry Crash Report:

Description dev 2025-12-09 16:40:19 UTC
I'm unable to attach to a Rust process using `sudo heaptrack -p <PID>` with the following error:
```
heaptrack output will be written to "/home/<user>/heaptrack.<executable>.<pid>.zst"
injecting heaptrack into application via GDB, this might take some time...
syntax error in expression, near `__libc_dlopen_mode("/usr/lib/heaptrack/libheaptrack_inject.so", 0x80000000 | 0x002)'.
syntax error in expression, near `heaptrack_inject("/tmp/heaptrack_fifo<pid>")'.
injection finished
```
However after "injection finished", the heaptrack file is created, but remains empty forever.
I have tried attaching to an instance of vim and that did produce a non-empty trace.
I am running Debian 11 (bullseye) with heaptrack 1.2.0 from the debian repository.
Since the error appears to fail when using GDB to invoke a glibc function, I checked using ldd that the binary in question is linking libc.so.6 and that libc.so.6 includes symbol __libc_dlopen_mode@@GLIBC_PRIVATE.

Unfortunately the only mention of this error I found online is https://kirshatrov.com/posts/finding-memory-leak-in-cgo where the author gave up on using heaptrack after encountering the error.