Commit Graph

13 Commits

Author SHA1 Message Date
Julien Fischer
e3b2cc1272 Fix generation of the debugger documentation on Windows.
We generate the debugger documentation files, e.g. the command list, by
processing the output of the info tool and running through a series of sh and
awk scripts. This is breaking builds for MSYS based systems on Windows because
the port of awk there does not handle non-ASCII characters and info will
sometimes output those. Using the C locale on affected systems causes the
output of info to be ASCII.

doc/generate_mdb_doc:
    Force the use of the C locale on MSYS / MinGW systems in order to avoid
    problems with awk.

    Shut up some warnings form shellcheck.
2023-05-13 16:51:57 +10:00
Zoltan Somogyi
a06ae2c6ef Simplify the code of the mdb help system.
browser/help.m:
    Simplify the data types representing the nested structure
    of help information. Simplify the code of the predicates
    that work on that structure.

    Simplify some of the predicates, e.g. by having a search predicate
    do *just* search.

    Give types and predicates more meaningful names. Make argument order
    more suitable for state-variables. Move a predicate next to its
    only call site.

browser/declarative_user.m:
    Conform to the change in help.m.

    Replace two bools with values of bespoke types.

browser/declarative_debugger.m:
browser/declarative_oracle.m:
    Conform to the changes in help.m and declarative_user.m.

doc/generate_mdb_doc:
    Fix the vim modeline.

trace/mercury_trace_declarative.c:
trace/mercury_trace_help.c:
    Conform to the changes in the browser directory.

util/info_to_mdb.c:
    Switch from /**/ to // for comments.

    Give a macro a meaningful name.

    Fix indentation.
2020-08-14 11:04:17 +10:00
Zoltan Somogyi
7e1cdb70aa Fix a problem that truncated mdb_doc files.
util/info_to_doc.c:
    Fix a problem that caused the generation of truncated mdb_doc files,
    and from that truncated test/debugger/mdb_command_test.inp files.
    The problem was that this program expected the info program to quote
    the initial line of each mdb command like this:

        `cmdname options ...'

    but on some machines, including mine, it quotes them like this:

        'cmdname options ...'

    i.e. with the initial as well as the final quote being a forward quote.
    This program now accepts either.

util/Mmakefile:
    Fix white space.

doc/generate_mdb_doc:
    Fix inconsistent indentation. Protect shell variable references.

doc/Mmakefile:
    Generate an error message if a similar problem occurs again
    when creating mdb_doc.

    Fix indentation.

tools/bootcheck:
    Generate an error message if a similar problem occurs again
    when copying tests/debugger/mdb_command_test.inp.
2014-01-22 09:31:37 +11:00
Ian MacLarty
bf205a5dde Changes the table_io' mdb help category to io_tabling', so that
Estimated hours taken: 0.1
Branches: main

doc/generate_mdb_doc:
doc/mdb_categories:
	Changes the `table_io' mdb help category to `io_tabling', so that
	you get help on the table_io command when you type `help table_io'
	(previously you got a message about the I/O tabling group of commands,
	which wasn't very helpful and you needed to type `help table_io
	table_io' to get help about the table_io command).
2006-02-04 14:30:02 +00:00
Ian MacLarty
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.
2005-05-02 04:21:19 +00:00
Ian MacLarty
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.
2004-11-16 00:45:14 +00:00
Zoltan Somogyi
32d4fdef8a Rationalize the mechanisms we use to control retry across I/O.
Estimated hours taken: 8
Branches: main

Rationalize the mechanisms we use to control retry across I/O.

After this change, we never ask questions about retry across I/O if the retry
is guaranteed to be safe. If the I/O is not guaranteed to be safe, there are
three things we can do:

- We ask the user whether they really want to. This is the default, and can be
  asked for explicitly with "retry --interactive".

- We perform the retry without asking questions. This can be asked for
  explicitly with "retry --force".

- We abort the retry automatically without asking questions. This can be asked
  for explicitly with "retry --only-if-safe".

The implicit retries used to implement declarative debugging and the indirect
retries needed in the presence of minimal model tabling use the last option.

