caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
* [Caml-list] exceptions
@ 2003-11-20 16:20 Christian Schaller
  2003-11-20 16:38 ` Xavier Leroy
  2003-11-20 17:05 ` Artem Prisyznuk
  0 siblings, 2 replies; 11+ messages in thread
From: Christian Schaller @ 2003-11-20 16:20 UTC (permalink / raw)
  To: caml-list

Hello,

Is there any way to get more details regarding exceptions?  Whenever my
program raises an exception, it doesn't display the line that raised it.

E.g. List.nth.  Say, I have several of these function calls.  How can I
tell which one got the wrong list or index?

TIA,
  Chris

-------------------
To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr
Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners


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

* Re: [Caml-list] exceptions
  2003-11-20 16:20 [Caml-list] exceptions Christian Schaller
@ 2003-11-20 16:38 ` Xavier Leroy
  2003-11-20 17:10   ` Artem Prisyznuk
  2003-11-20 17:05 ` Artem Prisyznuk
  1 sibling, 1 reply; 11+ messages in thread
From: Xavier Leroy @ 2003-11-20 16:38 UTC (permalink / raw)
  To: Christian Schaller; +Cc: caml-list

> Is there any way to get more details regarding exceptions?  Whenever my
> program raises an exception, it doesn't display the line that raised it.
> 
> E.g. List.nth.  Say, I have several of these function calls.  How can I
> tell which one got the wrong list or index?

This should be in the FAQ somewhere:

- Compile and link to bytecode with debugging info enabled ("ocamlc -g").
- Set the environment variable OCAMLRUNPARAMS to the value "b"
  (as in "backtrace").
- Execute your program.  Voila, nice stack backtrace with line numbers.

Xavier Leroy

-------------------
To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr
Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners


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

* Re: [Caml-list] exceptions
  2003-11-20 16:20 [Caml-list] exceptions Christian Schaller
  2003-11-20 16:38 ` Xavier Leroy
@ 2003-11-20 17:05 ` Artem Prisyznuk
  1 sibling, 0 replies; 11+ messages in thread
From: Artem Prisyznuk @ 2003-11-20 17:05 UTC (permalink / raw)
  To: Christian Schaller; +Cc: caml-list

On Thu, 20 Nov 2003 17:20:54 +0100, Christian Schaller 
<Christian.Schaller@siemens.com> wrote:


> Is there any way to get more details regarding exceptions?  Whenever my
> program raises an exception, it doesn't display the line that raised it.

Compile and link your program with -g. After that say

$ export OCAMLRUNPARAM=b

Run your program. If uncaught exception raised backtrace log will be print 
on your stderr:

Fatal error: exception Not_found
Raised at file "test.ml", line 1, character 15

PS: this work only for bytecode compiler.


-- 
Artem Prysyznuk
tema@sit.kiev.ua

-------------------
To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr
Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners


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

* Re: [Caml-list] exceptions
  2003-11-20 16:38 ` Xavier Leroy
@ 2003-11-20 17:10   ` Artem Prisyznuk
  0 siblings, 0 replies; 11+ messages in thread
From: Artem Prisyznuk @ 2003-11-20 17:10 UTC (permalink / raw)
  To: Xavier Leroy; +Cc: caml-list

On Thu, 20 Nov 2003 17:38:02 +0100, Xavier Leroy <xavier.leroy@inria.fr> 
wrote:

> - Execute your program.  Voila, nice stack backtrace with line numbers.

Is it possible acces to nice backtrace info from bytecode program?

For example:

let bad_fun () =
   raise Not_found;;

let main () =
   try
	bad_fun ()
   with exc -> print_backtrace_log exc



-- 
Artem Prysyznuk
tema@sit.kiev.ua

-------------------
To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr
Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners


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

* Re: [Caml-list] exceptions
  2003-11-21 21:53   ` Issac Trotts
@ 2003-11-21 22:35     ` Dustin Sallings
  0 siblings, 0 replies; 11+ messages in thread
From: Dustin Sallings @ 2003-11-21 22:35 UTC (permalink / raw)
  To: Issac Trotts; +Cc: caml-list


On Nov 21, 2003, at 13:53, Issac Trotts wrote:

> ... and for vim users, it's :goto 2711 .

	That's handy...I was going to the first column and hitting 
``2711[space]''  :)

-- 
Dustin Sallings

-------------------
To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr
Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners


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

* Re: [Caml-list] exceptions
  2003-11-21 14:21 ` Xavier Leroy
  2003-11-21 16:32   ` skaller
@ 2003-11-21 21:53   ` Issac Trotts
  2003-11-21 22:35     ` Dustin Sallings
  1 sibling, 1 reply; 11+ messages in thread
From: Issac Trotts @ 2003-11-21 21:53 UTC (permalink / raw)
  To: caml-list

On Fri, Nov 21, 2003 at 03:21:39PM +0100, Xavier Leroy wrote:
> > > Fatal error: exception Not_found
> > > Raised at file "test.ml", line 1, character 15
> > 
> > This doesn't work for me :(  I compile with ocamlc -g.  After starting
> > the program, I get
> > 
> > Fatal error: exception Failure("nth")
> > Raised at module Pervasives, character 1086
> > Called from module Foo, character 2711
> > 
> > What am I doing wrong?  My ocaml is version 3.06.
> 
> You need 3.07 to get file names and line numbers in backtraces.  
> In 3.06 and earlier, M-x goto-char is your friend...

... and for vim users, it's :goto 2711 . 

-- 
Issac Trotts

-------------------
To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr
Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners


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

* Re: [Caml-list] exceptions
  2003-11-21 14:21 ` Xavier Leroy
@ 2003-11-21 16:32   ` skaller
  2003-11-21 21:53   ` Issac Trotts
  1 sibling, 0 replies; 11+ messages in thread
From: skaller @ 2003-11-21 16:32 UTC (permalink / raw)
  To: caml-list

On Sat, 2003-11-22 at 01:21, Xavier Leroy wrote:
> You need 3.07 to get file names and line numbers in backtraces.  
> In 3.06 and earlier, M-x goto-char is your friend...

If you run emacs.. lol, I *had* to omit it from
my installation, my root partition was 25% smaller than
the install size .. emacs is a resource hog and it had to go :-)


-------------------
To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr
Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners


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

* Re: [Caml-list] exceptions
  2003-11-21 14:06 Christian Schaller
  2003-11-21 14:21 ` Xavier Leroy
  2003-11-21 14:22 ` Nicolas Cannasse
@ 2003-11-21 14:27 ` Artem Prisyznuk
  2 siblings, 0 replies; 11+ messages in thread
From: Artem Prisyznuk @ 2003-11-21 14:27 UTC (permalink / raw)
  To: Christian Schaller; +Cc: caml-list

On Fri, 21 Nov 2003 15:06:19 +0100, Christian Schaller 
<Christian.Schaller@siemens.com> wrote:

> What am I doing wrong?  My ocaml is version 3.06.

Yes, ocaml < 3.07 print only number character in file instead line info.

You can upgrade your ocaml, or use additional OcamlError tool 
(http://www.cminusminus.org/tools.html).

PS: If you use vim you can goto to required character using command

   ":goto 1234"

If you use emacs you can type M-x goto-char RET 1234.


-- 
Artem Prysyznuk
tema@sit.kiev.ua

-------------------
To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr
Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners


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

* Re: [Caml-list] exceptions
  2003-11-21 14:06 Christian Schaller
  2003-11-21 14:21 ` Xavier Leroy
@ 2003-11-21 14:22 ` Nicolas Cannasse
  2003-11-21 14:27 ` Artem Prisyznuk
  2 siblings, 0 replies; 11+ messages in thread
From: Nicolas Cannasse @ 2003-11-21 14:22 UTC (permalink / raw)
  To: Christian Schaller, Artem Prisyznuk; +Cc: caml-list

