* Re: EGCS vs MSVC - exception handling @ 1998-01-15 16:13 Mike Stump 0 siblings, 0 replies; 7+ messages in thread From: Mike Stump @ 1998-01-15 16:13 UTC (permalink / raw) To: asharma, egcs > To: egcs@cygnus.com > From: Arun Sharma <asharma@netscape.com> > Date: 12 Jan 1998 23:39:56 -0800 > Why would that be necessary ? Inside the signal handler, I know > precisely which instruction generated the trap by looking into the > sigcontext. Bingo, that's it. Unfortunately, one needs to look at the current PC and only when the top of the stack is hit (the original signal handler frame), then switch over to the sigcontext. gcc hasn't been taught about this yet. You can get it to work, by using -fsjlj-exceptions. ^ permalink raw reply [flat|nested] 7+ messages in thread
[parent not found: <34bbf4a0.7558458@nntp.demos.su>]
[parent not found: <u1zyekkhq.fsf@finobj.com>]
[parent not found: <34bf0215.11003532@nntp.demos.su>]
[parent not found: <uzpl1kbmy.fsf@finobj.com>]
* Re: EGCS vs MSVC - exception handling [not found] ` <uzpl1kbmy.fsf@finobj.com> @ 1998-01-12 10:18 ` Arun Sharma 1998-01-12 17:07 ` Jeffrey A Law 0 siblings, 1 reply; 7+ messages in thread From: Arun Sharma @ 1998-01-12 10:18 UTC (permalink / raw) To: egcs; +Cc: egcs The following message is a courtesy copy of an article that has been posted to comp.os.linux.development.apps as well. Paul Flinders <PaulFl@finobj.com> writes: > > void handle_segv() > { > Segv exception ; > > throw ( exception ); > } > > Should just about do it with the exception of unblocking signals (which > you need to do as never exit the signal handler normally). > A throw from the signal handler results in a core dump. One needs to do more work to get this to work. Someone on the egcs list might have already done this. -Arun PS: The thread was about being able to catch null pointer exceptions in egcs. ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: EGCS vs MSVC - exception handling 1998-01-12 10:18 ` Arun Sharma @ 1998-01-12 17:07 ` Jeffrey A Law 1998-01-13 4:31 ` Arun Sharma 0 siblings, 1 reply; 7+ messages in thread From: Jeffrey A Law @ 1998-01-12 17:07 UTC (permalink / raw) To: Arun Sharma; +Cc: egcs In message < sn04t39h9eb.fsf@zugzwang.mcom.com >you write: > A throw from the signal handler results in a core dump. One needs to > do more work to get this to work. Someone on the egcs list might have > already done this. That requires quite a bit more work. You might start with adding -fasynchronous-exceptions to the command line (or something close to that) which instructs flow to create an edge from every insn to its EH handler (since just about any insn could trap into a signal handler). jeff ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: EGCS vs MSVC - exception handling 1998-01-12 17:07 ` Jeffrey A Law @ 1998-01-13 4:31 ` Arun Sharma 1998-01-14 2:14 ` Andreas Schwab ` (2 more replies) 0 siblings, 3 replies; 7+ messages in thread From: Arun Sharma @ 1998-01-13 4:31 UTC (permalink / raw) To: egcs Jeffrey A Law <law@cygnus.com> writes: > That requires quite a bit more work. You might start with adding > -fasynchronous-exceptions to the command line (or something close to that) > which instructs flow to create an edge from every insn to its EH handler > (since just about any insn could trap into a signal handler). Why would that be necessary ? Inside the signal handler, I know precisely which instruction generated the trap by looking into the sigcontext. All I need to do is to be able to unwind the stack and look for the right exception handler to call. The normal stack unwinding mechanism starts from the current pc and sp, but in this case, it needs to go through the pc and sp in sigcontext. -Arun ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: EGCS vs MSVC - exception handling 1998-01-13 4:31 ` Arun Sharma @ 1998-01-14 2:14 ` Andreas Schwab 1998-01-14 4:17 ` Jeffrey A Law 1998-01-15 16:30 ` Richard Henderson 2 siblings, 0 replies; 7+ messages in thread From: Andreas Schwab @ 1998-01-14 2:14 UTC (permalink / raw) To: Arun Sharma; +Cc: egcs Arun Sharma <asharma@netscape.com> writes: |> Jeffrey A Law <law@cygnus.com> writes: |>> That requires quite a bit more work. You might start with adding |>> -fasynchronous-exceptions to the command line (or something close to that) |>> which instructs flow to create an edge from every insn to its EH handler |>> (since just about any insn could trap into a signal handler). |> Why would that be necessary ? Inside the signal handler, I know |> precisely which instruction generated the trap by looking into the |> sigcontext. All I need to do is to be able to unwind the stack and |> look for the right exception handler to call. The sigcontext is as unportable as you can get. -- Andreas Schwab "And now for something schwab@issan.informatik.uni-dortmund.de completely different" schwab@gnu.org ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: EGCS vs MSVC - exception handling 1998-01-13 4:31 ` Arun Sharma 1998-01-14 2:14 ` Andreas Schwab @ 1998-01-14 4:17 ` Jeffrey A Law 1998-01-15 16:30 ` Richard Henderson 2 siblings, 0 replies; 7+ messages in thread From: Jeffrey A Law @ 1998-01-14 4:17 UTC (permalink / raw) To: Arun Sharma; +Cc: egcs In message < sn090sk7rg3.fsf@zugzwang.mcom.com >you write: > > That requires quite a bit more work. You might start with adding > > -fasynchronous-exceptions to the command line (or something close to that > ) > > which instructs flow to create an edge from every insn to its EH handler > > (since just about any insn could trap into a signal handler). > > Why would that be necessary ? Inside the signal handler, I know > precisely which instruction generated the trap by looking into the > sigcontext. All I need to do is to be able to unwind the stack and > look for the right exception handler to call. You have to be able to map from any instruction that might throw to its associated handler. If you're throwing from a signal handler, then basically every insn might throw, so each and every insn must have an edge to its associated handler. It has nothing to do with unwinding the stack. It's what you do *after* the stack is unwound that requires these extra edges. jeff ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: EGCS vs MSVC - exception handling 1998-01-13 4:31 ` Arun Sharma 1998-01-14 2:14 ` Andreas Schwab 1998-01-14 4:17 ` Jeffrey A Law @ 1998-01-15 16:30 ` Richard Henderson 2 siblings, 0 replies; 7+ messages in thread From: Richard Henderson @ 1998-01-15 16:30 UTC (permalink / raw) To: Arun Sharma; +Cc: egcs On Mon, Jan 12, 1998 at 11:39:56PM -0800, Arun Sharma wrote: > Jeffrey A Law <law@cygnus.com> writes: > > > That requires quite a bit more work. You might start with adding > > -fasynchronous-exceptions to the command line (or something close to that) > > which instructs flow to create an edge from every insn to its EH handler > > (since just about any insn could trap into a signal handler). > > Why would that be necessary ? Inside the signal handler, I know > precisely which instruction generated the trap by looking into the > sigcontext. All I need to do is to be able to unwind the stack and > look for the right exception handler to call. Except that once you've found the handler and jumped to it, you'll want to use some variables. This means the register allocator must know how control flows between the exception region and the handler. r~ ^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~1998-01-15 16:30 UTC | newest] Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 1998-01-15 16:13 EGCS vs MSVC - exception handling Mike Stump [not found] <34bbf4a0.7558458@nntp.demos.su> [not found] ` <u1zyekkhq.fsf@finobj.com> [not found] ` <34bf0215.11003532@nntp.demos.su> [not found] ` <uzpl1kbmy.fsf@finobj.com> 1998-01-12 10:18 ` Arun Sharma 1998-01-12 17:07 ` Jeffrey A Law 1998-01-13 4:31 ` Arun Sharma 1998-01-14 2:14 ` Andreas Schwab 1998-01-14 4:17 ` Jeffrey A Law 1998-01-15 16:30 ` Richard Henderson
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).