9. Recording events during the execution

9. Recording events during the execution

Browsing

Home: Bugloo 0.3.0 reference manual

Previous chapter: Debugging of Memory Allocation
Next chapter: Miscellaneous commands

Recording events during the execution

9.1 Trace of methods calls
9.2 Recording values of variables

Chapters

1. Quick introduction
2. Starting the debugger
3. Break requests commands
4. Execution control
5. Name Manglers and Displayers
6. Getting informations during execution
7. Debug sessions
8. Debugging of Memory Allocation
9. Recording events during the execution
10. Miscellaneous commands
11. Manual Index

9.1 Trace of methods calls

When the execution is suspended, Bugloo can display the call stack of the program ( i.e. the methods that are waiting for a result to return). With this sort of queries, it's difficult to understand how did the debuggee program arrived at the location in the source code it is actually suspended.

Bugloo can record all method entries that are occuring during the execution of the program. You are hence able to visualize a full path of execution, rather than consulting a simple information like computations that remain to be done.

(trace on)Bugloo command

Enable the recording of method entry events

(trace off)Bugloo command

Disable the recording of method entry events

(info trace)Bugloo command

Return the recording status

You can start and stop the recording of this information each time the debuggee is suspended. Once you have got what you needed, you can display the whole recorded trace or simply the last entries in the list :

(trace list . <nbentries>)Bugloo command

Display the recorded trace

(trace clear)Bugloo command

Clear the trace

argumentdescription
<nbentries>::intthe last <nbentries> of the list to display

For example, working with the following program :

  1:(module str
  2:   (main go))
  3:
  4:(define (%reverse l)
  5:   (define (iter l acc)
  6:      (if (null? l)
  7:          acc
  8:          (iter (cdr l) (cons (car l) acc))))
  9:   (iter l '()))
 10:
 11:(define (%fac n)
 12:   (if (zero? n)
 13:       1
 14:       (*fx n (%fac (-fx n 1)))))
 15:
 16:(define (go args)
 17:   (print args)
 18:   (let ((mylist (list 1 2 3 4 5)))
 19:      (print (%reverse mylist))
 20:      (print (%fac 5))))

It's easy to see the whole debuggee's execution history :

Loading init files...
(bugloo) (trace on)
trace started
(bugloo) (resume)
loading debuggee control class...
(a.out)
(5 4 3 2 1)
120
(bugloo) (trace list)
. (main ::(vector java.lang.String)) in module str (no line info...)
. (bigloo_main ::obj) in module str (no line info...)
. (module-initialization ::int ::string) in module str (no line info...)
. (library-modules-init) in module str:1
. (cnst-init) in module str (no line info...)
. (go ::pair) in module str:20
. (%reverse ::obj) in module str:10
. (%fac ::int) in module str:14
. (%fac ::int) in module str:14
. (%fac ::int) in module str:14
. (%fac ::int) in module str:14
. (%fac ::int) in module str:14
. (%fac ::int) in module str:14
(bugloo)

This way, you can quickly verify that %reverse is a proper tail-recursive function, and that %fac is not !

9.2 Recording values of variables

Often, when debugging a program, a bug is located when you found a variable which value is not what it should be. You can only notice that fact, restart the execution and try to step the debuggee sooner in the execution.

Bugloo lets you record the values a variable can take during the debuggee execution, so that you can understand more easily why and when the program diverged.

Records are like modification watchpoints that doesn't suspend the debuggee. They only store the value of variables so that you can view them later :

(record add <classname> <fieldname> . <life>)Bugloo command

Set a modification watchpoint on field <fieldname> in JVM class <classname>

argumentdescription
<classname>::symbolthe name of the class the watchpoint is to be set in
<fieldname>::symbolthe name of the field to control
<life>::inthow many times watchpoint may be reached before it expires

Records are enabled and disabled globally, countrary to breakpoints or watchpoints. This is due to the fact that when you enable variable recording, all variables modification are append in a single history list.

(record on)Bugloo command

Enable the recording of variable modification

(record off)Bugloo command

Disable the recording of variable modification

(info record)Bugloo command

Return the name of the recorded variables and the recording status

(record del <n>)Bugloo command

Delete the <n>th record

(record del all)Bugloo command

Delete all records that are still alive

argumentdescription
<n>::intunique identifier representing the <n>th record

Like traces, when the execution of the debuggee is suspended, you can consult or modify the record history :

(record list . <nbentries>)Bugloo command

Display the variable modification record

(record clear)Bugloo command

Clear the variable modification record

argumentdescription
<nbentries>::intthe last <nbentries> of the list to display


This page has been generated by Scribe.
Last update Thu Aug 28 17:12:18 2003