> Compile and link your program with -g. After that say
>
> $ export OCAMLRUNPARAM=b
>
> Run your program. If uncaught exception raised backtrace log
> will be print
> on your stderr:
>
> Fatal error: exception Not_found
> Raised at file "test.ml", line 1, character 15
>
> This doesn't work for me :(  I compile with ocamlc -g.  After starting
> the program, I get
>
> Fatal error: exception Failure("nth")
> Raised at module Pervasives, character 1086
> Called from module Foo, character 2711
>  .
>   .
>  .
>
> What am I doing wrong?  My ocaml is version 3.06.

You should upgrade to 3.07, the line number printing have been added
recently.
You can still go to the character 2711 of your module Foo...

Nicolas Cannasse

-------------------
To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr
Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners


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

* Re: [Caml-list] exceptions
  2003-11-21 14:06 Christian Schaller
@ 2003-11-21 14:21 ` Xavier Leroy
  2003-11-21 16:32   ` skaller
  2003-11-21 21:53   ` Issac Trotts
  2003-11-21 14:22 ` Nicolas Cannasse
  2003-11-21 14:27 ` Artem Prisyznuk
  2 siblings, 2 replies; 11+ messages in thread
From: Xavier Leroy @ 2003-11-21 14:21 UTC (permalink / raw)
  To: Christian Schaller; +Cc: caml-list

> > Fatal error: exception Not_found
> > Raised at file "test.ml", line 1, character 15
> 
> This doesn't work for me :(  I compile with ocamlc -g.  After starting
> the program, I get
> 
> Fatal error: exception Failure("nth")
> Raised at module Pervasives, character 1086
> Called from module Foo, character 2711
> 
> What am I doing wrong?  My ocaml is version 3.06.

You need 3.07 to get file names and line numbers in backtraces.  
In 3.06 and earlier, M-x goto-char is your friend...

- Xavier Leroy

-------------------
To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr
Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners


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

* RE: [Caml-list] exceptions
@ 2003-11-21 14:06 Christian Schaller
  2003-11-21 14:21 ` Xavier Leroy
                   ` (2 more replies)
  0 siblings, 3 replies; 11+ messages in thread
From: Christian Schaller @ 2003-11-21 14:06 UTC (permalink / raw)
  To: Artem Prisyznuk; +Cc: caml-list

> Compile and link your program with -g. After that say
> 
> $ export OCAMLRUNPARAM=b
> 
> Run your program. If uncaught exception raised backtrace log 
> will be print 
> on your stderr:
> 
> Fatal error: exception Not_found
> Raised at file "test.ml", line 1, character 15

This doesn't work for me :(  I compile with ocamlc -g.  After starting
the program, I get

Fatal error: exception Failure("nth")
Raised at module Pervasives, character 1086
Called from module Foo, character 2711
   .
   .
   .

What am I doing wrong?  My ocaml is version 3.06.

- Chris

-------------------
To unsubscribe, mail caml-list-request@inria.fr Archives: http://caml.inria.fr
Bug reports: http://caml.inria.fr/bin/caml-bugs FAQ: http://caml.inria.fr/FAQ/
Beginner's list: http://groups.yahoo.com/group/ocaml_beginners


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

end of thread, other threads:[~2003-11-21 22:36 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-11-20 16:20 [Caml-list] exceptions Christian Schaller
2003-11-20 16:38 ` Xavier Leroy
2003-11-20 17:10   ` Artem Prisyznuk
2003-11-20 17:05 ` Artem Prisyznuk
2003-11-21 14:06 Christian Schaller
2003-11-21 14:21 ` Xavier Leroy
2003-11-21 16:32   ` skaller
2003-11-21 21:53   ` Issac Trotts
2003-11-21 22:35     ` Dustin Sallings
2003-11-21 14:22 ` Nicolas Cannasse
2003-11-21 14:27 ` Artem Prisyznuk

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 NNTP newsgroup(s).