Arch Linux

Please read this before reporting a bug:
https://wiki.archlinux.org/title/Bug_reporting_guidelines

Do NOT report bugs when a package is just outdated, or it is in the AUR. Use the 'flag out of date' link on the package page, or the Mailing List.

REPEAT: Do NOT report bugs for outdated packages!
Tasklist

FS#76435 - [glibc] mtrace() not working

Attached to Project: Arch Linux
Opened by Raman Mohan (mohan43u) - Saturday, 05 November 2022, 19:48 GMT
Task Type Bug Report
Category Packages: Core
Status Assigned
Assigned To freswa (frederik)
Architecture x86_64
Severity Medium
Priority Normal
Reported Version
Due in Version Undecided
Due Date Undecided
Percent Complete 0%
Votes 0
Private No

Details

Description:
mtrace() suppose to use MALLOC_TRACE environment variable to open the trace file and add trace about head memory usage. but its not happening. I also added '#define _GNU_SOURCE' at the beginning, not working

example test.c:

#define _GNU_SOURCE
#include <mcheck.h>

int main(int argc, char *argv[]) {
char *buffer = NULL;
buffer = calloc(1, 1000);
free(buffer);
return 0;
}

compile:
$ gcc -o test test.c

command which I used to run the test:
$ (export MALLOC_TRACE=$(pwd)/test.mtrace; ./test)

Someone also noticed this here https://stackoverflow.com/questions/74136501/mtrace-doesnt-generate-mtrace-data-file-in-archlinux-but-works-in-debian

Additional info:
* package version(s): 2.36-6
This task depends upon

Comment by freswa (frederik) - Saturday, 05 November 2022, 20:01 GMT
Could you report this upstream please?
Comment by Toolybird (Toolybird) - Saturday, 05 November 2022, 23:28 GMT
It's by design. Please see [1]. I suppose the man page needs updating. You can get it to work by:

$ LD_PRELOAD=/usr/lib/libc_malloc_debug.so ./foo

[1] https://sourceware.org/git/?p=glibc.git;a=blob;f=NEWS;h=a10bb08fb09cf7d323826cc66bdd665232c1ed96;hb=HEAD#l723

Loading...