We need two conditions for the retry to be guaranteed to be safe:

- All I/O actions must be tabled.
- The retry must be wholly within the tabled region of the execution.

The first is normally assured by a debugging grade. However, to allow test
cases to test the behavior of retries even with --only-if-safe (and hence to
allow the testing of declarative debugging), we have another new flag,
--assume-all-io-is-tabled, which asserts the first condition to be true
even in non-debugging grades. This option applies both to the retry command
and the dd and dd_dd commands.

doc/user_guide.texi:
	Move the misc commands (which are intended for use by everybody)
	before the experimental and developer commands (which are intended
	for use only by developers).

	Document the dd_dd command in the developer section.

	Document the new options of the retry, dd and dd_dd commands, with
	the documentation of the developer-only options commented out.

	Consolidate the documentation of the two variants of the retry command
	into one, in order to reduce duplication.

	Add a cross-reference requested by Fergus.

	Add an XXX asking Mark to document the optional argument of dd_dd.

doc/generate_mdb_doc:
	Switch the order of sections to match the change in user_guide.texi.

doc/mdb_categories:
	Switch the order of sections to match the change in user_guide.texi,
	and include dd and dd_dd in the command lists.

runtime/mercury_trace_base.[ch]:
	Add a pair of global variables recording the event numbers at which
	I/O tabling is turned on and off.

	Make some declarations use the right typedef.

trace/mercury_trace.[ch]:
	Make MR_trace_retry respect the values of the new options
	controlling retries passed to it.

	Convert this file to four-space indentation to reduce the number of
	line-wraps.

