Estimated hours taken: 6
Pass around event information for the tracing system in an
MR_Event_Info struct instead of passing each item as a separate
argument. Use Unsigned consistently for the type of the call
depth and call sequence number.
trace/mercury_trace.h:
Add the new MR_Event_Info structure.
trace/mercury_trace.{c,h}:
trace/mercury_trace_declarative.{c,h}:
trace/mercury_trace_external.{c,h}:
trace/mercury_trace_internal.{c,h}:
Use the new structure.
runtime/mercury_trace_base.c:
Use Unsigned as the type of the call depth and sequence number.
Estimated hours taken: 0.1
doc/reference_manual.texi:
Fix some off-by-one errors in the code examples
for the use of nondet `pragma c_code'.
Thanks to Juergen Stuber <juergen@mpi-sb.mpg.de>
for pointing out the errors.
Estimated hours taken: 0.25
doc/reference_manual.texi:
Reword a few things, as suggested by dgj's review of my recent change.
Also mention that the typeclass constraints on an abstract instance
declaration must exactly match those on the corresponding definition.
Estimated hours taken: 1
Add a pred_or_func attribute to the Mercury event for the external debugger
that indicates if the current procedure is a function or a predicate.
browser/debugger_interface.m:
trace/mercury_trace_external.c:
Add a slot in MR_found_match() and MR_output_current_slots() for the
pred_or_func attribute.
runtime/mercury_stack_layout.h.
Add a comment to say that The MR_PredFunc enummeration should EXACTLY
match the definition of the `pred_or_func' type in
browser/debugger_interface.
Estimated hours taken: 3
Fix a bug in the external debugger. The execution was crashing during the
printing of polymorphic arguments. In runtime/mercury_layout_util.c,
MR_get_type_filtered() and MR_get_type_and_value_filtered() were calling
MR_get_type() and MR_get_type_and_value() without type_info information (third
argument set to NULL), which is needed to retrieve polymorphic types.
runtime/mercury_layout_util.[ch]:
Pass down type_info in argument of MR_get_type_and_value_filtered() and
MR_get_type_filtered() to be able to call MR_get_type_and_value() and
MR_get_type() with type_info information.
runtime/mercury_layout_util.c
Filter out variables which names begin by "TypeClassInfo" in
MR_get_type_and_value_filtered() (as it was already done in
MR_get_type_filtered()).
runtime/mercury_layout_util.c
trace/mercury_trace_external.c:
In a few functions, do not try to retrieve information about live
variables if it does not exist any.
trace/mercury_trace_external.c:
Pass type_info in argument of MR_get_type_and_value_filtered()
and MR_get_type_filtered().
Filter out in MR_trace_make_var_names_list() the variable names
that are also filtered in MR_get_type_and_value_filtered().
Estimated hours taken: 7
This change implement stack dump commands for the external debugger.
The MR_dump_stack_record_print() defined in runtime/mercury_stack_trace.c is
the function that prints the contents of the stack. We move the definition of
this function to mercury_trace_internal.c and we pass down that function as a
parameter of MR_dump_stack_from_layout(). The rational for this change is that
we can then define a new MR_dump_stack_record_print_to_socket() in
mercury_trace_external.c that prints the data to the socket as a Prolog term
and pass down the address of that new function to MR_dump_stack_from_layout().
browser/debugger_interface.m:
Add three new kinds of requests: stack, nondet_stack and stack_regs.
trace/mercury_trace_external.c:
Define new MR_dump_stack_record_print_to_socket() and
MR_print_proc_id_to_socket() that sends data to the socket as Prolog
terms.
Add support for stack, nondet stack and stack_regs requests.
runtime/mercury_stack_trace.[ch]
trace/mercury_trace.[ch]:
trace/mercury_trace_internal.[ch]:
Move the definition of MR_dump_stack_record_print(),
from mercury_stack_trace.c to mercury_trace_internal.c.
Add MR_dump_stack_record_print() as an argument of all the
functions that need it in mercury_stack_trace.c.
Move the definition of detism_names[] from mercury_stack_trace.c
to mercury_trace.c. This function is needed by both versions of
MR_dump_stack_record_print(). Rename detism_names[] by
MR_detism_names[].
runtime/mercury_stack_trace.[ch]
trace/mercury_trace_tables.[ch]:
Move the definition of MR_print_proc_id() and
MR_print_proc_id_for_debugger() from mercury_stack_trace.c to
mercury_trace_tables.c since MR_print_proc_id() is called in that
module.
Include mercury_trace.h since we now make use of detism_names[] there.
Estimated hours taken: 0.25
doc/reference_manual.texi:
Add various people to the authors list, since they have all made
substantial contributions: Peter Schachte (impurity),
Simon Taylor (module qualifications & use_module,
Aditi compilation, and [soon] type specialization),
and Chris Spiers (termination analysis).
Estimated hours taken: 0.5
Allow HLDS dumps to contain references to the pointers used by tabling.
Without this chance, HLDS dumps can abort on modules containing tabled
procedures.
compiler/hlds_out.m:
Allow HLDS dumps to contain references to the pointers used by tabling.
This requires adding an extra argument to an exported procedure.
compiler/mode_errors.m:
compiler/typecheck.m:
Pass the extra argument that exported procedure.
Estimated hours taken: 0.5
Fix a bug with the handling of instance declarations with no methods.
compiler/check_typeclass.m:
Ensure that the MaybePredProcs field of the HLDS instance definition
for instance definitions with no methods is set to `yes([])' rather
than `no' -- the latter would indicate that this pass hasn't been
run yet.
Estimated hours taken: 0.25
Implement abstract instance declarations.
(I forgot to commit changes to these two files as part of my last commit.)
compiler/mercury_to_mercury.m:
compiler/module_qual.m:
Change the code to reflect the new name and representation
of `instance_interface'.
Estimated hours taken: 9
Implement abstract instance declarations.
compiler/prog_data.m:
Rename the `instance_interface' type as `instance_body',
and make it a discriminated union: either `abstract',
or `concrete(Methods)'.
compiler/prog_io_typeclass.m:
compiler/hlds_data.m:
compiler/hlds_out.m:
compiler/equiv_type.m:
compiler/check_typeclass.m:
Change the code to reflect the new name and representation
of `instance_interface'.
compiler/prog_io_typeclass.m:
Parse abstract instance declarations.
compiler/make_hlds.m:
Clean up the code a bit, and make sure that it detects some errors
which previously we didn't detect: duplicate or overlapping
instance declarations, and instance declarations with methods for
classes with no methods.
compiler/check_typeclass.m:
If an instance is abstract, then we don't need to check
that the methods in the instance body match those in the class.
compiler/base_typeclass_info.m:
Only generate base_typeclass_infos for concrete instance
declarations, not for abstract ones.
doc/reference_manual.texi:
Document the change.
tests/hard_coded/typeclasses/Mmakefile:
tests/hard_coded/typeclasses/abstract_instance.m:
tests/hard_coded/typeclasses/use_abstract_instance.m:
tests/hard_coded/typeclasses/use_abstract_instance.exp:
tests/invalid/Mmakefile:
tests/invalid/typeclass_test_9.m:
tests/invalid/typeclass_test_9.err_exp:
Some test cases.
tests/hard_coded/typeclasses/Mmakefile:
Uncomment typeclass_test_5.m, since we pass that now
(and have done so for quite some time).
tests/invalid/typeclass_test_[3-5].err_exp:
Update to reflect additional error messages produced
by the improved error checking in compiler/make_hlds.m.
Estimated hours taken: 9
Implement abstract instance declarations.
compiler/prog_data.m:
Rename the `instance_interface' type as `instance_body',
and make it a discriminated union: either `abstract',
or `concrete(Methods)'.
compiler/prog_io_typeclass.m:
compiler/hlds_data.m:
compiler/hlds_out.m:
compiler/equiv_type.m:
compiler/check_typeclass.m:
Change the code to reflect the new name and representation
of `instance_interface'.
compiler/prog_io_typeclass.m:
Parse abstract instance declarations.
compiler/make_hlds.m:
Clean up the code a bit, and make sure that it detects some errors
which previously we didn't detect: duplicate or overlapping
instance declarations, and instance declarations with methods for
classes with no methods.
compiler/check_typeclass.m:
If an instance is abstract, then we don't need to check
that the methods in the instance body match those in the class.
compiler/base_typeclass_info.m:
Only generate base_typeclass_infos for concrete instance
declarations, not for abstract ones.
doc/reference_manual.texi:
Document the change.
tests/hard_coded/typeclasses/Mmakefile:
tests/hard_coded/typeclasses/abstract_instance.m:
tests/hard_coded/typeclasses/use_abstract_instance.m:
tests/hard_coded/typeclasses/use_abstract_instance.exp:
tests/invalid/Mmakefile:
tests/invalid/typeclass_test_9.m:
tests/invalid/typeclass_test_9.err_exp:
Some test cases.
tests/hard_coded/typeclasses/Mmakefile:
Uncomment typeclass_test_5.m, since we pass that now
(and have done so for quite some time).
tests/invalid/typeclass_test_[3-5].err_exp:
Update to reflect additional error messages produced
by the improved error checking in compiler/make_hlds.m.
Estimated hours taken: 0.5
trace/mercury_trace.h:
trace/mercury_trace.c:
Add a missing const on the return type of MR_trace_retry().
trace/mercury_trace.c:
Delete an old `#include <unistd.h>', since it is no longer needed.
trace/mercury_trace_internal.c:
Fix two bug: check whether the return value from
MR_trace_retry() is null; if it is null, don't try to print it
out (this fixes a bug Erwan introduced), and if it is not null,
then after printing out the message, keep interacting with the
user rather than doing a step (this fixes a bug in Zoltan's
original code).
Estimated hours taken: 0.1
tools/test_mercury:
Don't rebuild the `.exp' files using NU-Prolog.
Building one of the (tests/general/string_format_test_2) was failing,
apparently due to the use somewhere of a function rather than a
predicate, and our plan is to phase out the Prolog support,
so not worth fixing this. Instead we now just treat the `.exp'
files in the `general' directory as being hard-coded,
just like those in the `hard-coded' directory.
Estimated hours taken: 10
This change implement the retry command for the external debugger.
trace/mercury_trace.[ch]:
trace/mercury_trace_internal.[ch]:
Move MR_trace_retry() and MR_trace_find_input_arg() from
mercury_trace_internal.c to mercury_trace.c since they are also needed
in the external debugger.
MR_trace_retry() now returns a `char *' pointer which is either
NULL if the retry proceeds correctly or an error message if it fails.
trace/mercury_trace_internal.h:
trace/mercury_trace.h:
Move the definition of the type MR_Event_Details from
mercury_trace_internal.h to mercury_trace.h since both are also
needed in the external debugger.
Idem for the constant MR_INIT_ARG_COUNT.
trace/mercury_trace.c:
trace/mercury_trace_external.[ch]:
MR_trace_external() now returns a code address to jump in.
Pass the integer max_mr_num in argument of MR_trace_external() since
it is needed by MR_trace_retry().
Add a MR_send_message_to_socket_format() that allows to send formated
message to the socket. I need that because the error message send to the
socket must be a prolog term.
trace/mercury_trace_external.c:
Implement the retry command in MR_trace_event_external().
browse/debugger_interface.m:
Add support for the retry port.
Make all the lines fits in 80 colums.
Estimated hours taken: 0.25
tests/hard_coded/Mmakefile:
tests/hard_coded/factt.m:
tests/hard_coded/factt_examples:
tests/hard_coded/factt.exp:
Add a regression test to test three recently-fixed bugs
related to fact tables:
- duplicate C labels,
- incorrect dependencies with --use-subdirs, and
- undefined symbols due to passing the wrong arguments
to c2init.
Estimated hours taken: 1
compiler/modules.m:
Fix a bug with the arguments passed to c2init by the generated `.dep'
file when using fact tables: it should not pass the fact table `.c'
files to c2init, because the fact table `.c' files do not have
(or need) any initialization function.
Estimated hours taken: 1.5
Fix a bug where inlining of fact tables caused duplicate
labels in the generated C code.
compiler/make_hlds.m:
Make `pragma fact_table' imply `pragma no_inline'.
compiler/fact_table.m:
Update some old comments which said that nondet `pragma c_code'
was not yet implemented.
doc/reference_manual.texi:
Document that `pragma c_code' should not contain labels
unless there is a matching `pragma no_inline'.
Estimated hours taken: 0.25
Fix a bug that was causing mdb's detailed stack traces to come out
incorrectly on some occaisions.
runtime/mercury_stack_trace.c:
Fix a bug: `maybe_from_full' should have type `Integer', not `Word'.
Estimated hours taken: 2
Fix a bug where mdb was sometimes failing to stop at breakpoints
(my previous fix for this was incomplete).
trace/mercury_trace_spy.c:
Introduce a new function MR_compare_addr() and use it for the
the comparison argument to MR_prepare_for_sorted_insert()
and MR_bsearch. This fixes the following problems:
- the comparison argument for those functions
needs to have type `int', not `Unsigned';
- the sense of the comparison argument to
MR_prepare_for_sorted_insert() was inverted.
runtime/mercury_array_macros.h:
Document that the comparison argument to MR_prepare_for_sorted_insert()
and MR_bsearch needs to have type `int'.
Estimated hours taken: 0.1
library/std_util.m:
Add parentheses to use of `some' in type declaration for has_type/2,
to avoid syntax error for SICStus Prolog.
Estimated hours taken: 0.5
doc/reference_manual.texi:
Explicitly disallow (1) cyclic equivalence types and
(2) instance declarations containing abstract types
which are defined as equivalence types.
Regarding (1), this was always the intent, but due to
oversight it was not explicitly stated until now.
For the rationale for (2), see the recent
discussion on the mercury-users mailing list.
Estimated hours taken: 0.75
Fix a bug with I/O interleaving which was causing some of the
debugger test cases to fail.
trace/mercury_trace_internal.c:
Ensure that MR_mdb_err is unbuffered, and that we always
fflush(MR_mdb_out) before writing to MR_mdb_out.
Estimated hours taken: 0.5
Fix a bug reported by Peter Ross <petdr@cs.mu.OZ.AU>
where mdb was sometimes failing to stop at breakpoints.
trace/mercury_trace_spy.c:
Fix a bug -- the sense of the comparison argument to MR_bsearch()
was inverted.
Estimated hours taken: 4.5
Implement demangling for instance declarations (i.e. base_typeclass_infos).
compiler/base_typeclass_info.m:
compiler/llds_out.m:
Change the way name mangling for base_typeclass_infos is done
to ensure that they can be unambiguously demangled.
util/mdemangle.c:
profiler/demangle.m:
Add code to demangle base_typeclass_infos.
util/mdemangle.c:
Fix a bug: if it got part way through demangling a symbol
before noticing that it had the wrong format, then it would
sometimes print out a partially demangled version of the
symbol rather than printing out the original symbol unchanged.
tests/debugger/*.exp*:
Update the expected output to reflect the new mangling scheme.
(Really the debugger ought to demangle the names, but
currently it doesn't.)
Estimated hours taken: 2
MR_trace_init_external() and MR_trace_final_external() are defined
in trace/mercury_trace_external.c but are also needed in
runtime/mercury_trace_base.c. As we can not do direct calls from
runtime/ to trace/, we do an indirect call via a function
pointer address_of_trace_init_external.
runtime/mercury_trace_base.c:
Remove an out of date comment.
runtime/mercury_init.h:
runtime/mercury_wrapper.c:
runtime/mercury_wrapper.h:
Add prototype declaration for MR_trace_init_external()
and MR_trace_final_external().
runtime/mercury_wrapper.h:
util/mkinit.c:
Remove useless prototypes.
Estimated hours taken: 0.25
configure.in:
Delete the test for SA_RESTART.
The only reason for that test was to warn if SA_RESTART
was not defined, but the test was giving spurious warnings in
some cases (e.g. on Linux, due to siginfo_t not being defined),
so it seems to be doing more harm than good.
Estimated hours taken: 0.1
Apply a patch from Bas de Bakker <basde.bakker@pica.nl>.
doc/transition_guide.texi:
Update the table of operator precedences.
Fix an error in the mode declaration for factorial.
Estimated hours taken: 0.5
doc/user_guide.texi:
doc/reference_manual.texi:
Update/clarify the documentation about the rules for naming
source files when using separate sub-modules.
Estimated hours taken: 6
Fix a memory allocation bug reported by
Warwick Harvey <wharvey@cs.monash.edu.au>.
library/std_util.m:
runtime/mercury_type_info.c:
Use `newmem()' rather than `malloc()' when allocating memory
that will contain Mercury terms or types. This is needed
because the Boehm collector does not trace memory allocated
with malloc().
Estimated hours taken: 0.75
Fix some bugs where we were not properly escaping special characters in
C strings in the generated code.
compiler/llds_out.m:
Change a number of places to call output_quoted_c_string instead of
io__write_string, so that special characters will be properly escaped.
Add new predicate llds_out__quote_c_string, for use by pragma_c_gen.m.
compiler/pragma_c_gen.m:
Call llds_out__quite_c_string, to ensure that special characters
in the generated "pragma_c_raw_code" are properly escaped.
tests/valid/int64.m:
tests/valid/Mmakefile:
Regression test for the above-mentioned bug fix.
Estimated hours taken: 220
Changes to the internal tracer to implement a declarative
debugging back end.
runtime/mercury_conf_param.h:
Document the new MR_USE_DECLARATIVE_DEBUGGER configuration
parameter.
trace/mercury_trace_internal.{c,h}:
Declare a global variable, MR_trace_decl_mode, that stores the
current mode of the internal debugger, and an enum listing the
possible modes.
Move MR_Event_Details and MR_trace_retry into
mercury_trace_internal.h, and make the latter extern, so that
the declarative debugger back end can use them.
trace/mercury_trace_internal.c:
Call the back end in mercury_trace_declarative.c.
Add a new command, dd_wrong, to start wrong answer analysis.
trace/Mmakefile:
Add mercury_trace_declarative.{c,h} to the dependencies.
trace/mercury_trace_declarative.{c,h}:
The declarative debugging back end (new files).
Estimated hours taken: 0.1
library/std_util.m:
Add parentheses to use of `some' in type declaration for univ_value/1,
to avoid syntax error for SICStus Prolog.