[m-rev.] Breakpoint added in source-to-source debugger

Peter Wang novalazy at gmail.com
Mon Oct 8 17:53:27 AEST 2007


On 2007-10-08, Olivier Annet <oan at missioncriticalit.com> wrote:
> Hi,
> 
> Could someone review my code before commit please.
> 
> Olivier.
> 
> ===================================================================
> 
> 
> Estimated hours taken: 4
> Branches: main
> 
> The breakpoint command has been added in the debugger
> 
> compiler/ssdebug.m:
>     Adding feature to send the module name in the ssdb_proc_id structure
>  
> ssdb/ssdb.m:
>     Print out the event number, name of the module, name of the predicate, 
>     call sequence number and call depth at each event.  
>     Some minor changement to make the code more understandable
>     Add code to manage breakpoint.
> 
> Index: compiler/ssdebug.m
> ===================================================================
...
> @@ -247,21 +247,26 @@
>  
>  make_proc_id_construction(PredInfo,
>          _ProcInfo, Goals, ProcIdVar, !Varset, !Vartypes) :-
> -    Name = pred_info_name(PredInfo),
> +    SymModName = pred_info_module(PredInfo),
> +    ModName = sym_name_to_string(SymModName),
> +    PredName = pred_info_name(PredInfo),
>  
> -	make_string_const_construction_alloc(Name, yes("Name"),
> -	    ConstructPredName, PredNameVar, !Varset, !Vartypes),
> +    make_string_const_construction_alloc(ModName, yes("ModName"),
> +	ConstructModName, ModNameVar, !Varset, !Vartypes),
> +
> +    make_string_const_construction_alloc(PredName, yes("PredName"),
> +	ConstructPredName, PredNameVar, !Varset, !Vartypes),

There are two tab chars there which should be expanded to spaces.

>  
>      SSDBModule = mercury_ssdb_builtin_module,
>      TypeCtor = type_ctor(qualified(SSDBModule, "ssdb_proc_id"), 0),
>  
>      svvarset.new_named_var("ProcId", ProcIdVar, !Varset), 
> -    ConsId = cons(qualified(SSDBModule, "ssdb_proc_id"), 1),
> +    ConsId = cons(qualified(SSDBModule, "ssdb_proc_id"), 2),
>      construct_type(TypeCtor, [], ProcIdType),	
>      svmap.det_insert(ProcIdVar, ProcIdType, !Vartypes),
> -    construct_functor(ProcIdVar, ConsId, [PredNameVar], ConstructProcIdGoal),
> +    construct_functor(ProcIdVar, ConsId, [ModNameVar, PredNameVar], ConstructProcIdGoal),

Overlong line.

> Index: ssdb/ssdb.m
> ===================================================================
> RCS file: /home/mercury1/repository/mercury/ssdb/ssdb.m,v
> retrieving revision 1.4
> diff -u -r1.4 ssdb.m
> --- ssdb/ssdb.m	8 Oct 2007 02:44:27 -0000	1.4
> +++ ssdb/ssdb.m	8 Oct 2007 07:28:01 -0000
...
>  
>  
> +:- type breakpoint
> +    --->    breakpoint(
> +                bp_module_name  :: string,
> +                bp_pred_name    :: string
> +    ).

Indent that.

> @@ -123,26 +139,25 @@
>  
>  
>      %
> -    % Write the event out and call the prompt
> -    % XXX Not yet implemented : redo, fail
> +    % Write the event out and call the prompt.
> +    % XXX Not yet implemented : redo, fail.
>      %
>  handle_event(ProcId, Event) :-
>      impure get_event_num_inc(EventNum),
>      impure update_depth(Event, PrintDepth),
>  
> -    (
> -        Event = ssdb_call,
> +    ( Event = ssdb_call,

Formatting.

> @@ -163,12 +178,20 @@
>          Stop = yes
>      ;
>          NextStop0 = next(StopCSN),
> -        is_same_event(StopCSN, PrintCSN, Stop)
> +        is_same_event(StopCSN, CSN, Stop)
> +    ;
> +        NextStop0 = continue,
> +        ( set.contains(State0 ^ ssdb_breakpoints, 
> +            breakpoint(ProcId ^ module_name, ProcId ^ proc_name)) ->
> +            Stop = yes
> +        ;
> +            Stop = no
> +        )

Move the "->" down.

Otherwise it looks fine.

Peter

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