site_archiver@lists.apple.com Delivered-To: darwin-dev@lists.apple.com struct Frame { struct Frame *sp; long cr; void *lr; }; register void *r1 __asm__("r1"); Frame *frame = (Frame *)r1; while (frame) { if (frame->lr) /* Do something with the return address */ frame = frame->sp; } If it makes any difference, I am doing this in c++. - Steve _______________________________________________ Do not post admin requests to the list. They will be ignored. Darwin-dev mailing list (Darwin-dev@lists.apple.com) Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/darwin-dev/site_archiver%40lists.appl... This email sent to site_archiver@lists.apple.com Is __builtin_frame_address() broken? I have some backtracing code that walks the stack essentially using: It seems to me that I could remove the register void *r1 __asm__ ("r1"); and change r1 in the next line to __builtin_frame_address(0); but this doesn't seem to work. The value returned is completely bizarre. On a slightly related note, the first few values that frame->lr holds are in unrelated functions that are not on the stack at the time. This is new in gcc 4. Prior versions seemed to provide sane addresses. After the first few functions, the stack seems correct. smime.p7s
participants (1)
-
Steve Checkoway