Re: Exception Handling

"David Jobet" <>
25 Jul 2002 23:21:59 -0400

          From comp.compilers

Related articles
Exception Handling (David Jobet) (2002-07-21)
Re: Exception Handling (VBDis) (2002-07-24)
Re: Exception Handling (Casse Hugues) (2002-07-24)
Re: Exception Handling (jacob navia) (2002-07-24)
Re: Exception Handling (David Jobet) (2002-07-25)
Re: Exception Handling (journeyman) (2002-08-04)
Re: Exception Handling (Nick Maclaren) (2002-08-10)
Re: Exception Handling (Marco van de Voort) (2002-08-10)
Re: Exception Handling (Maxim Reznik) (2002-08-10)
Re: Exception Handling (Fergus Henderson) (2002-08-14)
Exception Handling (Bernhard Tschirren) (1998-09-13)
[4 later articles]
| List of all articles for this month |

From: "David Jobet" <>
Newsgroups: comp.compilers
Date: 25 Jul 2002 23:21:59 -0400
Organization: Next generation market
References: 02-07-075 02-07-111
Keywords: code, errors
Posted-Date: 25 Jul 2002 23:21:59 EDT

Well, OK, this is all about getting the return address of the function being
called. As you mention, it's often something like

push ebp
mov esp, ebp

However, my question was about predicting the PC address of a particular
line of code :
e.g :

sub someFunction()
    A a;
    B b = new B();
    f(); // may throw
f_addr :
    // some code

f can throw an exception, I can in f (before longjumping to
someFunction's handler) get the return address (that will correspond
to f_addr in someFunction). The problem is in someFunction, I'd like
to have the PC address of f_addr.

In Visual C, it appears you can use the &f_addr notation to handle
this. However this is not true with ANSI C.

So my question is : is there a way (probably in assembly) to get the
address of a particular label (here f_addr) inside someFunction (I
will probably be able to get the return address in f)

Sorry for my precedent formulation, it was not clear enough.

Kind regards.


jacob navia wrote:

>> Problem is I don't know how to get this return address in order to
>> produce the good case (here h_addr and f_addr).
>> Is there any way to get them using assembly ?
[I suspect you find that for any given compiler, there's some way to
do it, but you're unlikely to find anything portable beyond setjmp().

Post a followup to this message

Return to the comp.compilers page.
Search the comp.compilers archives again.