10 Commits

Author SHA1 Message Date
Zoltan Somogyi
0de9ea32c7 Let mdb's dump command dump just a part of a variable' value.
trace/mercury_trace_cmd_browsing.c:
    Change the dump command to allow the name of the variable
    whose value is to be dumped to be followed by a path,
    specifying the *part* of the variable's value to be printed.

trace/mercury_trace_vars.[ch]:
    To make that possible, provide a version of an existing function
    that returns an extra value that the new code in
    mercury_trace_cmd_browsing.c needs, and another extra value
    that conceptually belongs with it.

    Mark strange code with an XXX.

NEWS.md:
    Announce both this new capability and a just-now contributes predicate.

library/pqueue.m:
    Make the just-now contributed code more readable.

tests/debugger/browser_test.{m,inp,exp3}:
    Extend this test case to test the new functionality.
2025-07-26 19:36:21 +02:00
Peter Wang
ea08308308 Update expected outputs.
tests/debugger/browse_pretty.exp:
tests/debugger/browser_test.exp3:
    Expect change to list indentation since
    commit 5cbcfaa0ed.
2023-01-18 13:56:08 +11:00
Zoltan Somogyi
31ad9a21e1 Allow terms to be dumped as docs in mdb.
The usual mdb "dump" command puts every function symbol on its own line.
This guarantees that we generate any line that is too long to be displayed
on terminals, but it also generates output that is too stretched out
vertically for its structure to be readily apparent. Dumping the term
as a doc allows pretty_printer.m to put as many function symbols on a line
as would fit, without exceeding the maximum line length.

browser/browse.m:
    Add save_term_to_file_doc, a way to save a (possibly synthetic)
    browser term in a file, using an interface that works the same way
    the predicate that saves browser terms as XML.

    Inline a predicate at its only call site. Improve variable names.

trace/mercury_trace_browse.[ch]:
    Add MR_trace_save_term_as_doc, as an interface function between
    save_term_to_file_doc and the code of mercury_trace_cmd_browsing.c.

trace/mercury_trace_cmd_browsing.c:
    Add support for a new -p/--prettyprint flag to the mdb "dump" command,
    which asks for the given term to be dumped as a pretty_printer doc.

doc/user_guide.texi:
NEWS:
    Document the new option.

library/pretty_printer.m:
NEWS:
    Rename write_as_doc to write_doc_formatted, and fix its argument type.

tests/debugger/browser_test.inp:
    Dump a term that we already dumped with "dump" with "dump -x" and
    "dump -p" as well.

tests/debugger/browser_test.m:
    Put the code to remove the files we are going to dump to
    and then later to print the files we have dumped to into separate
    predicates. This keeps most (but not all) line numbers unchanged
    even though we now dump to more files.

tests/debugger/browser_test.exp3:
    Update this file to account both for the extra output from the just-added
    dump commands, and for the changes in line numbers.
2022-08-25 16:39:50 +10:00
Peter Wang
89e59e7cc8 Delete support for browsing terms as XML.
The 'browse --xml' command has not worked with current versions of
xsltproc for quite some time, but we have not received any bug reports,
nor has anyone tried to fix it. We have a method for interactively
exploring a term in 'browse --web' so IMHO there is no need to keep
support for 'browse --xml'.

browser/browse.m:
browser/browser_info.m:
browser/declarative_user.m:
trace/mercury_trace_browse.c:
trace/mercury_trace_browse.h:
trace/mercury_trace_cmd_browsing.c:
trace/mercury_trace_cmd_parameter.c:
trace/mercury_trace_cmd_parameter.h:
trace/mercury_trace_internal.c:
    Delete code.

doc/mdb_categories:
doc/user_guide.texi:
    Delete documentation.

configure.ac:
    Don't search for a XUL browser and xsltproc.

scripts/mdbrc.in:
    Delete 'xml_browser_cmd' and 'xml_tmp_filename' lines.

scripts/xul_tree.xsl:
    Delete now unused file.

scripts/Mmakefile:
    Conform to deletions.

tests/debugger/Mmakefile:
tests/debugger/browser_test.exp:
tests/debugger/browser_test.exp3:
tests/debugger/browser_test.inp:
tests/debugger/mdb_command_test.inp:
tests/debugger/save.exp2:
tests/declarative_debugger/browse_arg.exp:
tests/declarative_debugger/browse_arg.inp:
    Don't test 'browse --xml' any longer.

extras/xml_stylesheets/README:
    Delete reference to 'browse --xml' command.

NEWS:
    Announce change.
2020-10-14 17:41:54 +11:00
Peter Wang
544f3bf095 Use musl getopt implementation.
LICENSE:
    Mention files derived from musl library.

