Mailing list for all users of the OCaml language and system.
 help / color / mirror / Atom feed
* OCamldebug breakpoint issues (fwd)
@ 2005-07-13 13:30 Nathaniel J. Gaylinn
  2005-07-15 13:51 ` [Caml-list] OCamldebug breakpoint issues Nathaniel J. Gaylinn
  2005-07-18  9:36 ` [Caml-list] OCamldebug breakpoint issues (fwd) Hendrik Tews
  0 siblings, 2 replies; 4+ messages in thread
From: Nathaniel J. Gaylinn @ 2005-07-13 13:30 UTC (permalink / raw)
  To: caml-list



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




bignum.ml:

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;;


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

end of thread, other threads:[~2005-07-18 13:27 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2005-07-13 13:30 OCamldebug breakpoint issues (fwd) Nathaniel J. Gaylinn
2005-07-15 13:51 ` [Caml-list] OCamldebug breakpoint issues Nathaniel J. Gaylinn
2005-07-18  9:36 ` [Caml-list] OCamldebug breakpoint issues (fwd) Hendrik Tews
2005-07-18 13:27   ` Nathaniel J. Gaylinn

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox