caml-list - the Caml user's mailing list
 help / color / mirror / Atom feed
From: "Nathaniel J. Gaylinn" <ngaylinn@cs.brown.edu>
To: caml-list@yquem.inria.fr
Subject: OCamldebug breakpoint issues
Date: Tue, 12 Jul 2005 10:22:15 -0400 (EDT)	[thread overview]
Message-ID: <Pine.LNX.4.62.0507121007070.19059@point> (raw)

[-- Attachment #1: Type: TEXT/PLAIN, Size: 1665 bytes --]


I'm having trouble dealing with breakpoints in OCamldebug. The 
documentation seems to make it clear that you can set a breakpoint at any 
event in your program, but ONLY at an event. This makes sense to me.

The problem is, in practice, I can't seem to set a breakpoint at an 
arbitrary event.

For starters, I used "info events Bignum" to get a list of events for 
my module (its name is Bignum). Fine. I get a long list of event points.

Then I started trying to set breakpoints at each event one after the 
other. That's when I began to see odd behavior.

I can set breakpoints at some events with no difficulty. For 
instance, "break @ Bignum #31" sets a breakpoint at offset 31 just as it 
should. With other events, instead of setting a breakpoint where I 
requested, the breakpoint is put at some earlier event. For instance, 
"break @ Bignum #50" sets a breakpoint at offset 31. This is odd, since as 
far as I know I should be able to set a breakpoint at any event. Usually 
this earlier event is the one right before the event I requested, but 
sometimes its as many as three events back.

What's truly baffling to me, though, is this: if I try to set an event at 
offset 185 (break @ Bignum #185) a breakpoint is created at offset 168, 
the event before the one I requested. However, when I try to set a 
breakpoint at offset 208, I get a breakpoint set at offset 185!!!

Either something's very wrong here, or I have a fundamental 
misunderstanding about how the debugger works with breakpoints. Any tips 
or suggestions would be greatly appreciated. For reference, the file I 
refer to in this email is attached for reference.

Thank you,

   -- Nate

[-- Attachment #2: Type: TEXT/PLAIN, Size: 1074 bytes --]

let rec longAddWithoutCarry =
 function
 [], x -> x
 | x, [] -> x
 | hd1 :: tl1, hd2 :: tl2 -> hd1 + hd2 :: longAddWithoutCarry (tl1, tl2)

let longAdd (lst1, lst2) =
 let rec helper = function
 [], [], 0 -> []
 | [], [], carry -> [carry]
 | [], hd :: tl, carry -> (hd + carry) mod 10 :: helper ([], tl, (hd + carry) / 10)
 | hd :: tl, [], carry -> (hd + carry) mod 10 :: helper (tl, [], (hd + carry) / 10)
 | hd1 :: tl1, hd2 :: tl2, carry -> (hd1 + hd2 + carry) mod 10 :: helper (tl1, tl2, (hd1 + hd2 + carry) / 10)
 in
 helper (lst1, lst2, 0)

let multAll prod lst = List.map (fun x -> x * prod) lst
let timesTen lst = 0 :: lst

let rec longMult = function
 [], num2 -> []
 | hd :: tl, num2 -> longAdd (multAll hd num2, timesTen (longMult (tl, num2)));;


longMult ([3; 2; 1], [2; 1]);;
longMult ([2; 1], [3; 2; 1]);;
longMult ([9; 7; 6; 5; 4; 3; 2; 1], [8; 1]);;
longMult ([], [9; 9; 9; 9; 9; 9]);;
longMult ([1], [9; 9; 9; 9; 9; 9]);;
longMult ([1; 1; 1; 1; 1; 1; 1; 1; 1], [1; 1; 1; 1; 1; 1; 1; 1; 1]);;

let rec forever a = forever a;;

                 reply	other threads:[~2005-07-12 14:22 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=Pine.LNX.4.62.0507121007070.19059@point \
    --to=ngaylinn@cs.brown.edu \
    --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).