https://bugs.kde.org/show_bug.cgi?id=428689
--- Comment #3 from Andrew Somerville <andy.somervi...@gmail.com> --- It would seem that it might be possible to search the call stack some small number of frames for function names matching a regex and find allocators for type T and then lookup the sizeof info for T in the DWARF table, then divide the malloc byte number by that sizeof for a number of objects allocated. Alternatively to the `sizeof` lookup a similar trick might be done by searching the call stack and find an earlier allocation function which was passed the number of object to allocate and use the same division. Unfortunately it seems this is a bit more complicated: Perhaps unsurprisingly getting the function call arguments more-or-less requires dwarf info. https://nikhilism.com/post/2019/retrieving-function-arguments-while-unwinding-the-stack/ I tried the idea in gdb and here's an example where `bytes` (F0) can be divided by `__n` (F2) but the pattern of `new_allocator<>::allocate` 2 frames above malloc would have to be detected: (gdb) bt #0 SP in __GI___libc_malloc (bytes=1600) at malloc.c:3028 #1 SP in operator new(unsigned long) + 0x18 () at /usr/lib/x86_64-linux-gnu/libstdc++.so.6 #2 SP in __gnu_cxx::new_allocator<Foo>::allocate(unsigned long, void const*) (this=0x7fffffffd910, __n=100) -- You are receiving this mail because: You are watching all bug changes.