Re: [Haskell-cafe] Best way to find an undefined error?

2008-02-14 Thread Don Stewart
saynte:
 Hello all,
 
 Does anyone favourite technique to track down an undefined call? I'm
 99% sure that my code is not the offender (I've grepped for undefined
 occurrences and turned them all into error calls). Supposing that
 this is happening in some other package or library that I'm using,
 what is the best way to find out where it is? I have profiling enabled
 on all libraries that I use, so I'm ok there I think. Any magic
 combination of +RTS .. -RTS?
 

You can use the profiler to get a stack trace, or use the new 
GHCi debugger to step backwards from the exception to the source.

I wrote a bit of a tutorial for this here:

http://cgi.cse.unsw.edu.au/~dons/blog/2007/11/14#no-exceptions

-- Don
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Best way to find an undefined error?

2008-02-14 Thread Denis Bueno
On Thu, Feb 14, 2008 at 2:55 PM, Don Stewart [EMAIL PROTECTED] wrote:
  You can use the profiler to get a stack trace, or use the new
  GHCi debugger to step backwards from the exception to the source.

  I wrote a bit of a tutorial for this here:

  http://cgi.cse.unsw.edu.au/~dons/blog/2007/11/14#no-exceptions

Section 6.3 of http://haskell.org/haskellwiki/Debugging also is
relevant for using ghcu to step backward ... perhaps the section label
is misleading, though.  Feel free to modify as needed if you find the
ghci stepper lets you find the problem

-- 
 Denis
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Best way to find an undefined error?

2008-02-14 Thread Scott West
On Thu, Feb 14, 2008 at 3:02 PM, Denis Bueno [EMAIL PROTECTED] wrote:
 On Thu, Feb 14, 2008 at 2:55 PM, Don Stewart [EMAIL PROTECTED] wrote:
You can use the profiler to get a stack trace, or use the new
GHCi debugger to step backwards from the exception to the source.
  
I wrote a bit of a tutorial for this here:
  
http://cgi.cse.unsw.edu.au/~dons/blog/2007/11/14#no-exceptions

  Section 6.3 of http://haskell.org/haskellwiki/Debugging also is
  relevant for using ghcu to step backward ... perhaps the section label
  is misleading, though.  Feel free to modify as needed if you find the
  ghci stepper lets you find the problem

Well, when using +RTS -xc, I get:

GHC.Err.CAFGHC.Err.CAFPrelude.undefined

I'm not really sure what to do with this, not really the stacktrace I
was hoping for. The ghci debugger I found was really quite nice, up
until it his some portion of code that it isn't interpreting. By not
interpreting i mean things that have been already been compiled and
it's just calling (even if it has been compiled with profiling). I
have a feeling that my problem is somewhere in something that has
already been compiled.

Knowing that, should +RTS -xc be giving me more information? Is there
a way for it to do so?

Regards,
Scott
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Best way to find an undefined error?

2008-02-14 Thread Don Stewart
saynte:
 On Thu, Feb 14, 2008 at 3:02 PM, Denis Bueno [EMAIL PROTECTED] wrote:
  On Thu, Feb 14, 2008 at 2:55 PM, Don Stewart [EMAIL PROTECTED] wrote:
 You can use the profiler to get a stack trace, or use the new
 GHCi debugger to step backwards from the exception to the source.
   
 I wrote a bit of a tutorial for this here:
   
 http://cgi.cse.unsw.edu.au/~dons/blog/2007/11/14#no-exceptions
 
   Section 6.3 of http://haskell.org/haskellwiki/Debugging also is
   relevant for using ghcu to step backward ... perhaps the section label
   is misleading, though.  Feel free to modify as needed if you find the
   ghci stepper lets you find the problem
 
 Well, when using +RTS -xc, I get:
 
 GHC.Err.CAFGHC.Err.CAFPrelude.undefined
 
 I'm not really sure what to do with this, not really the stacktrace I
 was hoping for. The ghci debugger I found was really quite nice, up
 until it his some portion of code that it isn't interpreting. By not
 interpreting i mean things that have been already been compiled and
 it's just calling (even if it has been compiled with profiling). I
 have a feeling that my problem is somewhere in something that has
 already been compiled.

Is it possible to just load all the code interpreted? Or is the problem
in a dependent library?

If you profile and let the program terminate, there should be a stack
trace in the .prof as well.

-- Don
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Best way to find an undefined error?