runtime/process_getopt:
    Process files from ../getopt/*.[ch] to produce
    mercury_getopt.h, mercury_getopt.c, mercury_getopt_long.c.

runtime/mercury_getopt.h:
runtime/mercury_getopt.c:
runtime/mercury_getopt_long.c:
    Add files generated by process_getopt.

runtime/Mmakefile:
    Update list of source files.

util/Mmakefile:
    Use musl getopt if the system C library does not have getopt().

tests/debugger/browser_test.exp:
tests/debugger/browser_test.exp2:
tests/debugger/browser_test.exp3:
tests/hard_coded/runtime_opt.exp:
    Update expected error messages to match new getopt() output.

changed exp output
2019-06-10 13:30:49 +10:00
Zoltan Somogyi
33eb3028f5 Clean up the tests in half the test directories.
tests/accumulator/*.m:
tests/analysis_*/*.m:
tests/benchmarks*/*.m:
tests/debugger*/*.{m,exp,inp}:
tests/declarative_debugger*/*.{m,exp,inp}:
tests/dppd*/*.m:
tests/exceptions*/*.m:
tests/general*/*.m:
tests/grade_subdirs*/*.m:
tests/hard_coded*/*.m:
    Make these tests use four-space indentation, and ensure that
    each module is imported on its own line. (I intend to use the latter
    to figure out which subdirectories' tests can be executed in parallel.)

    These changes usually move code to different lines. For the debugger tests,
    specify the new line numbers in .inp files and expect them in .exp files.
2015-02-14 20:14:03 +11:00
Zoltan Somogyi
62dda38678 Make the mdb command "dump" give you a message confirming what it did.
Estimated hours taken: 2
Branches: main

Make the mdb command "dump" give you a message confirming what it did.

trace/mercur_trace_cmd_browsing.c:
	Make the mdb command "dump" give you a message confirming what it did,
	unless the user gives the new -q or --quiet option.

doc/user_guide.texi:
	Document the new option.

scripts/mdb_grep:
scripts/mdb_open:
	Specify -q to keep old behavior.

tests/debugger/browser_test.{inp,exp,exp3}:
	Update this test case to test the dump command both with and
	without -q.
2010-09-30 04:21:18 +00:00
Zoltan Somogyi
3a76fe424f When the user asks for the printing of a non-existent part of a term, make
Estimated hours taken: 3
Branches: main

When the user asks for the printing of a non-existent part of a term, make
mdb print the path up to the nonexistent part as part of the error message.

trace/mercury_trace_var.[ch]:
	Give to the function that generates those error messages a pointer
	not just to the bad part of the path, but to the full path as well,
	so it can print the good part.

	Remove fixed limits on the size of error messages.

trace/mercury_trace_spy.c:
	Conform to the change in mercury_trace_var.h.

runtime/mercury_memory.[ch]:
	Provide a mechanism for dynamically resizing character buffers
	for use by mercury_trace_vars.c. We use this instead of snprint
	because snprint isn't available or doesn't work properly on some
	platforms.

	Document a previously overlooked function.

tests/debugger/browser_test.exp3:
tests/debugger/field_names.exp:
	Update these test cases to expect the new, more informative
	error messages.
2008-12-05 07:18:08 +00:00
Ralph Becket
b76b3d5e2b The depth limit was being prematurely decremented when formatting
Estimated hours taken: 1
Branches: main

library/pretty_printer.m:
	The depth limit was being prematurely decremented when formatting
	terms, causing one too few functors to be displayed before
	truncation.  This bug caused everything to be printed as "..."
	at depth 1, rather than just showing the top-level functor.

tests/debugger/browse_pretty.exp:
tests/debugger/browser_test.exp3:
tests/debugger/declarative/sort.exp:
tests/hard_coded/test_pretty_printer.exp:
tests/hard_coded/test_pretty_printer_defaults.exp:
	Update expected output files.

tests/hard_coded/test_pretty_printer.m:
	Test the depth=1 case.
2007-09-02 22:43:03 +00:00
Ralph Becket
e01f551473 Try to handle pretty-printing of functor names containing '.'s
Estimated hours taken: 5 (mostly testing)
Branches: main

browser/browse.m:
	Try to handle pretty-printing of functor names containing '.'s
	correctly (the default pretty-printer formatting escapes names
	containing '.'s).

library/list.m:
	Improve the pretty-printer formatting of lists by preventing
	the output of ellipsis when all items in the list have been
	printed.

library/pretty_printer.m:
	Special-case printing of "." as an infix operator by not
	surrounding it by spaces.

tests/debugger/browse_pretty.exp:
tests/debugger/browser_test.exp:
tests/debugger/declarative/change_search.exp:
	Updated to reflect output of new pretty printer.

tests/debugger/browser_test.exp3:
	Added a new possible output (for new pretty printer).
2007-08-22 22:36:18 +00:00