[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[libunwind] Several function exit code paths

From: Johan Walles
Subject: [libunwind] Several function exit code paths
Date: Thu, 11 Dec 2003 12:06:16 +0100
User-agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.4) Gecko/20030624

Assume we have a compiler that doesn't do any optimizations at all. Then, if we have a function like this...

  int i;

  if (foo) {
    return 42;

  return 25;

... it will be compiled into something like this:

 1 alloc
 2 save the return address
 3 move the usp by -8

 4 test foo
 5 if foo was 0, goto fooIs0
 6 set r8=42
 7 move the usp by 8 (restore it)
 8 restore the return address
 9 br.ret

10 call bar()
11 set r8=25
12 move the usp by 8 (restore it)
13 restore the return address
14 br.ret

... the function will (in our case) get a frame entry of three instructions at 

Then, it will get two corresponding frame exits at lines 7-9 and 12-14).

Now, let's say I correctly register the frame entry code with libunwind. I also register the two frame exits with libunwind. In this situation, how does libunwind know that on line 10, the user stack pointer has the same value it had on line 4?

Should I register with libunwind that the br.ret at line 9 does the same thing as both line 2 and line 3?

If this is the way to go, can I use the same "when" parameter to several calls to _U_dyn_op()?

  Cheers //Johan

reply via email to

[Prev in Thread] Current Thread [Next in Thread]