Stack backtracing
Andrew Morton
akpm@zip.com.au
Mon Nov 1 03:34:00 GMT 1999
More information about the Binutils mailing list
Mon Nov 1 03:34:00 GMT 1999
- Next message (by thread): Stack backtracing
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
G'day from .au Two questions: Has anyone had a shot at developing a standalone stack backtracer? There seem to be several floating around within particular applications (GDB, most particularly). This seems to be a useful candidate for standaloneship. Also, has anyone had a shot at developing a backtracer which works with -fomit-frame-pointer? Even better, one which will crawl across a mix of frameless and frameful code? (This would be useful for GDB). Yes, it can be done. Fairly straightforward, but very architecture-dependent: 1: walk up the stack looking for addresses which point into the text segment(s). 2: if you find one, parse the opcode preceding the one which the return address points at. Verify that it's a 'call' opcode of some sort. 3: If poss, work out what address that opcode is calling - verify that it's less than the current PC (but not too much less than). Alternatively, if you have debug info available, verify that the call's address is the start of the current function. 4: Repeat. The Linux kernel does steps 1 and 4. Cheers, Andrew.
- Next message (by thread): Stack backtracing
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Binutils mailing list