public inbox for gcc-help@gcc.gnu.org
 help / color / mirror / Atom feed
* Forcing thrown exceptions to core dump without stack unwinding?
@ 1999-12-03 17:33 Andy Glew
  1999-12-03 23:13 ` Mumit Khan
  1999-12-31 22:24 ` Andy Glew
  0 siblings, 2 replies; 4+ messages in thread
From: Andy Glew @ 1999-12-03 17:33 UTC (permalink / raw)
  To: help-gcc

I'm using GCC 2.95.


Q: is there a way of forcing thrown exceptions to core dump
at the site of the exception - so that I can get a useful core dump
I can look at in a debugger?


Instead, what seems to be happening is that the exceptions cause
stack unwinding, are eventually uncaught, and cause a terminate
way up on high.  For whatever reason, I can get no useful stack
backtrace when I look at the core dump in a debugger.


My program may run for many days before the core dump (or not).
It is impractical to run them in a debugger set to break at the first
exception. Since the exceptions seem to be arising in library functions
I have not written, it is impractical to change the code to optionally
not throw.


(As currently written, there is no issue distinguishing between caught
and uncaught exceptions, since I have no exception handling.
In any case, the biggest use I have for catching exceptions is to elaborate
an error message - e.g. to say "new ran out of memory"
and then add layers of context "allocating a foobar_t"
"reading the persistemt object store bar" ...
I.e. so I won't care very much, for now, if all exceptions immediately
cause a coredump without doing any stack unwiding.)


I like the concept of exceptions, but I am afraid that I have found that
program debuggability has declined significantly since I started using them.


---

Please email to glew@cs.wisc.edu






^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Forcing thrown exceptions to core dump without stack unwinding?
  1999-12-03 17:33 Forcing thrown exceptions to core dump without stack unwinding? Andy Glew
@ 1999-12-03 23:13 ` Mumit Khan
  1999-12-31 22:24   ` Mumit Khan
  1999-12-31 22:24 ` Andy Glew
  1 sibling, 1 reply; 4+ messages in thread
From: Mumit Khan @ 1999-12-03 23:13 UTC (permalink / raw)
  To: help-gcc

In article < 829qlj$80e@spool.cs.wisc.edu >, Andy Glew <glew@cs.wisc.edu> wrote:
>I'm using GCC 2.95.
>Q: is there a way of forcing thrown exceptions to core dump
>at the site of the exception - so that I can get a useful core dump
>I can look at in a debugger?

This is IMO a real issue with current EH implementation in GCC. One way
to fix is to implement a dual pass: (1) "virtually" unwind the stack
looking for a handler, and (2) if found, call the handler; if not, call
terminate in the context of the current frame. Essentially, you get a 
C-like assertion if you don't have a handler for that exception.

>My program may run for many days before the core dump (or not).
>It is impractical to run them in a debugger set to break at the first
>exception. Since the exceptions seem to be arising in library functions
>I have not written, it is impractical to change the code to optionally
>not throw.

I know the feeling. I have numercial codes that runs from days to weeks
at a time, and it's very frustrating when you can't pinpoint where things
went wrong. You can get around *some of it* by inserting "catch all"
blocks around library codes, but it's still messy. 

>Please email to glew@cs.wisc.edu

And posted of course.

Regards,
Mumit

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Forcing thrown exceptions to core dump without stack unwinding?
  1999-12-03 23:13 ` Mumit Khan
@ 1999-12-31 22:24   ` Mumit Khan
  0 siblings, 0 replies; 4+ messages in thread
From: Mumit Khan @ 1999-12-31 22:24 UTC (permalink / raw)
  To: help-gcc

In article < 829qlj$80e@spool.cs.wisc.edu >, Andy Glew <glew@cs.wisc.edu> wrote:
>I'm using GCC 2.95.
>Q: is there a way of forcing thrown exceptions to core dump
>at the site of the exception - so that I can get a useful core dump
>I can look at in a debugger?

This is IMO a real issue with current EH implementation in GCC. One way
to fix is to implement a dual pass: (1) "virtually" unwind the stack
looking for a handler, and (2) if found, call the handler; if not, call
terminate in the context of the current frame. Essentially, you get a 
C-like assertion if you don't have a handler for that exception.

>My program may run for many days before the core dump (or not).
>It is impractical to run them in a debugger set to break at the first
>exception. Since the exceptions seem to be arising in library functions
>I have not written, it is impractical to change the code to optionally
>not throw.

I know the feeling. I have numercial codes that runs from days to weeks
at a time, and it's very frustrating when you can't pinpoint where things
went wrong. You can get around *some of it* by inserting "catch all"
blocks around library codes, but it's still messy. 

>Please email to glew@cs.wisc.edu

And posted of course.

Regards,
Mumit

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Forcing thrown exceptions to core dump without stack unwinding?
  1999-12-03 17:33 Forcing thrown exceptions to core dump without stack unwinding? Andy Glew
  1999-12-03 23:13 ` Mumit Khan
@ 1999-12-31 22:24 ` Andy Glew
  1 sibling, 0 replies; 4+ messages in thread
From: Andy Glew @ 1999-12-31 22:24 UTC (permalink / raw)
  To: help-gcc

I'm using GCC 2.95.


Q: is there a way of forcing thrown exceptions to core dump
at the site of the exception - so that I can get a useful core dump
I can look at in a debugger?


Instead, what seems to be happening is that the exceptions cause
stack unwinding, are eventually uncaught, and cause a terminate
way up on high.  For whatever reason, I can get no useful stack
backtrace when I look at the core dump in a debugger.


My program may run for many days before the core dump (or not).
It is impractical to run them in a debugger set to break at the first
exception. Since the exceptions seem to be arising in library functions
I have not written, it is impractical to change the code to optionally
not throw.


(As currently written, there is no issue distinguishing between caught
and uncaught exceptions, since I have no exception handling.
In any case, the biggest use I have for catching exceptions is to elaborate
an error message - e.g. to say "new ran out of memory"
and then add layers of context "allocating a foobar_t"
"reading the persistemt object store bar" ...
I.e. so I won't care very much, for now, if all exceptions immediately
cause a coredump without doing any stack unwiding.)


I like the concept of exceptions, but I am afraid that I have found that
program debuggability has declined significantly since I started using them.


---

Please email to glew@cs.wisc.edu






^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~1999-12-31 22:24 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1999-12-03 17:33 Forcing thrown exceptions to core dump without stack unwinding? Andy Glew
1999-12-03 23:13 ` Mumit Khan
1999-12-31 22:24   ` Mumit Khan
1999-12-31 22:24 ` Andy Glew

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).