mirror of
https://github.com/Mercury-Language/mercury.git
synced 2025-12-19 07:45:09 +00:00
26cf12c729659f9a752cf962bd386e6cffab8dd2
50 Commits
| Author | SHA1 | Message | Date | |
|---|---|---|---|---|
|
|
459847a064 |
Move the univ, maybe, pair and unit types from std_util into their own
Estimated hours taken: 18 Branches: main Move the univ, maybe, pair and unit types from std_util into their own modules. std_util still contains the general purpose higher-order programming constructs. library/std_util.m: Move univ, maybe, pair and unit (plus any other related types and procedures) into their own modules. library/maybe.m: New module. This contains the maybe and maybe_error types and the associated procedures. library/pair.m: New module. This contains the pair type and associated procedures. library/unit.m: New module. This contains the types unit/0 and unit/1. library/univ.m: New module. This contains the univ type and associated procedures. library/library.m: Add the new modules. library/private_builtin.m: Update the declaration of the type_ctor_info struct for univ. runtime/mercury.h: Update the declaration for the type_ctor_info struct for univ. runtime/mercury_mcpp.h: runtime/mercury_hlc_types.h: Update the definition of MR_Univ. runtime/mercury_init.h: Fix a comment: ML_type_name is now exported from type_desc.m. compiler/mlds_to_il.m: Update the the name of the module that defines univs (which are handled specially by the il code generator.) library/*.m: compiler/*.m: browser/*.m: mdbcomp/*.m: profiler/*.m: deep_profiler/*.m: Conform to the above changes. Import the new modules where they are needed; don't import std_util where it isn't needed. Fix formatting in lots of modules. Delete duplicate module imports. tests/*: Update the test suite to confrom to the above changes. |
||
|
|
7822554732 |
Replace __ with . as the module qualifier everywhere in all the modules
Estimated hours taken: 2 Branches: main browser/*.m: Replace __ with . as the module qualifier everywhere in all the modules of the browser directory. Convert the currently tab-indented modules to four-space indentation. Delete some unnecessary module qualifications. Change some type names and function symbols to avoid ambiguities. Replace a bunch of uses of DCGs with state variable notation. |
||
|
|
521967f39f |
Implement a second version of the subterm dependency tracking algorithm
Estimated hours taken: 20 Branches: main Implement a second version of the subterm dependency tracking algorithm that uses the following heuristic to speed things up: If the subterm is being tracked through an output argument, and there is an input argument with the same name as the output argumnet, except for a numerical suffix, then the new algorithm will check if the subterm appears in the same position in the input argument. If it does then it will continue tracking the subterm in the input argument, thus bypassing the subtree rooted at the call. Since dereferencing a subterm in a large structure can be expensive, the new algorithm will only try to bypass calls to procedures it has not tried to bypass before. The set of procedures it has tried is reset each time a new explicit subtree or supertree is generated. Add a `track' command that behaves in the same way as `mark', except that it doesn't assert that the node is erroneous or inadmissible. Add an optional `--accurate' argument which tells the declarative debugger to use the original tracking algorithm. We still allow the old algorithm to be used, because there are situations where the new algorithm could find the wrong call (i.e. when a subterm appears in the same position in an input argument, but the subterm in the output argument is actually bound by a descendent call -- it just happens to be bound to the same value as the input subterm). doc/user_guide.texi: Change the documentation accordingly. browser/browse.m: browser/browser_info.m: browser/parse.m: browser/declarative_user.m: Add a `track' command that does the same thing as a `mark' command, except it doesn't assert the atom to be erroneous or inadmissible. Allow an `--accurate' or `-a' argument for the `mark' and `track' commands which indicates that the old subterm dependency tracking algorithm should be used. Pass information about tracked subterms to the declarative debugger. Do not allow a whole atom to be tracked or marked as this doesn't make sense. browser/declarative_analyser.m: browser/declarative_debugger.m: browser/declarative_edt.m: browser/declarative_oracle.m: Implement the new tracking algorithm. browser/term_rep.m: Add a predicate to dereference a subterm in another term. mdbcomp/rtti_access.m: Add a predicate to find a candidate input argument on which to apply the new heuristic. runtime/Mmakefile: runtime/mercury_layout_util.h: runtime/mercury_stack_layout.h: trace/mercury_trace_vars.c: trace/mercury_trace_vars.h: Move the function for finding the name of a variable to the runtime, so that it can be called from the declarative debugger. tests/debugger/declarative/Mmakefile: tests/debugger/declarative/nodescend_tracking.exp: tests/debugger/declarative/nodescend_tracking.inp: tests/debugger/declarative/nodescend_tracking.m: Test the new heuristic. tests/debugger/declarative/closure_dependency.inp2: tests/debugger/declarative/closure_dependency.exp2: Expect an error message when marking a whole atom. |
||
|
|
fefcf468a0 |
Use dicing information in the declarative debugger.
Estimated hours taken: 30 Branches: main Use dicing information in the declarative debugger. Each label in the program is assigned a suspicion based on a supplied dice. A new search mode then performs divide and query using the total suspicion of a subtree as the weighting of the subtree. browser/declarative_analyser.m: Parameterize the divide and query search mode by allowing it to work with an arbitrary weighting heuristic. Support two weighting heuristics: number of events and suspicion. Since there is still only one weight field for each suspect, if the weighting heuristic changes, then update all the weights of all the suspects. Return a different reason for asking a divide and query question, depending on the weighting heuristic. Some information (specifically how many suspect events remain and the estimated number of questions remaining for divide and query) returned by the info command depends on the current weighting heuristic being the number of events. If the current weighting heuristic is not the number of events then do not show this information. browser/declarative_debugger.m: Pass the trace node store to set_fallback_search_mode so that the weights can be recalculated if the search strategy changes. browser/declarative_edt.m: In the mercury_edt typeclass, rename the edt_weight method to edt_number_of_events and add a new method edt_subtree_suspicion. The weight field of each suspect in the search space can either be based on suspicion or number of events. Add a field to the search_space type to determine which weighting heuristic to use. Export predicates to get and set the current weighting heuristic being used. If the weighting heuristic changes the recalculate the weights of all the suspects. When calculating the weight of a suspect use the current weighting heuristic. browser/declarative_execution.m: Record a suspicion accumulator at each interface event which can be used to calculate the suspicion of a subtree in the EDT. Move the label_layout and proc_layout types as well as all utility predicates for those types to a new module, mdbcomp.label_layout. browser/declarative_oracle.m: browser/declarative_user.m: browser/debugger_interface.m: Import mdbcomp.label_layout. browser/declarative_tree.m: Adjust for the extra field in interface nodes in the annotated trace. Look at the weighting heuristic when calculating the weight of a subtree. browser/util.m: mdbcomp/program_representation.m: Move goal_path_string to mdbcomp.program_representation since it is needed in mdbcomp.label_layout. doc/user_guide.texi: Document the new search mode. mdbcomp/label_layout.m: This module contains the types label_layout and proc_layout and supporting predicates which were in mdb.declarative_execution. These types are needed in the mdbcomp.slice_and_dice module. mdbcomp/mdbcomp.m: Include label_layout. mdbcomp/slice_and_dice.m: Add functions for calculating different suspicion formulas. The intention is to experiment with different formulas in the future. Export predicates for reading a dice from the C backend. Export a predicate for retrieving the suspicion of a label given a dice. This predicate uses the suspicion_ratio_binary formula, since that seems most effective in my (as yet very limited) experience. I will implement better ways to control and customise the formula used in the future. mdbcomp/trace_counts.m: Add a function for constructing a path_port given a goal path and a trace port. If there is an unexpected exception when reading a trace counts file then print the unexpected exception. Add a predicate to convert trace count file types to a string and vica versa. runtime/mercury_stack_layout.h: Fix a typo. runtime/mercury_trace_base.c: runtime/mercury_trace_base.h: Export a function to look up the trace count slot for a label. Use this function when recording trace counts. This function will also be used in the declarative debugger backend to look up suspicions for labels. Add a function to initialise the array which records which ports need a goal path to uniquely identifiy the label. Initially I used this array elsewhere which is why I exported it. I didn't actually end up needing to use it in the final version, but I'm still exporting it, since it might be useful in the future. tests/debugger/declarative/Mmakefile: tests/debugger/declarative/dice.exp: tests/debugger/declarative/dice.inp: tests/debugger/declarative/dice.m: Test the new search mode. tests/debugger/declarative/info.exp: tests/debugger/declarative/change_search.exp: The weigting heuristic is now printed with the info command. Also some information, such as the number of suspect events, is no longer printed if the weigthing heuristic is not the number of events (since then that information is not available). trace/mercury_trace_declarative.c: Add a function to setup the trace counts array with a suspicion for each label. For efficiency the suspicion is converted from a float to an integer between 0 and 100. If a flag is set, then increment an accumulator with the suspicion of each label executed as the annotated trace is being constructed. Store the value of the accumulator at interface events, so that the frontend can efficiently calculate the suspicion of any subtree. Remove a redundant variable and comment: the goal path is no longer passed to the frontend, because the frontend has access to the label_layout from which it can get the goal path (the variable and comment are artifacts of a previous change). When checking if a search mode is valid also check if failing and passing trace counts are required for the search mode. Allow abbreviations for the search mode arguments. trace/mercury_trace_declarative.h: Export the predicate to set up the suspicions for each label. trace/mercury_trace_internal.c: Allow passing and failing test case(s) to be passed as arguments to the dd command. If passing and failing test case(s) are supplied then record suspicions in the annotated trace even if the sdq search mode is not specified. The user could switch to the sdq search mode later on. Initialise some values which were causing warnings from the C compiler. browser/debugger_interface.m: browser/declarative_analyser.m: browser/declarative_debugger.m: browser/declarative_edt.m: browser/declarative_execution.m: browser/declarative_oracle.m: browser/declarative_tree.m: browser/declarative_user.m: browser/util.m: doc/user_guide.texi: mdbcomp/mdbcomp.m: mdbcomp/program_representation.m: mdbcomp/rtti_access.m: mdbcomp/slice_and_dice.m: mdbcomp/trace_counts.m: runtime/mercury_stack_layout.h: runtime/mercury_trace_base.c: runtime/mercury_trace_base.h: tests/debugger/declarative/Mmakefile: tests/debugger/declarative/dice.exp: tests/debugger/declarative/dice.inp: tests/debugger/declarative/dice.m: tests/debugger/declarative/info.exp: trace/mercury_trace_declarative.c: trace/mercury_trace_declarative.h: trace/mercury_trace_internal.c: |
||
|
|
cfa50105ba |
Allow the search mode to be changed from within the declarative debugger.
Estimated hours taken: 15 Branches: main Allow the search mode to be changed from within the declarative debugger. Make binary search independent of subterm dependency tracking. The user can now perform a binary search along the path between the current question and the root of the search space using the command `mode binary' (or `m b'). browser/declarative_analyser.m: Make reask_last_question fail instead of throwing an exception if there is no last question. If it fails we recompute the question. This happens when the user resumes with a new search mode. Do not return an analyser response when showing info, since we can just call reask_last_question. Make set_fallback_search_mode set the last_search_question field to no. This will force the question to be recomputed with the new search strategy when analysis continues. Add change_search_mode which handles the users request to change the current search mode from within a declarative debugging session. Do not perform a binary search after tracking a subterm unless instructed to do so by the user. browser/declarative_debugger.m: Allow search mode changes to be undone. Handle the new change_search oracle response. Handle the fact that reask_last_question is now semidet. browser/declarative_oracle.m: Add a change_search oracle response. Add a predicate to indicate which oracle responses are undoable. browser/declarative_user.m: Add a change_search user response. doc/user_guide.texi: Rephrase the description of the undo command to take into account that search mode changes can be undone. Add a section about the binary search mode. Rearrange some text and reword some sentences slightly. tests/debugger/mdb_command_test.inp: tests/debugger/declarative/Mmakefile: tests/debugger/declarative/binary_search.exp: tests/debugger/declarative/binary_search.exp2: tests/debugger/declarative/binary_search.inp: tests/debugger/declarative/binary_search.inp2: tests/debugger/declarative/change_search.exp: tests/debugger/declarative/change_search.inp: tests/debugger/declarative/change_search.m: tests/debugger/declarative/info.exp: tests/debugger/declarative/info.inp: Test the `mode' command and do not expect the declarative debugger to automatically go into binary search mode once it has tracked a subterm. |
||
|
|
468b4d4945 |
Include a script to test the performance of the debugger in the tools
Estimated hours taken: 4 Branches: main Include a script to test the performance of the debugger in the tools directory. Add a --test dd command option. The --test option causes the declarative debugger to simulate a session where the user answers `no' to all questions until a bug is found. Remove the dd_dd mdb command and add a --debug option to the dd command which does the same thing. The double maintenance of the dd_dd and dd commands was becoming onerous. browser/declarative_debugger.m: Export a predicate to set the testing flag in the user state. browser/declarative_oracle.m: Add a predicate to set the testing flag of the user state. browser/declarative_user.m: Add a new flag to the user state which indicates whether user answers should be simulated. If the new flag is set then simulate answers instead of asking the user. doc/user_guide.texi: Document the --test and --debug developer options. tools/dd_speedtest: Script for testing the performance of the declarative debugger. tools/extract_dd_stats.awk: Script for summarizing the output of dd_speedtest. trace/mercury_trace_declarative.c: Add a predicate to set the testing flag of the diagnoser. Rename the global variable which says whether the declarative debugger is being debugged. Use the -p ps option to print the Memory consumption of the current process instead of using grep. trace/mercury_trace_declarative.h: Fix a typo. Export the predicate to set the testing flag. Rename the global variable which says whether the declarative debugger is being debugged. trace/mercury_trace_internal.c: Add the --test and --debug options and remove the dd_dd command. |
||
|
|
420272e7c4 |
Implement `undo' command in the declarative debugger.
Estimated hours taken: 6
Branches: main
Implement `undo' command in the declarative debugger.
The `undo' command takes the debugger back to the state it was in before the
last answer was given (`skip' is counted as an answer in this case).
browser/declarative_analyser.m:
Add an interface predicate which allows us to get the last question
asked by the analyser.
Do not handle `show_info' in process_answer, since `show_info' is
no longer considered an answer (see below).
browser/declarative_debugger.m:
Make `show_info' an oracle response, instead of an oracle answer,
since it doesn't affect the search space.
Get rid of diagnoser_{get,set}_{analyser,oracle}, because they serve
no abstraction purpose and maintaining them is a pain.
Add a new field to the diagnoser which records the state of the
diagnoser before the previous oracle answer. This turns the
diagnoser into a stack. Add predicates to push and pop
diagnosers from this stack.
Push the current diagnoser onto the stack when an oracle answer
is received from the user.
Pop the previous diagnoser when the `undo' command is issued.
browser/declarative_oracle.m:
Add `undo' to the set of possible oracle responses.
Add a predicate which makes the current knowledge base of one oracle
the revised knowledge base of another oracle.
Fix a spelling mistake.
Add a predicate to get the output stream used to communicate with the
user.
Report whether an answer came directly from the user or not in
query_oracle.
browser/declarative_user.m:
Add the `undo' user response.
Add a predicate to get the output stream used to communicate with the
user. This is used by the diagnoser to print a "Undo stack empty"
message.
doc/user_guide.texi
Document the new command.
tests/debugger/declarative/Mmakefile:
tests/debugger/declarative/undo.exp:
tests/debugger/declarative/undo.inp:
tests/debugger/declarative/undo.m:
Test the new command.
|
||
|
|
68587c5324 |
Look up atoms in the knowledge base as soon as they are added to the search
Estimated hours taken: 3 Branches: main Look up atoms in the knowledge base as soon as they are added to the search space. This generalises a feature of the debugger which I earlier removed for simplicity, where the analyser would pass a list of questions to the oracle. If the oracle had any of the questions in its knowledge base it would return those answers to the analyser, otherwise it would ask the user. This was changed so that only one question was asked of the oracle at a time. Now the analyser still asks only one question of the oracle at a time (through an analyser response), but the oracle's knowledge base is consulted every time a new suspect is added to the search space i.e. as it is being searched. The main benefit of this is that search algorithms can immediately avoid generating queries about trusted nodes. This fixes some slightly annoying behaviour with subterm dependency tracking. Previously if a subterm was bound by a trusted predicate, then this would cause a binary search to be performed between the trusted predicate and the root of the search space. It would be better for the dependency tracking algorithm to first ask about the closest untrusted call to the call that bound the subterm, since often subterms are bound by internal library predicates. The subterm dependency algorithm was unable to do this, however, because it didn't know which calls were trusted while it was tracking the subterm. Now it does. browser/declarative_analyser.m: Pass the oracle state and the io action map to any predicates that add suspects to the search space, so that the oracle's knowledge base can be consulted. Move the code that checks if a bug has been found from decide_analyser_response to the top-down search routine. This is okay since all the other search algorithms will eventually call top-down search if they can't find any unknown suspects to ask questions about. When keeping track of the last unknown suspect, double check that the suspect is still unknown before asking a question about it, since its status may have been changed because, for example, an erroneous child was added to the search space. Pass the mode of the subterm to give_up_subterm_tracking/3, since tracking of the subterm should only be stopped if it's the input to an erroneous node. browser/declarative_debugger.m: Add a subtype of decl_answer/1 that specifies those answers which can be obtained from places other than the user. Pass the oracle state to the analyser. browser/declarative_edt.m: Make first_unknown_descendent return a new type which captures whether an unknown suspect was found, an unknown suspect was not found, or an explicit_subtree was requested. Previously this predicate would fail if an explicit subtree was required, which meant that any suspects added to the search space during the call to first_unknown_descendent would have to be added again once the subtree had been generated. This also removes the need for pick_implicit_root. Pass the oracle state and the io action map to any predicates that add suspects to the search space, so that the oracle's knowledge base can be consulted. Remove the suspect_is_bug predicate, since this is now done by top-down search in the anaylser. Export non_ignored_descendents and suspect_inadmissible so the analyser can use it. Return the mode of a subterm in its origin. Make give_up_subterm_tracking consider the mode of the subterm. Check if the oracle knows the answer to a question when adding children to the search space, or adding a new suspect at the top of the search space. Also give better names to some variables in these predicates. browser/declarative_oracle.m: Export answer_known/3 so that declarative_edt can call it. tests/debugger/declarative/binary_search.exp: tests/debugger/declarative/binary_search.exp2: tests/debugger/declarative/binary_search.inp: tests/debugger/declarative/binary_search.inp2: tests/debugger/declarative/family.exp: tests/debugger/declarative/family.inp: These test cases now ask fewer questions, except for one dd session in the binary_search test case. This, however, is a fix for the quirk mentioned above where a binary search would be started if the binding node is trusted. The new behaviour is more predictable and preferable even if an extra question is asked. trace/mercury_trace_declarative.c: Fix a bug where the dd_dd command didn't work. This was introduced by an earlier diff in which I cleaned up mercury_trace_declarative.c. |
||
|
|
cabb22d14f |
Improve the declarative debugger interface.
Estimated hours taken: 7 Branches: main Improve the declarative debugger interface. The two main changes are to use the mdb help system and not re-display the question after the user issues a command which does not answer the question. For example if the user issues an `info' command, then previously the question would be redisplayed after the requested information and if the question is big then the information would be scrolled off the screen. browser/declarative_analyser.m: Remove extra new line characters when printing info. These are no longer necessary since the question is not redisplayed. browser/declarative_debugger.m: Pass the help system from mdb to the oracle state when initialising the diagnoser. browser/declarative_oracle.m: Pass the help system to the user state when initialising the oracle state. browser/declarative_user.m: Add two new fields to the user state: one to keep a reference to the help system and one to indicate whether the current question should be displayed when getting a user input. Allow the user to redisplay the question by issuing a `print' command with no arguments. If the question is not to be displayed the show a "dd>" prompt. Change the `abort' command to `quit'. This is more consistent with the rest of mdb. doc/commands: Add a script to print all the commands in a section in the user guide. doc/generate_mdb_doc: Generate help for the declarative debugger. doc/mdb_categories: Add a category, `decl', for commands that can be executed inside the declarative debugger. Change the `dd' category to mdb_dd, because 1) `help dd' used to show help about the `dd' category AND the `dd' command and 2) `dd' is too general a category name now that we have a `decl' category. Add an item, `decl_debug' to the concepts category. doc/user_guide.texi: Document some dd commands which previously weren't documented here. Add a short overview of the declarative debugger. This is displayed when the user issues a `help' command from within the dd. Move the bit about the behaviour when no command is given to before the list of commands. This is necessary so util/info_to_mdb.c doesn't include this in the help of the last command in the list. tests/debugger/declarative/app.exp: tests/debugger/declarative/app.inp: tests/debugger/declarative/browse_arg.exp: tests/debugger/declarative/browse_arg.inp: tests/debugger/declarative/browser_mode.exp: tests/debugger/declarative/browser_mode.inp: tests/debugger/declarative/confirm_abort.exp: tests/debugger/declarative/confirm_abort.inp: tests/debugger/declarative/dependency.exp: tests/debugger/declarative/dependency.inp: tests/debugger/declarative/find_origin.exp: tests/debugger/declarative/find_origin.exp2: tests/debugger/declarative/info.exp: tests/debugger/declarative/info.inp: tests/debugger/declarative/io_stream_test.exp: tests/debugger/declarative/io_stream_test.exp2: tests/debugger/declarative/mapinit.exp: tests/debugger/declarative/mapinit.inp: tests/debugger/declarative/output_term_dep.exp: tests/debugger/declarative/output_term_dep.inp: tests/debugger/declarative/resume.exp: tests/debugger/declarative/resume.inp: tests/debugger/declarative/skip.exp: tests/debugger/declarative/skip.inp: tests/debugger/declarative/solutions.exp3: tests/debugger/declarative/tabled_read_decl.exp: Update tests. trace/mercury_trace_declarative.c: trace/mercury_trace_help.c: trace/mercury_trace_help.h: Pass the help system to the frontend. |
||
|
|
a789c0bbfc |
Include the reason why a question was asked in the information provided by the
Estimated hours taken: 14 Branches: main Include the reason why a question was asked in the information provided by the `info' command. This includes the place where a marked subterm was bound if the user marked a subterm in the previous question. browser/declarative_analyser.m Add a new type to record the reason why a question was asked. Keep this information with the last question asked in the analyser state, in case the user issues an `info' command. Display the reason when the user issues an `info' command. Change the behaviour of subterm dependency tracking slightly: if the binding node was previously skipped then ask about it anyway. The user can then see in which node the subterm was bound, which may help them in answering the previously skipped question. browser/declarative_edt.m Add two new methods to the mercury_edt typeclass. One to get the proc_label of a node and the other to convert an arg_pos to a user argument number with respect to an atom in a node. These are needed to display the question reason to the user in mdb.declarative_analyser. Add a new type to record the primitive operation that bound a subterm. browser/declarative_execution.m Add a predicate to convert an arg_pos into a user arg number. browser/declarative_oracle.m Fix a faulty comment. browser/declarative_tree.m Implement the new methods added to the mercury_edt typeclass. Return the type of primitive operation that bound a subterm. doc/user_guide.texi Document the fact that the reason is now also displayed when the `info' command is issued. tests/debugger/declarative/dependency.exp tests/debugger/declarative/dependency2.exp The type of primitive operation is now shown in the debugging output. tests/debugger/declarative/info.exp tests/debugger/declarative/info.inp tests/debugger/declarative/info.m Test the info command more thoroughly. |
||
|
|
1a708a0ccc |
Add a new declarative debugger response, `info', which shows some information
Estimated hours taken: 6 Branches: main Add a new declarative debugger response, `info', which shows some information about the current question and the state of the bug search. browser/declarative_analyser.m Add the show_info predicate. browser/declarative_debugger.m Handle the oracle show_info response. browser/declarative_edt.m Add a new method to the mercury_edt typeclass, edt_context, which returns the filename and line number of the predicate for a node. browser/declarative_execution.m Instead of recording the goal path of a call in its parent, record the return label. The goal path and the parent context can then be derived from the return label. Add a function to get the goal path from a return label. Add a function to get the context of a label. Modify the exported predicates used to build the annotated trace to take a return label instead of the goal path. browser/declarative_oracle.m Add a `show_info' oracle response. browser/declarative_tree.m Implement trace_context which returns the filename and line number of the predicate that corresponds with a node in the annotated trace. Derive a call's goal path in its caller from the return label where necessary. browser/declarative_user.m Add and document the user response `info'. browser/dice.m Fix a line that was over 79 characters. doc/user_guide.texi Document the info command. Say that the --resume option can be used to resume an aborted or pd'd session. tests/debugger/declarative/Mmakefile tests/debugger/declarative/info.exp tests/debugger/declarative/info.inp tests/debugger/declarative/info.m Test the new response. trace/mercury_trace_declarative.c Pass the return label when constructing the annotated trace. |
||
|
|
4970242093 |
Use proc_label data structure defined in mdbcomp.prim_data instead of proc_id
Estimated hours taken: 4 Branches: main Use proc_label data structure defined in mdbcomp.prim_data instead of proc_id defined in mdb.declarative_execution and delete proc_id, since these data structures are almost identical. browser/declarative_execution.m Remove proc_id and flat_module_name types. Use mdbcomp.prim_data.proc_label and mdbcomp.prim_data.module_name instead. browser/declarative_debugger.m browser/declarative_oracle.m browser/declarative_tree.m browser/declarative_user.m Use mdbcomp.prim_data.proc_label and mdbcomp.prim_data.module_name instead of mdb.declarative_execution.proc_id and mdb.declarative_execution.module_name. mdbcomp/prim_data.m compiler/prog_out.m Move sym_name_to_string from prog_out to prim_data. Fix comment for prog_out.sym_name_and_arity_to_string. compiler/bytecode.m compiler/check_typeclass.m compiler/code_gen.m compiler/deforest.m compiler/higher_order.m compiler/hlds_code_util.m compiler/hlds_error_util.m compiler/hlds_module.m compiler/hlds_out.m compiler/intermod.m compiler/layout_out.m compiler/make.module_target.m compiler/make_hlds.m compiler/mercury_compile.m compiler/mercury_to_mercury.m compiler/ml_elim_nested.m compiler/mlds_to_c.m compiler/mlds_to_gcc.m compiler/mlds_to_il.m compiler/mlds_to_java.m compiler/mlds_to_managed.m compiler/modes.m compiler/modules.m compiler/opt_debug.m compiler/options_file.m compiler/polymorphism.m compiler/prog_io.m compiler/prog_rep.m compiler/rl.m compiler/rl_exprn.m compiler/rl_gen.m compiler/rl_info.m compiler/rl_out.pp compiler/rtti.m compiler/rtti_out.m compiler/rtti_to_mlds.m compiler/source_file_map.m compiler/table_gen.m compiler/trans_opt.m compiler/unify_gen.m compiler/unique_modes.m compiler/unused_args.m Use mdbcomp.prim_data.sym_name_to_string instead of prog_out.sym_name_to_string. |
||
|
|
c773957115 |
Fix overly long line of imports.
Estimated hours taken: 0.1 Branches: main browser/declarative_oracle.m: Fix overly long line of imports. |
||
|
|
aa1e562a09 |
In the declarative debugger: use predmode syntax where appropriate; use `.'
Estimated hours taken: 1.2 Branches: main In the declarative debugger: use predmode syntax where appropriate; use `.' as a module qualifier instead of `__'; use state variables for IO instead of DCGs; use `io' instead of `io.state'. browser/declarative_debugger.m browser/declarative_execution.m browser/declarative_oracle.m browser/declarative_test.m browser/declarative_tree.m browser/declarative_user.m Apply the above mentioned changes. |
||
|
|
67895b0b65 |
Fix the current mixture of __ and . to module qualify module names
Estimated hours taken: 0.2 Branches: main browser/*.m: Fix the current mixture of __ and . to module qualify module names by standardizing on the latter. |
||
|
|
ae52aa4524 |
Fix the debugger so that it bootstraps with intermodule-optimization
Estimated hours taken: 0.1 Branches: main Fix the debugger so that it bootstraps with intermodule-optimization enabled (this broke the nightly builds on jupiter and earth last night.) browser/declarative_oracle.m: Module qualify a call to set.member/2 in order to avoid spurious warnings about ambiguity errors when compiling with intermodule-optimization. |
||
|
|
59d2d4a573 |
This adds a module mdbcomp__trace_counts that reads in the
Estimated hours taken: 17 Branches: main This adds a module mdbcomp__trace_counts that reads in the .mercury_trace_counts files produced by the compiler's trace mechanism. The format of said files was slightly changed. As the new module is to be used by the compiler and the debugger, it is placed in the mdbcomp module. This required bringing some types from the compiler into a new module within mdbcomp. browser/trace_counts.m: New module for reading execution trace summaries. browser/prim_data.m: New module holding types and predicates moved in from the compiler. Types: pred_or_func, sym_name, module_name, proc_label, special_pred_id, trace_port Predicates: string_to_sym_name, insert_module_qualifier The mode field of proc_label is now an int instead of a proc_id to avoid pulling proc_id into mdbcomp. browser/mdbcomp.m: Add trace_counts and prim_data to the mdbcomp module. browser/declarative_execution.m: Renamed mdb's definition of module_name to flat_module_name to avoid conflicts with the definition in mdbcomp__prim_data. runtime/mercury_trace_base.c: In the format of .mercury_trace_counts, write module and predicate names now use quoted atom syntax so that names with spaces and non-printable characters can be machine-parsed. browser/: compiler/: Many changes to account for movement of types, and the change to proc_label. |
||
|
|
4e2e2c88ef |
Change the way atoms in the annotated trace are compared by constructing
Estimated hours taken: 4 Branches: main Change the way atoms in the annotated trace are compared by constructing a representation of the atom and then doing deterministic comparisons on the representation, instead of calling compare_representation on the actual atoms, which is cc_multi. This will make looking up atoms in the knowledge base deterministic instead of cc_multi, which is considerably easier to program with. browser/declarative_debugger.m Define an exception as a term representation instead of a univ. browser/declarative_execution.m In the annotated trace store atom arguments and exceptions as term_reps instead of univs. Make predicates that construct an atom argument and an exception cc_multi. browser/declarative_oracle.m Remove the dependency on tree234_cc and set_cc - use map and set instead. Also make predicates that look up info in the knowledge base semidet instead of cc_multi. browser/declarative_user.m Convert term_reps back to univs before printing them. browser/term_rep.m New module implementing the term_rep type. trace/mercury_trace_declarative.c Use new versions of procs to construct exceptions and atom arguments. |
||
|
|
ba2c9002e4 |
Add `mode' command to interactive term browser to display the mode of a
Estimated hours taken: 5 Branches: main Add `mode' command to interactive term browser to display the mode of a sub-term. At the moment this command only works when the term browser is invoked from inside the declarative debugger. browser/browser_info.m Allow a function to be passed to the browser which it can call to work out the mode of a sub-term. browser/browse.m Export versions of the browser invocation predicates that don't accept a mode function. Handle the `mode' browser command by calling the supplied function if it's present. Document the `mode' command in the browser help message. browser/declarative_debugger.m To determine the mode of a sub-term we compare the state of instantiation of the sub-term at the CALL event and at the EXIT, FAIL or EXCP event. To do this we need the initial and final atoms for incorrect contour bugs and wrong answer nodes (for other nodes the initial and final atoms are the same). browser/declarative_oracle.m Conform to the fact that wrong answers now also have the initial atom. browser/declarative_tree.m Export trace_atom_subterm_is_ground/3 for use in declarative_user.m. Include the initial atom in wrong answer nodes and incorrect contour bugs. browser/declarative_user.m Add function arg_num_to_arg_pos to replace some duplicated code. Alter the edt_node_trace_atom predicate to find the initial and the final atoms for a question. Add a function to find the mode of a sub-term given the path to the sub-term and the initial and final atoms. Pass this function to the browser so it can work out the mode of a sub-term. browser/parse.m Parse `mode' command. tests/debugger/declarative/Mmakefile tests/debugger/declarative/browser_mode.exp tests/debugger/declarative/browser_mode.inp tests/debugger/declarative/browser_mode.m Test the `mode' command. |
||
|
|
dce0b465e1 |
Allow `trust' as declarative debugger question response.
Estimated hours taken: 1.5 Branches: main Allow `trust' as declarative debugger question response. The user may respond with simply `trust' in which case the current predicate or function will be trusted, or `trust module' in which case the module the current question relates to will be trusted. browser/declarative_oracle.m If the user response is trust_predicate or trust_module then add the predicate/function or module to the list of trusted objects and return an `ignore' response to the analyser. browser/declarative_user.m Handle `trust' command and add it to the help messgae. doc/user_guide.texi Document `trust' and `trust module' declarative debugger commands. tests/debugger/declarative/trust.exp tests/debugger/declarative/trust.inp Test the `trust' and `trust module' commands. |
||
|
|
51419029ee |
Do not store all modes for inadmissible or erroneous atoms in the knowledge
Estimated hours taken: 0.2 Branches: main Do not store all modes for inadmissible or erroneous atoms in the knowledge base, since an atom may be erroneous with respect to one mode, but inadmissible with respect to another. browser/declarative_oracle.m Only store all modes in the knowledge base when the atom is correct. |
||
|
|
732a892fe6 |
The main changes to the declarative debugger are:
Estimated hours taken: 200 Branches: main The main changes to the declarative debugger are: When you mark a subterm (using the term browser from within the DD), the next question will be about the node that bound that subterm. If that node is correct then a binary search will be done between that node and the last node you asserted was erroneous. The declarative debugger is now a 3-valued debugger. This means you can answer inadmissible if a call's inputs violate some precondition of the call. The debugger will also infer a call is inadmissible if you mark one of its inputs from the browser. You don't have to give an argument number when invoking the term browser from within the DD. If an argument number is omitted then the whole call is browsed as if it were a data term. The subterm dependency tracking code now has the ability to track subterms of closures, including subterms used when creating the closure by currying. Subterm dependency tracking is also now more reliable when tracing information is missing. Lots of stuff in declarative_analyser.m has been redesigned to facilitate future improvements, such as probabalistic debugging. browser/declarative_analyser.m Transferred the definition of the mercury_edt type class to declarative_edt.m. Added two new search algorithms: one to use suspicious subterm information to direct the bug search and one to do a binary search on a path in the EDT. browser/declarative_debugger.m Added inadmissible as a truth value for the declarative debugger. Added ignore and skip responses. Ignore responses are used when a call is to a trusted predicate. Ignore tells the analyser that the node is not a bug itself, though it may have buggy children. Skip means the oracle has skipped the question. browser/declarative_edt.m Definition of the EDT type class and search_space type. Search spaces are an extra layer on top of the EDT and provide useful services to the analyser such as keeping track of which nodes in the EDT might contain a bug. In the future the search space will also be used to hold information like the probability that a node is buggy. Extended the mercury_edt type class with some useful methods. browser/declarative_execution.m Added some utility predicates to extract information from a proc_id. browser/declarative_oracle.m The oracle now only answers one question at a time. This makes the implementation simpler. I plan to get the oracle to tell the analyser everything it knows, without having to ask the user, whenever children are added to the search space, so that maximum information is always available to the search algorithms. Added a mechanism so the analyser can explicitly request that a question be re-asked of the user. Made some changes to handle inadmissible calls. browser/declarative_tree.m Can now produce an i_bug as well as an e_bug. Made changes to handle dependency tracking of closure arguments. There are now two slightly different modes of subterm dependency tracking. A fall-back mode where not all trace information is available and a "full" mode that assumes everything has been traced (which will be the case if compilation was with a debug grade). The main difference is with higher order calls. Because the id of the pred being called in a higher order call is not (easily) available, we can't safely match the HO call up with events on the contour if everything is not traced. If everything is traced, then we can be sure the HO call's events will be where we expect them. Handled builtin calls which are treated as primitive ops. browser/declarative_user.m User can now browse an entire call, instead of only one argument at a time. Allowed user to answer inadmissible. browser/mdb.m Added mdb.declarative_edt. browser/program_representation.m Added builtin_call_rep to represent builtin calls. Made plain calls to UCI predicates be treated as primitive ops. Added function to say if a goal generates internal events directly. Added a function to say whether an atomic goal is identifiable (i.e. whether we can get from its goal_rep its name, module and arity). compiler/prog_rep.m Now creates builtin_call_rep atomic goal if the plain call was to a builtin. compiler/trace_params.m Made minimum tracing for decldebug grade include program representations. This is so the libraries compile with program representations, so we can do subterm dependency tracking through library calls. Trace level decl now includes the program representation. The default trace level for decldebug grade now includes the program representation. doc/user_guide.texi Updated with new features. tests/debugger/declarative/Mercury.options Removed superflous `--trace rep' options (since this is now implied by --trace decl). tests/debugger/declarative/Mmakefile Added new tests. Also made it possible to specify 3 different inputs: one for non-debugging grades, one for debug grades and one for decldebug grades. tests/debugger/declarative/binary_search.exp tests/debugger/declarative/binary_search.exp2 tests/debugger/declarative/binary_search.inp tests/debugger/declarative/binary_search.inp2 tests/debugger/declarative/binary_search.m tests/debugger/declarative/binary_search_1.m Test binary search. tests/debugger/declarative/builtin_call_rep.exp tests/debugger/declarative/builtin_call_rep.inp tests/debugger/declarative/builtin_call_rep.m Test that builtin_call_rep appears in the program representation for builtin calls. tests/debugger/declarative/catch.exp tests/debugger/declarative/catch.exp2 tests/debugger/declarative/catch.inp Use standardized output. tests/debugger/declarative/closure_dependency.exp tests/debugger/declarative/closure_dependency.exp2 tests/debugger/declarative/closure_dependency.inp tests/debugger/declarative/closure_dependency.inp2 tests/debugger/declarative/closure_dependency.m Test dependency tracking through higher order calls. tests/debugger/declarative/confirm_abort.exp tests/debugger/declarative/confirm_abort.inp If the dd command is typed then the root node is now always asked as the first question even if the oracle knows the answer (except where the predicate is trusted). Updated the test to reflect this change. tests/debugger/declarative/dependency.exp tests/debugger/declarative/dependency2.exp Arguments are now counted from the back (a change to get dependency tracking to work with higher order calls), so the debug messages printed in this test needed to be changed. tests/debugger/declarative/explicit_subtree.exp tests/debugger/declarative/explicit_subtree.exp2 tests/debugger/declarative/explicit_subtree.inp tests/debugger/declarative/explicit_subtree.inp2 tests/debugger/declarative/explicit_subtree.m Test for a bug fixed with this diff. The bug occured when the subtree for an implicit node was generated and then the explicit subtree for another implicit node to the left of the generated subtree was requested. When building the new subtree execution proceeded from where execution stopped when the previous subtree was generated, so execution never passed through nodes to the left of the previous subtree and the requested subtree wasn't built. tests/debugger/declarative/family.exp tests/debugger/declarative/family.inp Some changes to event numbers to do with changes in the way explicit subtrees are generated (see comment for tests/debugger/declarative/explicit_subtree above). Also some changes to do with the fact that the analyser now only asks the oracle one question at a time. tests/debugger/declarative/find_origin.exp tests/debugger/declarative/find_origin.exp2 tests/debugger/declarative/find_origin.exp3 tests/debugger/declarative/find_origin.inp tests/debugger/declarative/find_origin.inp2 tests/debugger/declarative/find_origin.inp3 tests/debugger/declarative/find_origin.m Test sub-term dependency tracking. tests/debugger/declarative/ho5.exp3 Changes to do with the fact that the standard library is now compiled with deep tracing in the decldebug grade. tests/debugger/declarative/ignore.exp tests/debugger/declarative/ignore.exp2 tests/debugger/declarative/ignore.inp tests/debugger/declarative/ignore.inp2 tests/debugger/declarative/ignore.m tests/debugger/declarative/ignore_1.m Test `ignore' oracle response. tests/debugger/declarative/inadmissible.exp tests/debugger/declarative/inadmissible.inp tests/debugger/declarative/inadmissible.m Test inadmissibility. tests/debugger/declarative/input_term_dep.exp tests/debugger/declarative/input_term_dep.inp Some of the bugs found are now inadmissible call bugs, since inputs were marked as incorrect. Also made changes to do with the fact that incorrect sub-terms are now followed to where they're bound. tests/debugger/declarative/lpe_example.exp3 Added new expected output when in decldebug grade. Event numbers and call depths are different now because of deep tracing in the standard library. tests/debugger/declarative/mismatch_on_call.exp tests/debugger/declarative/mismatch_on_call.exp2 tests/debugger/declarative/mismatch_on_call.inp tests/debugger/declarative/mismatch_on_call.m This test used to cause an "mismatch on call" exception to be thrown by the dependency tracking routine. tests/debugger/declarative/skip.exp tests/debugger/declarative/skip.inp tests/debugger/declarative/skip.m Test `skip' oracle response. tests/debugger/declarative/solutions.exp3 tests/debugger/declarative/solutions.inp3 Added new input and expected output for decldebug grade. Some standard modules need to be trusted since they are now deep traced in this grade. tests/debugger/declarative/special_term_dep.exp A bug is now reported as an inadmissible call. tests/debugger/declarative/throw.exp3 Because the standard library in decldebug grade is now deep traced by default event numbers are different, parent contexts are printed and "reached label with no stack layout info" warnings are not encountered. trace/mercury_trace_declarative.c Made the depth step size used when deciding which events to put in the annotated trace a variable so that it can be dynamically adjusted in the future. The EDT depth is now calculated independently instead of using event_info->MR_call_depth (which is not always consistent with the EDT depth). When generating an annotated trace for an explicit subtree the first event's preceeding event now points to the correct event in the existing annotated trace (instead of NULL). This allows the parent of the root of the new explicit subtree to be calculated. Made changes so that all the interface events of child calls of a call are included in the annotated trace, so that contours are built correctly. |
||
|
|
e7d6509c95 |
Trust modules in the Mercury standard library by default in the declarative
Estimated hours taken: 6 Branches: main Trust modules in the Mercury standard library by default in the declarative debugger. Make trusted object id's returned by `trusted' command persistent. Previously each trusted object was identified by its position in the ordered list of trusted objects. This meant that if an object was removed all objects after the removed object in the ordered list of trusted objects would have their ids decremented, so if the user wanted to then delete another object they'd have to issue another `trusted' command to get the new id first. The behaviour is now consistent with the behaviour of breakpoint ids which keep their id for the life of the breakpoint. Put the mdb declarative debugger commands in their own section, instead of in misc to be consistent with the mdb online help categories and so the online help for the mdb declarative debugger commands is generated properly (the dd help category wasn't getting any online documentation generated for it). browser/declarative_debugger.m Add and export predicate to add the standard library to the set of trusted objects. browser/declarative_oracle.m Add predicate to add the standard library to the set of trusted objects. Use a bimap to represent the set of trusted objects along with each object's id (we need to look up objects both ways). Adjust comment formatting to conform to standard. Rename trusted_module_or_predicate type to trusted_object. Add constructor for standard_library to trusted_object type. Include standard library when initialising the set of trusted objects. Change predicates adding or removing trusted objects to use new persistent object id. If a module belongs to the standard library and the standard library is trusted then trust the module. compiler/modules.m library/library.m Move definition of mercury_std_library_module/1 from modules.m to library.m so it can be used by the debugger. Adjust comment accordingly. compiler/mlds.m Import library module since since mercury_std_library_module/1 now resides there. doc/generate_mdb_doc Generate declarative debugger commands documentation. doc/user_guide.texi Document `trust std lib' command. tests/debugger/declarative/catch.exp2 tests/debugger/declarative/catch.exp3 tests/debugger/declarative/catch.inp2 tests/debugger/declarative/solutions.exp2 tests/debugger/declarative/solutions.inp2 Untrust the standard library for these tests. tests/debugger/declarative/trust.inp tests/debugger/declarative/trust.exp Update test to reflect persistent trusted object ids and trusting of standard library. trace/mercury_trace_declarative.c trace/mercury_trace_declarative.h Add function to trust the standard library. trace/mercury_trace_internal.c Allow user to trust the standard library by issuing a `trust std lib' command. |
||
|
|
7015c4a436 |
Made the declarative debugger respect the format settings of the procedural
Estimated hours taken: 3 Branches: main Made the declarative debugger respect the format settings of the procedural debugger. The print format set in the procedural debugger will now be used when the declarative debugger asks questions and the browse format will now be used when browsing terms in the declarative debugger. If the user changes the browser format during a declarative debugging session the procedural debugger will respect these changes. This also means the declarative debugger will respect the settings in the .mdbrc file. browser/declarative_debugger.m Added term browser state arguments to main diagnosis predicate and initialisation predicate. browser/declarative_oracle.m Added predicates to get and set the term browser state. Set the term browser state in the initialisation prediciate for the oracle state. browser/declarative_user.m Added predicates to get and set the term browser state. Set the term browser state in the initialisation prediciate for the user state. tests/debugger/declarative/dependency.exp This test sets the print format in the procedural debugger, so the declarative debugger now uses this format. trace/mercury_trace_browse.c trace/mercury_trace_browse.h Exported the global variable which stores the state of the procedural debugger term browser and the function which initialises this state, so they can be used from mercury_trace_declarative.c. trace/mercury_trace_declarative.c Pass the procedural debugger term browser state to the declarative debugger and update the state when the declarative debugger is finished. |
||
|
|
0a99d27d66 |
Module qualify some calls to prevent ambiguous
Estimated hours taken: 0.1 Branches: main browser/declarative_oracle.m: Module qualify some calls to prevent ambiguous overloadings that were causing compilation errors when compiling the debugger with intermodule-optimization enabled. |
||
|
|
e6d82c9bd4 |
Added trusted' and untrust' commands. Also allowed individual predicates to
Estimated hours taken: 10 Branches: main Added `trusted' and `untrust' commands. Also allowed individual predicates to be trusted. browser/declarative_debugger.m Exported predicates to add a trusted predicate or function, remove a trusted object and return a list of the trusted objects. browser/declarative_oracle.m Changed trusted set so it can also contains individual predicates and functions. Added predicates to add a trusted predicate or function to the set, remove a trusted object from the set and return a list of the trusted objects. doc/mdb_categories Added dd category. doc/user_guide.texi Documented `untrust' and `trusted' commands. runtime/mercury_stack_trace.c runtime/mercury_stack_trace.h Added a print_mode argument to MR_print_proc_id_internal, so that printing of mode information can be turned on or off. When a list of matching predicates for the trust command is shown then mode information is superfluous, since a predicate/function is trusted, not a procedure. Added MR_print_pred_id to print predicate id - i.e. proc id without the mode info. tests/debugger/completion.exp New commands shown in completion list. tests/debugger/completion.inp Added a space, since a --More-- prompt is now displayed when showing all the commands. tests/debugger/mdb_command_test.inp untrust and trusted added. tests/debugger/declarative/trust.exp tests/debugger/declarative/trust.inp Testing of new commands. trace/mercury_trace_declarative.c trace/mercury_trace_declarative.h Added functions to add a trusted predicate and remove a trusted object. Also added a function to print a list of the trusted objects. These all call the predicates exported from declarative_debugger.m. trace/mercury_trace_internal.c Added handlers for `trusted' and `untrust' commands. trace/mercury_trace_tables.c trace/mercury_trace_tables.h Added a function to filter out only the user predicates and functions from a list of procedures. This filters out uci procs and also filters out all procs with a mode number > 0 (thus leaving one proc for each predicate/function). This is used when displaying the predicates matching an ambiguous proc-spec with a trust command. NEWS Updated NEWS file. |
||
|
|
5de0d4c27b |
Add a module qualification to work around a problem with intermodule
Estimated hours taken: 0.1 Branches: main browser/declarative_oracle.m: Add a module qualification to work around a problem with intermodule optimization. |
||
|
|
6b14f3921d |
The annotated trace used for declarative debugging now keeps a reference to the
Estimated hours taken: 5 Branches: main The annotated trace used for declarative debugging now keeps a reference to the proc layout for a predicate/function, instead of all the details of the predicate/function. This saves space and gives access to more information about the predicate/function. browser/declarative_debugger.m Changed write_origin to look up the proc name through the proc_layout. browser/declarative_execution.m Info about the predicate like its name, module etc is now represented by a proc_layout type. Changed the trace_atom type appropriately and added useful predicates and functions to manipulate proc_layouts - thanks to Zoltan. browser/declarative_oracle.m Since proc_layouts are unique per mode, all modes must now be added to the knowledge base in assert_oracle_kb. browser/declarative_tree.m Minor changes to predicate that expected four arguments to trace_atom type. browser/declarative_user.m Minor changes to predicates that used the old trace_atom type. tests/debugger/declarative/remember_modes.m Test to see that all modes of a predicate are added to the knowledge base of the oracle. tests/debugger/declarative/Mmakefile Added remember_modes test. tests/debugger/declarative/remember_modes.exp Expected results for remember_modes test. tests/debugger/declarative/remember_modes.inp Input to remember_modes test. tests/debugger/declarative/trust.m Removed superfluous import of trust_1 in interface. trace/mercury_trace_declarative.c Removed MR_decl_atom_name_and_module which is no longer necessary since the debugger looks the name and module up in the proc_layout directly. |
||
|
|
1752fcdb52 |
Work around a compiler bug that prevented installs on jupiter
Estimated hours taken: 0.1 Branches: main browser/declarative_oracle.m: Work around a compiler bug that prevented installs on jupiter with -O5 --intermodule-optimization --constraint-propagation --opt-space Apparently the compiler read in optimization interface files too early, and didn't know which member predicate (in set or in set_ordlist) we wanted. The fix is an explicit module qualification. |
||
|
|
8ea1dbc3b5 |
Added a `trust' command to mdb which tells the declarative debugger to assume
Estimated hours taken: 35 Branches: main Added a `trust' command to mdb which tells the declarative debugger to assume all procedures in a given module are correct. browser/declarative_debugger.m Added function which finds out the atom a given question relates to. Exported a add_trusted_module predicate so modules can be added from c code (used by trace/mercury_trace_declarative.c). browser/declarative_execution.m Add module_name field to the atom constructor for the trace_atom type. Made necessary changes to predicates that expected 3 fields for the atom constructor for the trace_atom type. browser/declarative_oracle.m Added a set of trusted module names to the oracle_state type. browser/declarative_tree.m Updated various predicates that expected the atom constructor to have 3 fields where now it has 4. browser/declarative_user.m Updated various predicates that expected the atom constructor to have 3 fields where now it has 4. trace/mercury_trace_declarative.h Added MR_decl_add_trusted_module function to add a module to the set of trusted modules for the currect diagnoser. trace/mercury_trace_declarative.c Implemented the MR_decl_add_trusted_module function. This calls MR_trace_decl_ensure_init to make sure the diagnoser is initialised first. Changed the MR_decl_make_atom function to include the module name when constructing an atom. Added MR_decl_atom_name_and_module function which extracts the proc name and module from a MR_Proc_Layout. This replaces the MR_decl_atom_name function which just extracted the name. This function will also extract the name and module of user defined equality and comparison predicates. trace/mercury_trace_internal.c Added MR_trace_cmd_trust function to add a trusted module to the current diagnoser when the user issues a `trust' command. doc/mdb_categories Added `trust' command to misc category (will need to make a declarative category when there are more commands). doc/user_guide.texi Added some help text for the `trust' command. tests/debugger/mdb_command_test.inp Added `trust' command to list of tests. tests/debugger/declarative/Mmakefile Added calls to the trust.m program to test the `trust' command. tests/debugger/declarative/trust.m Test program for the `trust' command. This imports 2 modules in the and calls a user-defined comparison predicate from the one module and a normal predicate from the other. tests/debugger/declarative/trust_1.m Imported by trust.m. Defines a new type and a user-defined comparison predicate on the type. tests/debugger/declarative/trust_2.m Also imported by trust.m. Defines a predicate using the type defined in trust_1.m. tests/debugger/declarative/trust.inp Input to mdb to test the `trust' command. Contains commands to tell mdb to trust the trust_1 and trust_2 modules. tests/debugger/declarative/trust.exp Expected output of mdb when running trust with trust.inp as input. |
||
|
|
e7c86a2342 |
Conform to the convention of importing only one browser module per
Estimated hours taken: 0.2 Branches: main browser/debugger_interface.m: browser/declarative_oracle.m: browser/interactive_query.m: browser/parse.m: Conform to the convention of importing only one browser module per line, and of importing browser modules before standard library modules. |
||
|
|
c9563335ef |
Allow users of the declarative debugger to revise answers that they
Estimated hours taken: 60 Branches: main Allow users of the declarative debugger to revise answers that they have given previously. We do this by modifying the user interface to allow a default answer to be shown as part of the question; the default answer will always be some answer the user has given previously, which they can choose to either change or accept as is. Initially no questions will be candidates for revision, but if the user ever rejects a diagnosis, some or all of the questions leading directly to the bug in question will be asked again. Add an empty command to the user_command type, for when the user just presses return. If there is a default answer, the empty command is interpreted as that answer. If there is no default answer, the empty command is interpreted as the skip command, which allows the user to cycle through all the available questions by repeatedly pressing return. browser/declarative_debugger.m: Define the type decl_evidence which represents the evidence collected against a particular suspect. Pass the evidence to the oracle as required. Ensure the analyser is updated after the user rejects a diagnosis. browser/declarative_analyser.m: Collect the evidence against the prime suspect as the answers are processed, and include this evidence when the analyser response is a bug. Export the predicate revise_analysis/4 which updates the analyser state after the user has rejected a diagnosis. Pass the IO action map to prime_suspect_get_evidence so that edt_root_question can be called. browser/declarative_oracle.m: When the user rejects a bug, retract from the oracle's knowledge base any of the evidence which implicated that bug. Rather than throw this information away, we assert it in a secondary knowledge base which is consulted when we want to know if there should be a default answer provided to the user. Update the oracle_state to reflect the above change, and remove all the get_* and set_* predicates for the oracle state. That functionality is provided by labelled fields, so maintaining the get_* and set_* predicates is no longer worth the trouble. Add the predicate retract_oracle_kb/3 to remove information from a knowledge base. Use the correct (equivalence) type for exceptions. browser/declarative_user.m: Add the type user_question, which may be a plain decl_question or may be a decl_question with a default answer. Use this type in query_user* instead of decl_question. Write the command handling switch as a separate predicate. This makes it easier for one command to emulate others (e.g. the empty command). If the question has a default answer, print it as part of the prompt. Parse the empty command. doc/user_guide.texi: Update the documentation to reflect the changes. library/list.m: Add a cc_multi version of list__map. tests/debugger/declarative/Mmakefile: tests/debugger/declarative/empty_command.exp: tests/debugger/declarative/empty_command.inp: tests/debugger/declarative/empty_command.m: tests/debugger/declarative/revise.exp: tests/debugger/declarative/revise.inp: tests/debugger/declarative/revise.m: tests/debugger/declarative/revise_2.exp: tests/debugger/declarative/revise_2.inp: tests/debugger/declarative/revise_2.m: Test cases for the new features. |
||
|
|
fb27d22a8f |
Implement a committed choice version of the 'set' module, and use this in
Estimated hours taken: 1.5 Branches: main Implement a committed choice version of the 'set' module, and use this in the declarative debugging oracle. This implementation of sets avoids the use of builtin comparison, which would otherwise cause problems for the oracle. This fixes a bug that was causing test case 'ho5' to fail. browser/set_cc.m: The new module. This is mostly a wrapper around tree234_cc. browser/mdb.m: Make the new module a sub-module of mdb. browser/declarative_oracle.m: Use the new module instead of sets from the standard library. tests/debugger/declarative/Mmakefile: tests/debugger/declarative/ho5.exp: tests/debugger/declarative/ho5.exp2: tests/debugger/declarative/ho5.inp: Enable this test case, and provide input and expected output. |
||
|
|
596bf09f7e |
The "complete" and "incomplete" maps in the declarative debugging oracle
Estimated hours taken: 2 Branches: main The "complete" and "incomplete" maps in the declarative debugging oracle can cause a runtime abort if higher order terms are present in the debuggee, because the maps use sets to represent the solutions to a goal, and sets make use of builtin comparison. This change fixes the problem by replacing the two maps with a single map from initial atom to truth value. The set of solutions is no longer stored explicitly. This change causes no loss of accuracy of the oracle, because we weren't really using the explicit knowledge about solutions anyway. The main drawback of this change is that if in future we implement support for "edit and continue" style debugging (e.g. by allowing previous answers to be saved in/restored from a file), we will lose some of the information pertaining to previous versions of the program, which will make the oracle slightly less effective at deducing new answers from previous ones. Since runtime aborts are a much more serious problem, we will have to live with this drawback for the moment. Another solution to this problem may have been to implement a 'set_cc' module, which would be to 'set' as 'tree234_cc' is to 'tree234'. Unfortunately, we would need to implement 'set_cc__intersect' but it appears not to be possible to implement a satisfactory committed choice version of intersection. browser/declarative_oracle.m: Replace the two maps with the new one, and update the code that accesses the knowledge base. tests/debugger/declarative/Mmakefile: Enable tests 'ho3' and 'ho4', which now work. tests/debugger/declarative/ho3.m: Fix a typo in the test case. It wasn't testing precisely the thing it was supposed to test. tests/debugger/declarative/ho3.exp: tests/debugger/declarative/ho3.inp: tests/debugger/declarative/ho4.exp: tests/debugger/declarative/ho4.inp: Input and expected output for the enabled tests. |
||
|
|
5cbec33da5 |
Add the command 'pd' to the declarative debugger.
Estimated hours taken: 1 Branches: main Add the command 'pd' to the declarative debugger. This command returns to the procedural debugger at the event corresponding to the current question; it is notionally the inverse of the 'dd' command in the procedural debugger. browser/declarative_user.m: Handle the new command, and add a new alternative to the user_response type. browser/declarative_oracle.m: Handle the new user response, and add a new alternative to the oracle_response type. browser/declarative_debugger.m: Handle the new oracle response, and add a new alternative to the diagnoser_response type. Export some procedures to C so that the back end can interpret the new diagnoser response. Update an old comment. trace/mercury_trace_declarative.c: Handle the new diagnoser response. Rename the function MR_decl_handle_bug_found, since it now also handles the case where a symptom has been found. Interpret the diagnoser response using something like a switch, rather than something like an if-then-else. This gives better error messages if the diagnoser response type is changed. doc/user_guide.texi: Document the new command. tests/debugger/declarative/Mmakefile: tests/debugger/declarative/pd.exp: tests/debugger/declarative/pd.inp: tests/debugger/declarative/pd.m: Test the new feature. |
||
|
|
f302f534fd |
Move the code that defines an instance of mercury_edt/2 from
Estimated hours taken: 1 Branches: main Move the code that defines an instance of mercury_edt/2 from browser/declarative_debugger.m into a module of its own. This section of code is large and reasonably self-contained, so it makes sense for it to have its own module. Moreover, declarative_debugger.m contains the main declarative debugging definitions and the upper levels of code for the front end, and the mercury_edt/2 instance doesn't fit into either of these categories. Add an exception handler to the front end, so that if declarative debugging fails for whatever reason, the debugging session can at least continue using the procedural debugger. Rather than calling error in the front end, throw exceptions that are of a type specific to the front end (so we know which errors are ours and which aren't). browser/declarative_debugger.m: Add a new type, diagnoser_exception/0. Handle these exceptions but rethrow any other kind. browser/declarative_debugger.m: browser/declarative_tree.m: Move the mercury_edt/2 instance to the new module. browser/mdb.m: Add the new module to the mdb library. browser/declarative_*.m: Call throw/1 instead of error/1. tests/debugger/declarative/Mmakefile: tests/debugger/declarative/catch.exp: tests/debugger/declarative/catch.inp: tests/debugger/declarative/catch.m: A test case for debugging code that catches exceptions. This sort of code is still not supported by the front end, but at least we now give a decent error message and allow debugging to resume. |
||
|
|
985b13ed3f |
Make I/O actions known to the declarative debugger.
Estimated hours taken: 48
Branches: main
Make I/O actions known to the declarative debugger. The debugger doesn't do
anything with them yet beyond asking about their correctness.
browser/io_action.m:
New module for representing I/O actions, and for constructing the map
from I/O action numbers to the actions themselves.
browser/mdb.m:
Include the new module.
browser/declarative_analysis.m:
Make the map from I/O action numbers to the actions themselves part
of the analyzer state, since conversions from annotated trace nodes
to EDT nodes may now require this information. This information is
stored in the analyzer state because only the analyser needs this
information (when converting annotated trace nodes to EDT tree nodes).
It is not stored in the trace node store because its lifetime is
different: its contents does not change during a tree deepening
operation.
browser/declarative_execution.m:
Store the current value of the I/O action counter with each call and
exit node. The list of I/O actions associated with the atom of the exit
node is given by the I/O actions whose counters lie between these two
values (initial inclusive, final exclusive).
browser/declarative_debugger.m:
browser/declarative_oracle.m:
Distinguish atoms associated with exit nodes from atoms associated with
call nodes, since the former, but not the latter, now have a list of
I/O actions associated with them.
browser/declarative_user.m:
Add mechanisms for printing and browsing the I/O actions associated
with EDT nodes and bugs.
runtime/mercury_trace_base.[ch]:
Move the code for finding an I/O action here from the file
mercury_trace_declarative.c, for use by browser/io_action.m.
runtime/mercury_layout_util.[ch]:
Move a utility function here from mercury_trace_declarative.c,
for use by the code moved to mercury_trace_base.c.
trace/mercury_trace_declarative.c:
When invoking the front end, pass to it the boundaries of the required
I/O action map. Cache these boundaries, so we can tell the front end
when reinvocation of the back end by the front end (to materialize
previously virtual parts of the annotated trace) does not require
the reconstruction of the I/O action map.
trace/mercury_trace_vars.[ch]:
Separate out the code for finding an I/O action from the code for
browsing it, for use in mercury_trace_declarative.c.
Note places where the implementation does not live up to the
documentation.
trace/mercury_trace.[ch]:
Add a parameter to MR_trace_retry that allows retries to cross I/O
actions without asking the user if this is OK.
trace/mercury_trace_internal.c:
trace/mercury_trace_external.c:
Pass MR_FALSE as this new parameter to MR_trace_retry.
tests/debugger/declarative/tabled_read_decl.{m,inp,exp}:
A slightly modified copy of the tests/debugger/tabled_read_decl test
case, to check the declarative debugger's handling of goals with I/O
actions.
tests/debugger/declarative/Mmakefile:
Enable the new test case.
|
||
|
|
68ebc7b53a |
Implement a committed choice version of 234-trees which uses
Estimated hours taken: 10 Branches: main Implement a committed choice version of 234-trees which uses compare_representation instead of builtin compare. Use this to implement the declarative debugger's oracle knowledge base, instead of the standard library map. We do this because the keys used by the oracle may contain non-canonical terms, which would cause a runtime abort if used as map keys. This completes the changes to the declarative debugger to support the debugging of higher order code. (There is still a problem in that the declarative debugger back end does not filter out external events for higher order calls. This means that the declarative debugger asks questions about what are effectively calls to call/N, which is not necessary since we assume that call/N is correct. This is a problem unrelated to this change, so I will deal with it separately.) browser/tree234_cc.m: The new sub-module of mdb, which implements the 234-trees. browser/declarative_oracle.m: Use the new module instead of library/map.m. Propagate the effect of the calls to committed choice code. browser/mdb.m: Include the new module. tests/debugger/declarative/Mmakefile: Enable two old test cases, higher_order and ite_2, that now work after this change. Add a new test case that tests closures with some arguments applied. tests/debugger/declarative/higher_order.exp: tests/debugger/declarative/higher_order.inp: tests/debugger/declarative/ite_2.exp: tests/debugger/declarative/ite_2.inp: Provide input and expected output for these tests. tests/debugger/declarative/ho2.exp: tests/debugger/declarative/ho2.inp: tests/debugger/declarative/ho2.m: New test case. |
||
|
|
14ceb68776 |
Change the definitions of decl_question and decl_answer in the declarative
Estimated hours taken: 24 Branches: main Change the definitions of decl_question and decl_answer in the declarative debugger. Each question now contains a reference to the EDT node that generated the question, and each answer contains the reference from the question it applies to. Previously, the answers referred to the questions themselves. This change means that the analyser no longer needs to unify questions to determine what to do with an answer. The reason we need to avoid this is that questions may contain higher order terms, and these will cause a runtime abort if unified. Also, by using our new approach it is possible to simplify the analyser in a number of ways. This is the first part of a larger change to support declarative debugging of higher order code. The main task remaining is to avoid using comparison of questions in the oracle. But this will require a different approach than the one taken here, because the oracle is interested in the value of the question, not just the identity of it. browser/declarative_*.m: Propagate the effect of the changes to decl_question and decl_answer. Fix some comments which are out of date, and elaborate on some others which don't give enough information. browser/declarative_analyser.m: Remove the definition of the suspect/1 type. Its main purpose was to associate a question with its EDT node, but this is no longer required. Update the places that used suspect(T) to instead use either decl_question(T) or just T, as appropriate. Separate out the code which calculates the analyser response. This requires adding some fields to the analyser state, but this in turn means that the processing of answers can be greatly simplified. This should also make implementing more sophisticated search strategies possible, which is something we want to do in the future. browser/declarative_debugger.m: Make the changes to the two exported types. Export a function which extracts the EDT node from the question. browser/declarative_oracle.m: browser/declarative_user.m: Add a type parameter to oracle_response and user_response, similarly to the change to the other types. tests/debugger/declarative/Mmakefile: tests/debugger/declarative/dependency2.exp: tests/debugger/declarative/dependency2.inp: tests/debugger/declarative/dependency2.m: A test case, which tests for a bug I encountered when developing this change. tests/debugger/declarative/family.exp: Because of the change to the way the analyser matches up the answers with the EDT, a different but equally valid instance of the same bug is chosen in part of this test case. Update the expected output to reflect this. |
||
|
|
ed83014595 |
Make the debugger use the committed choice versions of the
Estimated hours taken: 2 Branches: main browser/*.m: Make the debugger use the committed choice versions of the deconstruction predicates, and propagate the committed choice environment up the call chain as far as necessary. |
||
|
|
75a2a90cbb |
This is the second part of a change to support term dependency analysis
Estimated hours taken: 40 Branches: main This is the second part of a change to support term dependency analysis in the declarative debugger. A `mark' command is implemented for the term browser, which allows a particular subterm to be selected and returned from the browser. The declarative debugger interprets this as a suspicious subterm, and tries to find a child or sibling node from which this subterm comes. This is used to determine the next question to be asked of the oracle. browser/browse.m: Update the browser interface to allow for marked subterms being returned from the browser. Implement and document the mark command. Rewrite run_command as a switch instead of a chain of if-then-elses. This forces all unimplemented commands to be explicitly listed, and gives better error checking. browser/browser_info.m: Add a maybe_mark field to the browser_info. It is initially `no', but is updated when the mark command is given. browser/declarative_analyser.m: Select which child or sibling node to ask about next by searching for the origin of the suspicious subterm. If the subterm has mode `out' we act as if the oracle had answered no, and if the subterm has mode `in' we act as if the oracle had answered yes. In future we may not wish to presume this -- we do so now mainly to keep the analysis algorithm simpler. browser/declarative_debugger.m: Add a functor for suspicious subterms to the decl_answer type. browser/declarative_oracle.m: Accommodate the changed answer type. The oracle does not try to store information about suspicious subterms in the knowledge base, because in principle this could lead to infinite loops (although currently this wouldn't be a problem since we don't ever use the information to move upward in the tree, so no cycle could be formed). browser/declarative_user.m: Accommodate the changed answer type, and interpret marked terms from the browser as suspicious subterms. browser/parse.m: Add the new command. browser/program_representation.m: Add a procedure to convert the browser's list(dir) to a term_path. Change atomic_goal_rep_is_call/2 so it fails for special predicates, which was originally intended. trace/mercury_trace_browse.c: Ignore the extra argument -- marked terms are not currently used in the main debugger. tests/debugger/declarative/Mmakefile: tests/debugger/declarative/input_term_dep.*: tests/debugger/declarative/output_term_dep.*: tests/debugger/declarative/special_term_dep.*: New test cases. |
||
|
|
c5de0d5b0c |
Implement declarative debugging of code that throws exceptions.
Estimated hours taken: 8
Implement declarative debugging of code that throws exceptions.
This aborts if used on code that handles exceptions. There is no point
dealing with this yet, since the oracle won't handle the higher order
argument to try/2.
browser/declarative_debugger.m:
Add "unexpected exception" questions and "unhandled exception" bugs,
and generate these from EXCP events. Handle the exception case
in various switches.
Add a predicate unexpected_exception_children/4, analogous to
{wrong,missing}_answer_children/4.
browser/declarative_execution.m:
Add excp/5 nodes to the event trace, and export a C function to
construct them. Handle these nodes in various switches.
Allow contours to extend beyond NEGE events, if the status is
`undecided'. Such events have no matching NEGS or NEGF event,
so they do not mark the boundary of a separate context.
browser/declarative_oracle.m:
Store information about which exceptions should/shouldn't be thrown
from various calls, and use this information to answer questions
where possible.
browser/declarative_user.m:
Handle the new questions and bugs.
trace/mercury_trace_declarative.c:
Add a function to deal with EXCP events.
trace/mercury_trace_internal.c:
Allow declarative debugging to be started from EXCP events.
tests/debugger/declarative/Mmakefile:
tests/debugger/declarative/throw.m:
tests/debugger/declarative/throw.inp:
tests/debugger/declarative/throw.exp:
tests/debugger/declarative/throw.exp2:
A test case for this feature.
tests/debugger/declarative/queens.exp:
Update the output from this test.
|
||
|
|
134e188154 |
Represent bugs directly rather than with edt nodes.
Estimated hours taken: 10
Represent bugs directly rather than with edt nodes. This makes the
interface to the analyser more consistent: bugs are now handled
in much the same way as questions.
browser/declarative_analyser.m:
- In the mercury_edt/2 typeclass, change edt_root/3 to
edt_root_question/3 and add the method edt_root_e_bug/3.
- Add the type prime_suspect/1 which keeps track of the
evidence (oracle answers) which implicates a particular
edt node.
- Use the new bug representation.
browser/declarative_debugger.m:
browser/declarative_oracle.m:
- Move oracle_confirmation to declarative_debugger.m, and
rename it decl_confirmation.
browser/declarative_debugger.m:
- Change decl_bug/1 to decl_bug/0. Instead of a bug being
represented by an edt node, decl_bug now represents
directly the different sorts of bugs possible.
- Add an implementation for the new mercury_edt method.
browser/declarative_oracle.m:
browser/declarative_user.m:
- Update the confirmation to use the new types.
tests/debugger/declarative/*.{exp,exp2}:
- Update test results.
|
||
|
|
f49968a3ff |
Fix the user interface of the declarative debugger so that it
Estimated hours taken: 15
Fix the user interface of the declarative debugger so that it
produces more readable output; the representation of atoms
is updated so that it can handle non-ground arguments.
Ensure that all DD output goes through the correct stream, so that
the debugger works properly under emacs.
browser/declarative_debugger.m:
Call a procedure in the oracle to handle bug confirmation
(including printing out the bug), rather than handle
it directly.
browser/declarative_execution.m:
Update the trace_atom type so that it can handle both ground
and free arguments. Export to C some procedures for
constructing trace atoms.
browser/declarative_oracle.m:
Export a procedure which handles bug confirmation. This calls
the declarative_user module to do the interaction, and interprets
the result.
browser/declarative_user.m:
Export a procedure to handle bug confirmation by the user.
Update to handle the changes to trace_atom.
trace/mercury_trace_declarative.c:
Construct trace_atoms by calling the new Mercury procedures
exported from browser/declarative_execution.m.
trace/mercury_trace_declarative.h:
Remove the macro that had been used to construct old style atoms.
trace/mercury_trace_vars.{c,h}:
Export a procedure to calculate the argument position of a
head variable.
tests/debugger/declarative/Mmakefile:
tests/debugger/declarative/args.{m,inp,exp,exp2}:
New test case to test mixing bound and free arguments.
tests/debugger/declarative/*.inp:
tests/debugger/declarative/*.exp:
tests/debugger/declarative/*.exp2:
Update test cases to reflect new output, and the extra question
asked for bug confirmation.
|
||
|
|
9ba3b14098 |
Make all the modules in the browser library sub-modules of
Estimated hours taken: 1 Make all the modules in the browser library sub-modules of module `mdb', to avoid link errors when users use module names such as `parse'. browser/Mmakefile: browser/browser_library.m: browser/mdb.m: Rename browser_library.m to mdb.m. Change `:- import_module' declarations to `:- include_module' declarations. browser/Mmakefile: Remove the special case rule for `mer_browser.init' -- it doesn't work when the file names are not the same as the module name. Instead, the default rule for `mdb.init' is used and the output is copied to `mer_browser.init'. browser/.cvsignore: Rename header files, etc. browser/*.m: Add a `mdb__' prefix to the names of modules in the browser library in `:- module' and `:- import_module' declarations. trace/*.c: Rename the header files for the browser library in `#include' statements. tests/hard_coded/Mmakefile: tests/hard_coded/parse.m: tests/hard_coded/parse.exp: Test case. |
||
|
|
3e065c040e |
Implement the new architecture for the front end of the
Estimated hours taken: 120 Implement the new architecture for the front end of the declarative debugger. Disable declarative debugging if conservative GC is not being used since this change relies on it. The benefits of declarative debugging in non-GC grades are not worth the extra maintenance required to support it, since even small examples require a large amount of memory. browser/declarative_analyser.m: New module which handles the analysis of EDTs, which was previously done in browser/declarative_debugger.m. browser/declarative_debugger.m: - Change the interface according to the new design. - Export types of the form decl_*, rather than edt_*. - Move the EDT analysis to the new module. - Handle the interaction between the analyser and the oracle. - Don't interact directly with the user, but go via the oracle. - New diagnoser state type. - Update the EDT instance to conform to the other changes. browser/declarative_oracle.m: - Replace oracle_answer type with oracle_response. - Allow the oracle to work with a queue of questions rather than one at a time. - Add new predicates to manipulate the knowledge base. browser/declarative_user.m: - Export the user_state type. - Handle some user commands in this module. - Handle questions properly (apart from printing atoms). browser/browser_library.m: Add the new module. trace/mercury_trace_declarative.c: - Initialise the front end state just once per session. - Make the step size much larger, since implicit subtrees are not fully supported yet. - Correct the types in a format specifier. trace/mercury_trace_declarative.c: trace/mercury_trace_internal.c: trace/mercury_trace_internal.h: - Disable declarative debugging unless conservative GC is used. |
||
|
|
cc644fcf22 |
This change adds a more sophisticated oracle to the declarative
Estimated hours taken: 55
This change adds a more sophisticated oracle to the declarative
debugger. The oracle now tries to remember previous answers and uses
them if available, and only asks the user if there is no other
information.
browser/declarative_oracle.m:
- Add the type "oracle_assumption", which identifies an
internal assumption of the oracle.
- Add the type "oracle_answer", which the oracle returns to the
caller. This holds either the truth value, or a reason why
the truth value cannot be given yet.
- Implement a knowledge base to store the previous answers.
This data structure is designed to be able to store arbitrary
assertions, although at this stage only one kind of assertion
is used.
- Where possible, use the KB to answer questions, instead of
asking the user.
- Update comments.
browser/declarative_debugger.m:
- Use the new interface to the oracle. Handle "don't know"
answers in a simple way: either save the question and ask it
later or return without finding any bug.
- Move the debugger_command type to this module.
- Move the UI stuff to a new module.
browser/declarative_user.m:
New module to handle interaction between the debugger/oracle
and the user.
tests/debugger/declarative/Mmakefile:
tests/debugger/declarative/oracle_db.{m,inp,exp}
Add a test case for the new feature.
|
||
|
|
07cad7c169 |
If calling from the internal debugger, use readline input for the
Estimated hours taken: 6 If calling from the internal debugger, use readline input for the interactive term browser and interactive queries. browser/browse.m: Change some if-then-elses to switches, which will help catch errors if a new functor is added to the debugger type. browser/parse.m: browser/util.m: Return a string from util__trace_getline/4 rather than a list of chars, which saves converting from a string to a list of chars and then back again. browser/util.m: Add a version of util__trace_getline that also takes I/O stream arguments. Pass these arguments to MR_trace_getline. browser/declarative_oracle.m: Call util__trace_getline/4 to do input via readline (if available). Improve error handling. browser/interactive_query.m: Call util__trace_getline to get user input, instead of standard library predicates. runtime/mercury_init.h: runtime/mercury_wrapper.c: runtime/mercury_wrapper.h: trace/mercury_trace_internal.c: trace/mercury_trace_internal.h: Add two I/O stream arguments to MR_trace_getline. |
||
|
|
5d9569900b |
Clean up the declarative debugger.
Estimated hours taken: 12 Clean up the declarative debugger. browser/declarative_debugger.m: browser/declarative_oracle.m: - Add a new type, oracle_data, to store the oracle database. - Thread an oracle database through a single call to the front end. - Replace `unknown' with a less overloaded name in some type definitions. trace/mercury_trace_declarative.c: trace/mercury_trace_declarative.h: browser/declarative_debugger.m: - Improve documentation. browser/declarative_debugger.m: - Export new type, edt_truth. - Improve the interface to the oracle. - Add a new typeclass, evaluation_tree, and update the previous interface to reflect this. - Make declarative_bug a polymorphic type, and change the constructor for buggy nodes from `wrong' to `e_bug'. |
||
|
|
4fec7f6137 |
Add a front end to the declarative debugger, written in Mercury.
Estimated hours taken: 80 Add a front end to the declarative debugger, written in Mercury. Modify the back end to call this whenever an EDT is built. Also, various bug fixes and improvements. browser/declarative_debugger.m: New module. This is a first implementation of the front end of the declarative debugger. It uses a simple top-down algorithm to search the EDT for a buggy node. The results are printed in a simple format to the output stream. It is called from the back end, in trace/mercury_trace_declarative.c. browser/declarative_oracle.m: New module. This is a first implementation of an oracle for the declarative debugger. It simply passes all queries directly on to the user. browser/browser_library.m: Import the new modules. trace/mercury_trace_declarative.c: - Various fixes/improvements of comments. - Fix bugs where `int' is used instead of `Unsigned'. - Pass the event_info structure to MR_trace_decl_update_path, rather than passing various components of it. - Use the copy of MR_trace_event_number in the event_info structure rather than referring to the global variable directly. - Remove the EDT printing functions, as they have been superseded by the new front end. Call the new front end instead of these old functions. - Provide an interface to the EDT nodes that is imported by the front end. - Ensure that, after diagnosis, we end up at the same event we started at. - Fix a bug where it was assumed all procedures had at least one argument. - Ensure that the user is notified if the dd_wrong operation cannot be started due to MR_trace_retry failing. trace/mercury_trace_declarative.h: - Move a #include to the correct place. - Declare the interface to the EDT nodes. trace/mercury_trace_internal.c: Fix a bug introduced earlier. runtime/mercury_conf_param.h: Add a new configuration macro, MR_DEBUG_DD_BACK_END. When defined this causes information about the declarative debugger back end to be printed out during operation. |