trace/mercury_trace_declarative.[ch]:
	Record the value of one of the options controlling retries for the
	current invocation of `dd' in a global variable, since the front end
	can initiate retries even after the initial retry.

	Pass the required option values to retry.

trace/mercury_trace_external.c:
	Pass the required option values to retry.

trace/mercury_trace_internal.c:
	Implement the new options of the retry, dd and dd_dd commands.
	Pass the required option values to retry.

	Make "table_io start" and "table_io stop" record the relevant event
	numbers in the global variables designed to hold them, for use in
	mercury_trace.c in deciding whether a retry is safe.

	Make indirect retries (used only in minimal model grades) use only safe
	retries.

	Make the dd and dd_dd commands use the help system to print usage
	messages, now that they are both documented.

	To make this possible, make the dd command part of the "misc" category
	and the dd_dd command part of the "developer" category, which are the
	categories they are documented under in user_guide.texi.

tests/debugger/mdb_command_test.inp:
	Update this automatically generated list of commands.

tests/debugger/tabled_read.{inp,exp}:
tests/debugger/tabled_read_decl.{inp,exp}:
	Update the retry commands in these tests to use the new options
	where relevant.

tests/debugger/declarative/tabled_read_decl.{inp,exp}:
	Update the dd commands in these tests to use the new options
	where relevant.
2002-11-06 02:02:38 +00:00
Zoltan Somogyi
d9122a1b30 Document I/O tabling, after cleaning it up for public use.
Estimated hours taken: 6
Branches: main

Document I/O tabling, after cleaning it up for public use.

We have previously implemented two forms of I/O tabling. One tables
only the output arguments of each primitive; this allows transparent
retries across I/O. The other tables all the arguments and the name
of the predicate; this allows transparent retries across I/O, the
declarative debugging of code that does I/O, and the printing of tabled
I/O actions. Since we now support declarative debugging in the standard
debugging grades, standardize on the second form of I/O tabling, and
make the first form accessible to implementors only, via a deliberately
undocumented option. This option, --trace-table-io-only-retry, is sort of
the inverse of the old option --trace-table-io-decl, which this change
deletes. (Only "sort of" because --trace-table-io-decl used to turn on
I/O tabling, whereas --trace-table-io-only-retry is consulted only if
I/O tabling is turned on by some other mechanism.)

NEWS:
	Mention I/O tabling.

compiler/options.m:
	Delete --trace-table-io-decl, and add --trace-table-io-only-retry.

	Update documentation.

compiler/table_gen.m:
	Base decisions on --trace-table-io-only-retry, not
	--trace-table-io-decl.

compiler/handle_options.m:
	Delete an implication involving --trace-table-io-decl that is now
	unnecessary.

doc/user_guide.texi:
	Document the idea of I/O tabling, and move the table_io command
	out of the list of developer only commands into a category of its own
	(since it doesn't naturally fit anywhere else).

	Change the old mismatched "table_io start" "table_io end" pair to
	the matched "table_io start" "table_io stop" pair.

	Document the variants of the print and browse commands that print and
	browse I/O actions.

	Be consistent about formatting of categories of mdb commands.

	Comment out some obsolete material in the documentation of retry.

doc/generate_mdb_doc:
	Include the new table_io category in the list of mdb command
	categories.

	Squeeze out repeated blank lines in the automatically generated
	documentation, to make maximum use of screen real estate.

doc/squeeze:
	A new script to do the squeezing.

doc/mdb_categories:
	Include the new table_io category in the list of mdb command
	categories.

runtime/mercury_trace_base.[ch]:
	Add a new global variable MR_io_tabling_allowed. It is initialized
	to TRUE in debugging grades and FALSE in other grades.

trace/mercury_trace_internal.c:
	Accept "table_io begin" and "table_io end" as well as "table_io start"
	and "table_io stop". Consistently use "start" and "stop" in output.

	Make "table_io" print a message saying the executable is not set up
	for I/O tabling unless MR_io_tabling_allowed is set.

	Add a new command, "table allow", that sets MR_io_tabling_allowed to
	TRUE. In debugging grades, this has no effect. In other grades, it
	allows I/O tabling, even though some parts of the program may have
	been compiled with --trace-table-io and some without. This
	inconsistency can yield weird results, which is why this command is
	deliberately undocumented. However, we can use it in a disciplined
	fashion to test I/O tabling even in nondebugging grades, thus spotting
	any regression in this area more quickly than if we tested I/O tabling
	only in debugging grades.

tests/debugger/Mercury.options:
tests/debugger/declarative/Mercury.options:
	Delete all occurrences of --trace-table-io-decl, since its effect is
	now the default.

tests/debugger/mdb_command_test.inp:
	Move the location of the table_io command test in this autogenerated
	file to reflect its move to a new category.

tests/debugger/tabled_read*.{inp,exp}:
tests/debugger/declarative/tabled_read*.{inp,exp}:
	Execute "table_io allow" before trying to turn on I/O tabling, since
	this is now required in non-debugging grades.

	Reflect the change in terminology: expect "stopped", not "ended",
2002-10-22 04:36:26 +00:00
Tyson Dowd
d1938d4019 Improve build and installation on MS-Windows.
Estimated hours taken: 3

Improve build and installation on MS-Windows.

configure.in:
Mmake.common.in:
	Set extension for executables (.exe for Windows, nothing
	otherwise).
	Detect presence of perl, makeinfo, texi2dvi and dvips.

Mmakefile:
README.MS-Windows:
	Remove old preinstall and postinstall hacks for windows.

compiler/Mmakefile:
profiler/Mmakefile:
util/Mmakefile:
	Use the extension for executables when installing.

doc/Mmakefile:
	Don't generate documentation unless the appropriate tools
	are available.  Use the auto-detection of perl,
	makeinfo, texi2dvi and dvips to build documentation.

doc/generate_mdb_doc:
	Don't insist on rm being in /bin
1999-07-20 21:30:02 +00:00
Fergus Henderson
feb61595d9 Fix a bug where doc/generate_mdb_doc was putting the documentation for
Estimated hours taken: 0.5

Fix a bug where doc/generate_mdb_doc was putting the documentation for
the interactive query commands in the category "interactive" whereas
doc/mdb_categories was expecting this category to be called "queries".

util/info_to_mdb.c:
	Print error messages to stderr rather than stdout.
	Document the first argument as being a category name
	(the name of an mdb help category) rather than a section name.

doc/generate_mdb_doc:
	Avoid the assumption that the category name is the same as the
	section name; that is still the default, but it now sets the
	category for the "interactive" section to "queries".
	Invoke info_to_mdb with the category name rather than the
	section name.

trace/mercury_trace_internal.c:
	Update the category names in the pseudo-automatically-generated
	command list to reflect the above change.
	(Also improve an error message slightly.)
1999-03-25 10:42:57 +00:00
Fergus Henderson
3b63e88a6f Add "interactive" (queries) to the list of user guide section names
Estimated hours taken: 0.1

doc/generate_mdb_doc:
	Add "interactive" (queries) to the list of user guide section names
	containing documentation about mdb commands.
1999-03-24 12:26:20 +00:00
Tyson Dowd
ef19790bdc Use "./mercury_user_guide.info" instead of
Estimated hours taken: 0.5

doc/generate_mdb_doc:
	Use "./mercury_user_guide.info" instead of
	mercury_user_guide.info because otherwise info will try to
	use the installed info file instead of the local one.
	(Which isn't very successful if the installed one lacks
	a debugging chapter).
1998-11-02 02:34:39 +00:00
Zoltan Somogyi
16f3d4ccaa This checkin has several major purposes, set out in the sections below,
Estimated hours taken: 240

This checkin has several major purposes, set out in the sections below,
all connected with the implementation of the new debugger command set.

DOCUMENT NEW DEBUG COMMAND SET

doc/user_guide.texi:
	Add a new section on the debugger. The description of the commands
	is complete, but some of the background sections, and the section
	about how to build debuggable executables, are not yet done.

	Update the documentation of the tracing options.

doc/generate_mdb_doc:
	A new shell script that automatically converts some of the new
	sections of the user guide into the online documentation of the
	debugger.

doc/mdb_categories:
	The fixed initial part of the online documentation.

doc/Mmakefile:
	Add rules for creating mdb_doc, the file that is the online
	documentation of the debugger, and for installing it together
	with mdbrc.

Mmake.common.in:
	Define INSTALL_DOC_DIR for doc/Mmakefile.

scripts/mdbrc.in:
	A debugger command script that reads in the online documentation
	and then defines some standard aliases.

configure.in:
	Define the variable that scripts/mdb.in and scripts/mdbrc.in use
	to find the right files, and get configure to perform the
	substitutions.

configure.in:
scripts/mdb:
scripts/mdb.in:
	Replace mdb with mdb.in. Mdb is now created during configuration
	from mdb.in, filling in the name of the file that contains the default
	debugger initialization commands.

util/info_to_mdb.c:
	A program that does most of the work involved in automatically
	converting user guide sections into online documentation.
	(This couldn't easily be written in sh, because sh's read
	command has no notion of pushback.)

util/Mmakefile:
	Add info_to_mdb to the list of targets.

tools/bootcheck:
	Make sure that the tests in tests/debugger are executed with an
	initialization setup that is equivalent to what users will see
	by default.

REORGANIZE TRACING OPTIONS

compiler/globals.m:
compiler/handle_options.m:
compiler/options.m:
compiler/trace.m:
	Reorganize the handling of trace levels around the new options
	--trace-internal, --trace-redo, and --trace-return.

compiler/*.m:
	Use the new ways of getting at trace levels.

tests/hard_coded/typeclasses/Mmakefile:
	s/--trace all/--trace deep/

SUPPORT RETRY

compiler/trace.m:
	After every call to MR_trace(), emit code that checks whether it
	should jump away, and if yes, performs the jump. This is used to
	implement retry. (The debugger cannot execute the jump itself
	because it is in the wrong C stack frame.)

compiler/llds.m:
compiler/continuation_info.m:
compiler/stack_layout.m:
	Modify the data structures that record information about live
	value at program points, to record the identity of each variable.
	This is necessary for the implementation of the restart command,
	since we do not want to confuse two distinct variables just because
	they have the same name. For example, a variable whose name is X
	and number is 5 is now recorded in the name array as "5:X".

	Clean up the data structure a bit, so that we don't have to store
	dummy names for values that are not variables.

compiler/*.m:
	Minor changes to conform to the data structure changes.

runtime/mercury_stack_layout.h:
	Redefine an existing macro to strip away the initial number: prefix
	from the "name" of a variable (keeping its original function on
	changed data), and add a new one to access the raw unstripped data.

runtime/mercury_init.h:
runtime/mercury_wrapper.h:
	Update the prototype of MR_trace_{fake,real}, and the type of the
	global that points to them.

runtime/mercury_layout_util.h:
	Add an extra function, MR_get_register_number, for use by retry.

USE FIXED STACK SLOTS FOR TRACE INFO

compiler/code_gen.m:
compiler/code_info.m:
compiler/live_vars.m:
compiler/trace.m:
	If execution tracing is enabled, reserve the first few stack slots
	to hold the event number of the call event, the call number, the
	call depth, the redo layout structure address (if generating redo
	events) and the from_full flag at the time of call (if we are doing
	shallow tracing). By allocating the first four of these to fixed stack
	slots, the debugger knows where to look for them without having
	to be told. It finds out the location of the fifth, if needed,
	from a new slot in the proc layout structure. (It is not possible
	to allocate all five to fixed stack slots without wasting stack space
	in some cases.)

compiler/trace.m:
	Remove from the call to MR_trace the parameters that are now in fixed
	stack slots, since MR_trace can now look them up itself.

compiler/continuation_info.m:
compiler/stack_layout.m:
	Add an extra field to the proc_layout_info. If the module is shallow
	traced, this field says which stack slot holds the saved value of
	MR_from_full. If it is not shallow traced, this field says that
	there is no such stack slot.

runtime/mercury_stack_layout.h:
	Add macros for accessing the fixed stack slots holding the event
	number of the call event, the call number, the call depth, and,
	at a redo event, the redo layout structure address.

	Support the new field in proc layouts that gives the location of the
	from-full flag (if any).

runtime/mercury_trace_base.[ch]:
trace/mercury_trace.[ch]:
	Remove the call number and call depth arguments from MR_trace
	and its avatars, since this info is now in fixed stack slots
	in every procedure that can call MR_trace. This should reduce
	the size of the executable significantly, since there are lots
	of calls to MR_trace.

runtime/mercury_init.h:
runtime/mercury_wrapper.h:
	Update the prototype of MR_trace_{fake,real}, and the type of the
	global that points to them.

START NUMBERING FRAMEVARS FROM ONE

compiler/code_info.m:
compiler/live_vars.m:
compiler/llds_out.m:
compiler/trace.m:
	Start numbering framevars from 1 internally to the compiler;
	the runtime already starts from 1. This simplifies several tasks.

ADD REDO EVENTS

compiler/trace.m:
compiler/code_gen.m:
	Before the code that executes "succeed()", emit code to push a
	a temp nondet frame whose redoip points to a label in the runtime
	that calls MR_trace for a REDO event and then fails, provided
	--trace-redo is set.

compiler/llds.m:
	Add a new code address constant, do_trace_redo_fail, which stands
	for the address in the trace system to which calls MR_trace for
	the redo event and then fails.

compiler/trace.m:
compiler/llds_out.m:
	Provided we are doing redo tracing, fill in the slot that holds
	the layout information for the REDO event.

compiler/*.m:
	Minor changes to conform to handle the new code address constant.

browser/debugger_interface.m:
	Add redo to trace_port_type.

runtime/mercury_trace_base.[ch]:
	Add a C module containing the code that calls MR_trace for REDO
	events.

ENSURE THAT INPUT ARGUMENTS ARE ALWAYS VISIBLE

compiler/trace.m:
	When generating the set of live variables at internal ports,
	the variables that are in the pre-death set of the goal into which
	we are entering may not be available. However, the variables in the
	pre-death set that are also in the resume vars set will be available,
	so now include info about them in the layout structure for the event.
	Since with tracing the non-clobbered input args are in all resume vars
	sets, this ensures that these input args will be available from all
	internal events.

compiler/code_info.m:
	Export a previously internal predicate (current_resume_point_vars)
	to make this possible.

BUG FIX: WANT RETURN LAYOUTS

compiler/globals.m:
compiler/call_gen.m:
compiler/code_info.m:
compiler/mercury_compile.m:
	Add a new pred globals__want_return_layouts, which says whether the
	compiler should generate layout structures for call returns. This pred
	centralizes the several previous copies of the test. One of those
	copies (the one in call_gen) was faulty, leading to a bug: in the
	presence of execution tracing but the absence of accurate gc,
	information about the variables that are live at the call return
	wasn't being gathered properly.

BUG FIX: #include mercury_trace_base.h

compiler/llds_out.m:
	#include mercury_trace_base.h, not mercury_trace.h, since now
	mercury_trace_base.h defines everything directly accessible from
	modules compiled with tracing.

RECAST MERCURY_TRACE_UTIL AS MERCURY_LAYOUT_UTIL

runtime/mercury_trace_util.[ch]:
runtime/mercury_layout_util.[ch]:
	Rename this module from trace_util to layout_util, since it is also
	used by the native garbage collector. Remove "trace" from the names
	of functions.

	Get rid of the global variable MR_saved_regs, and instead thread
	a pointer to this data structure through the relevant functions
	as an extra argument.

	Add a lot more documentation in the header file.

runtime/Mmakefile:
	Reflect the module rename.

runtime/*.c:
	Refer to the new module.

DELETE EASY-TO-MISUSE MACROS

runtime/mercury_stacks.h:
	Delete the based_framevar and based_detstackvar macros, since their
	continued use can lead to off-by-one errors, and the saved_framevar
	and saved_detstackvar macros, since they are no longer used.

runtime/*.c
	Update any references to any macros removed from mercury_stacks.h.

MISC RUNTIME CHANGES

runtime/mercury_trace_base.[ch]:
trace/mercury_trace*.[ch]:
	Make typedef'd names conform to the naming convention.

	Make MR_trace_call_{seqno,depth} consistently Unsigned, rather than
	sometimes Word and sometimes Unsigned.

FIX BUG: MAKE THE DEBUGGER PRINT TO STDOUT, NOT THE CURRENT STREAM

library/io.m:
	Export to C code the predicates that return the identities and types
	of stdin, stdout and stderr, as well as io__print/[34].

library/std_util.m:
	Export to C code a predicate that returns the type_info for the
	type stdutil:type_info. This type_info is required if C code
	wants to invoke make_permanent on any type_info structure,
	as the debugger does.

runtime/mercury_init.h:
	Add extern declarations for the C functions now exported from io.m.

runtime/mercury_wrapper.[ch]:
	Add new global variables to hold the addresses of these C functions.

runtime/mercury_layout_util.c:
	Use indirect calls through these global variables to print Mercury
	values, instead of lower-level code.

util/mkinit.c:
	Assign the addresses of the functions exported from io.m to the
	global variables defined in mercury_wrapper.h.

BUG FIX: STACK TRACE FUNCTIONS DEPEND ON THE LABEL TABLE

runtime/mercury_stack_trace.c:
	On entry to any of the functions exported from this module,
	ensure that the label table is loaded by calling do_init_modules.
	Without a filled-in label table, the stack trace will not be able to
	find any stack layout info.

BUG FIX: REMOVE BROWSER/*.C

configure.in:
	When removing .c files generated by the C compiler, remove those
	in the browser directory as well as the compiler, library and
	profiler directories.

IMPLEMENT NEW DEBUGGER COMMAND SET

runtime/mercury_stack_trace.[ch]:
	Factor out the code that prints the id of a procedure into a function
	of its own, so that it can also be used from the debugger, ensuring
	appearance commonality.

	Add more documentation in the header file.

trace/mercury_trace_internal.c:
	Implement the proposed command set. Command names are now words,
	and several commands now have options allowing the user to override
	the default print level or strictness of the command, or the
	invocation conditions or action of a break point. Allows control
	over command echoing and the scrolling of sequences of event reports.
	Supports aliases, command file sourcing etc. Implements the retry
	command, using the info in the fixed stack slots.

trace/mercury_trace.[ch]:
	Extend the trace controls to support the new functionalities
	required by the new debugger language, which are print levels,
	variable-strictness commands, a more flexible finish command,
	and the retry command.

	Pass the command structure to MR_trace_event_report, since
	the user can now forcibly terminate the scrolling of reports.

trace/mercury_trace_alias.[ch]:
	New module to manage aliases for the debugger.

trace/mercury_trace_help.[ch]:
	New module to interface to browser/help.m.

trace/mercury_trace_spy.[ch]:
	New module to manage break points. The test of whether an event
	matches a break point is now much more efficient than before.
	The new module also allows several breakpoints with different
	actions and different invocation conditions (e.g. all ports,
	entry port, interface ports or specific (possibly internal) port)
	to be defined on the same procedure.

trace/mercury_trace_tables.[ch]:
	New module to manage a table of the debuggable modules, in which
	each such module is linked to the list of the layouts of all the
	procedures defined in that module. This information allows the
	debugger to turn the name of a predicate/function (possibly together
	with its arity and mode number) into the procedure layout structure
	required by the spy point module. Eventually it may also be useful
	in supplying lists of identifiers for command line completion.

	Modules for which no stack layout information is available will
	not be included in the table, since do_init_modules will not
	register any labels for them in the label table.

trace/Mmakefile:
	Mention the new files.

runtime/mercury_array_macros.h:
	A new file holding macros that can be useful in more than one module.

runtime/Mmakefile:
	Mention the new file.

runtime/mercury_conf.h.in:
	Mention a new configuration macro, MR_CANNOT_USE_STRUCTURE_ASSIGNMENT,
	used by runtime/mercury_array_macros.h.

configure.in:
	Find out whether we need to define MR_CANNOT_USE_STRUCTURE_ASSIGNMENT.

ADD TRACE DEPTH HISTOGRAMS

runtime/mercury_conf_param.h:
	Document MR_TRACE_HISTOGRAM.

runtime/mercury_trace_base.[ch]:
	Define the data structures for the histogram, and print the histogram
	when a traced program exits if MR_TRACE_HISTOGRAM is set.

trace/mercury_trace.[ch]:
	If MR_TRACE_HISTOGRAM is defined, record a count of the number of
	events at each depth. This information can help us evaluate space-time
	tradeoffs.

FACTOR OUT SHELL CODE HANDLING GRADE IMPLICATIONS

scripts/final_grade_options.sh-subr:
	A new file to contain any code that implements implications between
	grade flags; currently implements the implication debug -> use trail.

scripts/mgnuc.in:
scripts/ml.in:
	Replace the code that is now in final_grade_options.sh-subr with
	an inclusion of final_grade_options.sh-subr.

configure.in:
	Handle final_grade_options.sh-subr as {init,parse}_grade_options.sh-subr
	are handled.

SIMPLIFY THE MAINTAINANCE OF CONSISTENCY BETWEEN DEBUGGER CODE AND DOCUMENTATION

doc/Mmakefile:
	Add rules for creating mdb_command_list, a C code fragment
	that can included manually in trace/mercury_trace_internal.c
	to supply the list of valid commands, and mdb_command_test.inp,
	which is a list of invalid invocations of debugger commands,
	which tests whether the help message for such invocations
	can be located as expected.

doc/generate_mdb_command_list:
doc/generate_mdb_command_test:
	Awk scripts to create mdb_command_list and mdb_command_test.inp
	respectively from mdb_doc.

tools/bootcheck:
	Copy mdb_command_test.inp from doc to tests/debugger.

tests/debugger/Mmakefile:
	Add a new test that checks whether we get an internal error, unable
	to locate the right help node, for each invalid command invocation in
	mdb_command_test.inp.

UPDATE TEST CASES

tests/debugger/Mmakefile:
	Reenable queens. Conform to the new set of options.

tests/debugger/*.inp:
tests/debugger/*.exp:
	Update the inputs and expected outputs of the debugger test cases
	to use the new command set and output formats.
1998-10-16 06:20:21 +00:00