2008-02-14 Thread Scott West
On Thu, Feb 14, 2008 at 4:43 PM, Don Stewart [EMAIL PROTECTED] wrote:
 saynte:


  On Thu, Feb 14, 2008 at 3:02 PM, Denis Bueno [EMAIL PROTECTED] wrote:
On Thu, Feb 14, 2008 at 2:55 PM, Don Stewart [EMAIL PROTECTED] wrote:
   You can use the profiler to get a stack trace, or use the new
   GHCi debugger to step backwards from the exception to the source.
 
   I wrote a bit of a tutorial for this here:
 
   http://cgi.cse.unsw.edu.au/~dons/blog/2007/11/14#no-exceptions
   
 Section 6.3 of http://haskell.org/haskellwiki/Debugging also is
 relevant for using ghcu to step backward ... perhaps the section label
 is misleading, though.  Feel free to modify as needed if you find the
 ghci stepper lets you find the problem
  
   Well, when using +RTS -xc, I get:
  
   GHC.Err.CAFGHC.Err.CAFPrelude.undefined
  
   I'm not really sure what to do with this, not really the stacktrace I
   was hoping for. The ghci debugger I found was really quite nice, up
   until it his some portion of code that it isn't interpreting. By not
   interpreting i mean things that have been already been compiled and
   it's just calling (even if it has been compiled with profiling). I
   have a feeling that my problem is somewhere in something that has
   already been compiled.

  Is it possible to just load all the code interpreted? Or is the problem
  in a dependent library?

  If you profile and let the program terminate, there should be a stack
  trace in the .prof as well.

  -- Don


Well, I can load a bunch of it interpreted. I've already done this as
far as I think I can. The only pieces laying outside the interpreter
are the GHC libraries and Gtk2Hs. The really funny thing, is that
(essentially) I believe the error results from a call to fromDynamic
out of Data.Dynamic. This sort of leads me to believe that someone's
Typeable instance is being funny. Again though, all the Typeable's
in the immediate area of my code seem to be fine.

(the .prof didn't seem to reveal anything yet... I'll look it over a
little more closely though)

Regards,
Scott
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Best way to find an undefined error?

2008-02-14 Thread Scott West
On Thu, Feb 14, 2008 at 5:12 PM, Scott West [EMAIL PROTECTED] wrote:

 On Thu, Feb 14, 2008 at 4:43 PM, Don Stewart [EMAIL PROTECTED] wrote:
   saynte:
  
  
On Thu, Feb 14, 2008 at 3:02 PM, Denis Bueno [EMAIL PROTECTED] wrote:
  On Thu, Feb 14, 2008 at 2:55 PM, Don Stewart [EMAIL PROTECTED] 
 wrote:
 You can use the profiler to get a stack trace, or use the new
 GHCi debugger to step backwards from the exception to the source.
   
 I wrote a bit of a tutorial for this here:
   
 http://cgi.cse.unsw.edu.au/~dons/blog/2007/11/14#no-exceptions
 
   Section 6.3 of http://haskell.org/haskellwiki/Debugging also is
   relevant for using ghcu to step backward ... perhaps the section 
 label
   is misleading, though.  Feel free to modify as needed if you find the
   ghci stepper lets you find the problem

 Well, when using +RTS -xc, I get:

 GHC.Err.CAFGHC.Err.CAFPrelude.undefined

 I'm not really sure what to do with this, not really the stacktrace I
 was hoping for. The ghci debugger I found was really quite nice, up
 until it his some portion of code that it isn't interpreting. By not
 interpreting i mean things that have been already been compiled and
 it's just calling (even if it has been compiled with profiling). I
 have a feeling that my problem is somewhere in something that has
 already been compiled.
  
Is it possible to just load all the code interpreted? Or is the problem
in a dependent library?
  
If you profile and let the program terminate, there should be a stack
trace in the .prof as well.
  
-- Don
  

  Well, I can load a bunch of it interpreted. I've already done this as
  far as I think I can. The only pieces laying outside the interpreter
  are the GHC libraries and Gtk2Hs. The really funny thing, is that
  (essentially) I believe the error results from a call to fromDynamic
  out of Data.Dynamic. This sort of leads me to believe that someone's
  Typeable instance is being funny. Again though, all the Typeable's
  in the immediate area of my code seem to be fine.

  (the .prof didn't seem to reveal anything yet... I'll look it over a
  little more closely though)

  Regards,
  Scott


I did finally find the error (in one of the pieces of code not written
by myself). A few instances of Typeable were trying to pattern match
their arguments. *bomb*

In either case, it was an interesting experience!

Thanks for the help all!

Regards,
Scott
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe