Re: Exception Handling

"David Jobet" <david.jobet@ng-market.com>
25 Jul 2002 23:21:59 -0400

          From comp.compilers

Related articles
Exception Handling david.jobet@ng-market.com (David Jobet) (2002-07-21)
Re: Exception Handling vbdis@aol.com (VBDis) (2002-07-24)
Re: Exception Handling casse@netcourrier.com (Casse Hugues) (2002-07-24)
Re: Exception Handling jacob@jacob.remcomp.fr (jacob navia) (2002-07-24)
Re: Exception Handling david.jobet@ng-market.com (David Jobet) (2002-07-25)
Re: Exception Handling journeyman@compilerguru.com (journeyman) (2002-08-04)
Re: Exception Handling nmm1@cus.cam.ac.uk (Nick Maclaren) (2002-08-10)
Re: Exception Handling marcov@toad.stack.nl (Marco van de Voort) (2002-08-10)
Re: Exception Handling max1@mbank.com.ua (Maxim Reznik) (2002-08-10)
Re: Exception Handling fjh@cs.mu.OZ.AU (Fergus Henderson) (2002-08-14)
Exception Handling tschirre@cs.curtin.edu.au (Bernhard Tschirren) (1998-09-13)
[4 later articles]
| List of all articles for this month |
From: "David Jobet" <david.jobet@ng-market.com>
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.


David




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().
-John]



Post a followup to this message

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