This is the mail archive of the archer@sourceware.org mailing list for the Archer project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: uw_install_context() and GDB


Phil Muldoon <pmuldoon@redhat.com> writes:

> I take your point well. But if these are user-written destructors, and
> they are being executed on the journey to the exception handler,
> shouldn't "next" return control here? There is a little bit of
> irony. In a conversation I was having recently, I was making a case of
> "next" over a throw always returning control at the corresponding
> "catch", and ignoring the destructors. I changed my mind when it was
> suggested that significant and important work relevant to the code a
> user has written happen in destructors. But quite right, I glossed
> over this, and should make room for conversation on it.

I agree that "next" over a function call that throws an exception past
the current stack frame should ideally stop in a user written
destructor.  It shouldn't stop for destructors in functions below the
current stack frame.

That is (the functions are not presented in the order in which they
are called):

class c { ~c(); }

void f2() {
  f3();        <=== calling next here
}

void f3() {
  c cv;
  throw;       <=== should not break here (c::~c() should run silently)
}

void f1() {
  c cv;
  f2();        <=== should break here on c::~c()
}

This behaviour could reasonably be made subject to something along the
lines of "handle".

Ian


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]