Paul Pluzhnikov <[EMAIL PROTECTED]> wrote: : > I need it to store the program counter at the time : > when a piece of memory is allocated for reporting later on memory leaks and : > their origin in my memory manager.
: If it's your own memory manager, just pass the info (e.g. file, : line) into the allocation routine(s). that simple solution doesn't help: it would indicate the source line in my memory manager (always the same), but what I need is that of the *call* to the allocation routine. : Alternatively, compile with '-O2 -fno-omit-frame-pointer' I'll try that. Hopefully it can be done just for the part of the program involved. : > Is there another reliable way to access the program counter? : Yes: don't use __builtin_..._address() with parameter other than 0, : and use unwind descriptors to find callers. This latter part will : likely require a couple thousand lines of code (to decode dwarf3 : info). Look in binutils-1.16.x/binutils/readelf.c : display_debug_frames() to get an idea of what's involved. If one would write a procedure in assembler, would that have easy access to the PC? -- -lauther [nosave] ---------------------------------------------------------------------------- Ulrich Lauther ph: +49 89 636 48834 fx: ... 636 42284 Siemens CT SE 6 Internet: [EMAIL PROTECTED] _______________________________________________ help-gplusplus mailing list help-gplusplus@gnu.org http://lists.gnu.org/mailman/listinfo/help-gplusplus