caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: Richard Jones <rich@annexia.org>
To: Andries Hekstra <andries.hekstra@philips.com>
Cc: caml-list@yquem.inria.fr
Subject: Re: [Caml-list] Line number for index out of bounds
Date: Mon, 6 Mar 2006 19:53:36 +0000	[thread overview]
Message-ID: <20060306195336.GA9253@furbychan.cocan.org> (raw)
In-Reply-To: <OFC6075907.4EE9D09A-ONC1257129.0068BB72-C1257129.00693835@philips.com>

On Mon, Mar 06, 2006 at 08:08:02PM +0100, Andries Hekstra wrote:
> If I would use this week of the trip to try this suggestion you made, how 
> will the stack trace give me the line number?

I forgot to say that not only must you run your program in bytecode,
but you must compile your program with the '-g' option.

It will do something like this:

$ cat test.ml 
let a = Array.make 10 0
let f () = a.(11)
let g = f
let h = g
let main = h ()

$ ocamlc -g test.ml -o test

$ ./test 
Fatal error: exception Invalid_argument("index out of bounds")

$ OCAMLRUNPARAM=b ./test
Fatal error: exception Invalid_argument("index out of bounds")
Raised by primitive operation at unknown location
Called from file "test.ml", line 5, character 15

As you can see, often the stack backtraces aren't very accurate either :-(

You might want to look at Marcus Mottl's patch instead ...

Rich.

-- 
Richard Jones, CTO Merjis Ltd.
Merjis - web marketing and technology - http://merjis.com
Team Notepad - intranets and extranets for business - http://team-notepad.com


  reply	other threads:[~2006-03-06 19:53 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-03-06 10:44 Andries Hekstra
2006-03-06 11:14 ` [Caml-list] " Richard Jones
2006-03-06 14:39   ` Markus Mottl
2006-03-06 19:08   ` Andries Hekstra
2006-03-06 19:53     ` Richard Jones [this message]
2006-03-12 10:17     ` Martin Jambon
2006-03-12 11:02       ` Richard Jones
2006-03-11 13:26   ` [Caml-list] Line number for index out of bounds / Exceptions for left hand side of assignments Andries Hekstra
2006-03-07 15:55 ` [Caml-list] Line number for index out of bounds Alan Falloon
2006-03-06 13:11 Jonathan Harrop
2006-03-07  9:39 ` Nicolas Pouillard

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20060306195336.GA9253@furbychan.cocan.org \
    --to=rich@annexia.org \
    --cc=andries.hekstra@philips.com \
    --cc=caml-list@yquem.inria.fr \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).