This is the mail archive of the
java@gcc.gnu.org
mailing list for the Java project.
Re: [freenet-tech] Technology / Features
- From: Jeff Sturm <jsturm at one-point dot com>
- To: Adam Megacz <gcj at lists dot megacz dot com>
- Cc: java at gcc dot gnu dot org
- Date: Wed, 27 Feb 2002 18:40:00 -0500 (EST)
- Subject: Re: [freenet-tech] Technology / Features
On 27 Feb 2002, Adam Megacz wrote:
> Andrew Haley <aph@cambridge.redhat.com> writes:
> > Well, I mean it shoudn't be hard to print a list of addresses:
>
> Where will you get that list of addresses from? =)
Why, from the stack frames, of course.
Here's a tiny example for x86:
#include <stdio.h>
void backtrace(void) {
register void *_ebp __asm__("%ebp");
unsigned int *rfp;
for (rfp = _ebp; rfp; rfp = *(unsigned int **)rfp)
printf("%p\n", rfp[1]-5);
}
void g(void) {
backtrace();
}
void f(void) {
g();
}
int main(void) {
f();
return 0;
}