[m-rev.] already reviewed: add debugger state to ssdb

Julien Fischer juliensf at csse.unimelb.edu.au
Fri Oct 5 14:29:24 AEST 2007


On Fri, 5 Oct 2007, Olivier Annet wrote:

> Estimated hours taken: 8
> Branches: main
>
> Define a debugger state which records all the information needed
> by the debugger.
>
> Currently we record in this state the event number, the call sequence
> number, the call depth and a shadow stack of all the calls.
>
> compiler/Mmakefile:
>    Pass the ssdb init file to c2init, otherwise the ssdb
>    initialization routines will not be called.
>
> ssdb/ssdb.m:
>    Print out the event number, call sequence number and call depth at
>    each event.  Add code to manage the debuger state at each event.
>
> Index: compiler/Mmakefile
> ===================================================================
> RCS file: /home/mercury1/repository/mercury/compiler/Mmakefile,v
> retrieving revision 1.94
> diff -u -r1.94 Mmakefile
> --- compiler/Mmakefile	3 Oct 2007 23:48:15 -0000	1.94
> +++ compiler/Mmakefile	5 Oct 2007 04:10:30 -0000
> @@ -13,7 +13,8 @@
> # Override the settings in ../Mmake.workspace so that in debugging grades we
> # do not include mer_mdbcomp.init twice in the list of files passed to mkinit.
> #
> -C2INITFLAGS = --trace-init-file $(BROWSER_DIR)/$(BROWSER_LIB_NAME).init
> +C2INITFLAGS = --trace-init-file $(BROWSER_DIR)/$(BROWSER_LIB_NAME).init \
> +	--trace-init-file $(SSDB_DIR)/$(SSDB_LIB_NAME).init
>
> -include Mmake.compiler.params
>
> Index: ssdb/ssdb.m
> ===================================================================
> RCS file: /home/mercury1/repository/mercury/ssdb/ssdb.m,v
> retrieving revision 1.2
> diff -u -r1.2 ssdb.m
> --- ssdb/ssdb.m	4 Oct 2007 01:03:47 -0000	1.2
> +++ ssdb/ssdb.m	5 Oct 2007 04:10:30 -0000
> @@ -44,28 +44,240 @@
>
> :- implementation.
>
> -:- import_module io.
> -
> :- import_module bool.
> +:- import_module io.
> :- import_module int.
> :- import_module list.
> +:- import_module require.
> :- import_module string.
>
> %----------------------------------------------------------------------------%
>
> +:- type debugger_state
> +    --->    state(
> +                event_number    :: int,   % Current event number
> +                csn             :: int,   % Call Sequence Number
> +                call_depth      :: int,   % Depth of the function
> +                stack           :: stack  % The shadow stack
> +            ).


Some of the names for fields and alike here are (1) too generic, and/or
(2) likely to clash with names elsewhere in the system.
I suggest:


 	:- type ssdb_state
 		--->	ssdb_state(
 				ssdb_event_number ::
 				ssdb_csn          ::
 	egc.


> +
> +
> +:- type stack == list(stack_elem).

The standard library already defines a stack type.  Why is it necessary
to define another one here?  (You should at least give it a separate
name.)

> +
> +:- type stack_elem
> +    --->    elem(
> +                proc_id         :: ssdb_proc_id,
> +                initial_state   :: debugger_state
> +		    % The debugger state at the call port.
> +            ).
> +

Julien.
--------------------------------------------------------------------------
mercury-reviews mailing list
Post messages to:       mercury-reviews at csse.unimelb.edu.au
Administrative Queries: owner-mercury-reviews at csse.unimelb.edu.au
Subscriptions:          mercury-reviews-request at csse.unimelb.edu.au
--------------------------------------------------------------------------



More information about the reviews mailing list