From mboxrd@z Thu Jan 1 00:00:00 1970 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: fee84,152106c4583e904c X-Google-Attributes: gidfee84,public From: denham@denham.zk3.dec.com (Jeffrey M. Denham) Subject: Re: Invalid memory address (dce / thd) Date: 1995/04/13 Message-ID: <1995Apr13.133734.17776@decvax.dec.com>#1/1 X-Deja-AN: 100355207 sender: usenet@decvax.dec.com (Usenet News System) references: <3m0h11$mso@lyra.csx.cam.ac.uk> organization: Digital Equipment Corporation reply-to: denham@zk3.dec.com (Jeffrey M. Denham) newsgroups: comp.unix.osf.osf1 In article <3m0h11$mso@lyra.csx.cam.ac.uk>, thg@cam-orl.co.uk (Tim Glauert) writes: |> |>I'm trying to debug a pthreads program on DEC OSF1 V2.0 on an Alpha. |>I frequently get "Exception: Invalid memory address (dce / thd)" but |>there is no indication of which piece of code has caused this error. |>I've succesfully caught the exception using the TRY and CATCH macros |>but this doesn't appear to help much since I still can't find the |>offending address! Is there *any* way to get the pthreads package to |>tell me which piece of code causes this invalid memory reference? |> |> Tim. |> |>Tim Glauert, Olivetti Research Limited, | EMAIL TGlauert@cam-orl.co.uk |>24a Trumpington Street, Cambridge, England. | TEL +44 1223 343232 |> | FAX +44 1223 313542 |> The threads library establishes signal handler for all the exception signals, such SEGV, ILL, BUS, TRAP. This is what allows it to do try-catch, report errors, etc. One crude way to deal with this is to replace the thread library's handlers with your own. If you request SA_SIGINFO in your sigaction request, you'll get a siginfo structure reporting the fault data. This is also available in the sigcontext structure passed to the handler. See the sigaction man page. Even cruder, is to replace the library's handler's with the default action. This will cause the dying program to dump core. You can then examine the treads' stack and memory by debugging the core file. A similar approach is to try running the application under debugger control. The debugger should be notified of the fault before the library's handler gets called. You can then so a simple stack trace to locate the problem. -- ----------------------------------------------------------------------------- Jeff Denham, Unix Software Group, Digital Equipment Corporation email: denham@zk3.dec.com, voice: (603) 881-0057