[m-rev.] for review:
Zoltan Somogyi
zs at cs.mu.OZ.AU
Mon Jan 12 22:50:34 AEDT 2004
For review by Fergus. I will update the .exp2 file for the test case
after --debug bootcheck.
Zoltan.
trace/mercury_trace_tables.m:
Add a table for the less-than-fully-qualified names of modules,
allowing any prefix of the module name to be omitted.
Use it to allow procedure specifications (e.g. in breakpoint commands)
to use such module names, with fully qualified module names taking
precedence over less-than-fully-qualified module names.
tests/debugger/breakpoints.{m,inp,exp}:
tests/debugger/breakpoints.print_list.m:
Update this test case to test the new functionality.
cvs diff: Diffing .
cvs diff: Diffing analysis
cvs diff: Diffing bindist
cvs diff: Diffing boehm_gc
cvs diff: Diffing boehm_gc/Mac_files
cvs diff: Diffing boehm_gc/cord
cvs diff: Diffing boehm_gc/cord/private
cvs diff: Diffing boehm_gc/doc
cvs diff: Diffing boehm_gc/include
cvs diff: Diffing boehm_gc/include/private
cvs diff: Diffing boehm_gc/tests
cvs diff: Diffing browser
cvs diff: Diffing bytecode
cvs diff: Diffing compiler
cvs diff: Diffing compiler/notes
cvs diff: Diffing debian
cvs diff: Diffing deep_profiler
cvs diff: Diffing deep_profiler/notes
cvs diff: Diffing doc
cvs diff: Diffing extras
cvs diff: Diffing extras/aditi
cvs diff: Diffing extras/cgi
cvs diff: Diffing extras/complex_numbers
cvs diff: Diffing extras/complex_numbers/samples
cvs diff: Diffing extras/complex_numbers/tests
cvs diff: Diffing extras/concurrency
cvs diff: Diffing extras/curs
cvs diff: Diffing extras/curs/samples
cvs diff: Diffing extras/curses
cvs diff: Diffing extras/curses/sample
cvs diff: Diffing extras/dynamic_linking
cvs diff: Diffing extras/error
cvs diff: Diffing extras/graphics
cvs diff: Diffing extras/graphics/mercury_opengl
cvs diff: Diffing extras/graphics/mercury_tcltk
cvs diff: Diffing extras/graphics/samples
cvs diff: Diffing extras/graphics/samples/calc
cvs diff: Diffing extras/graphics/samples/maze
cvs diff: Diffing extras/graphics/samples/pent
cvs diff: Diffing extras/lazy_evaluation
cvs diff: Diffing extras/lex
cvs diff: Diffing extras/lex/samples
cvs diff: Diffing extras/lex/tests
cvs diff: Diffing extras/logged_output
cvs diff: Diffing extras/moose
cvs diff: Diffing extras/moose/samples
cvs diff: Diffing extras/morphine
cvs diff: Diffing extras/morphine/non-regression-tests
cvs diff: Diffing extras/morphine/scripts
cvs diff: Diffing extras/morphine/source
cvs diff: Diffing extras/odbc
cvs diff: Diffing extras/posix
cvs diff: Diffing extras/quickcheck
cvs diff: Diffing extras/quickcheck/tutes
cvs diff: Diffing extras/references
cvs diff: Diffing extras/references/samples
cvs diff: Diffing extras/references/tests
cvs diff: Diffing extras/stream
cvs diff: Diffing extras/trailed_update
cvs diff: Diffing extras/trailed_update/samples
cvs diff: Diffing extras/trailed_update/tests
cvs diff: Diffing extras/xml
cvs diff: Diffing extras/xml/samples
cvs diff: Diffing java
cvs diff: Diffing java/library
cvs diff: Diffing java/runtime
cvs diff: Diffing library
cvs diff: Diffing profiler
cvs diff: Diffing robdd
cvs diff: Diffing runtime
cvs diff: Diffing runtime/GETOPT
cvs diff: Diffing runtime/machdeps
cvs diff: Diffing samples
cvs diff: Diffing samples/c_interface
cvs diff: Diffing samples/c_interface/c_calls_mercury
cvs diff: Diffing samples/c_interface/cplusplus_calls_mercury
cvs diff: Diffing samples/c_interface/mercury_calls_c
cvs diff: Diffing samples/c_interface/mercury_calls_cplusplus
cvs diff: Diffing samples/c_interface/mercury_calls_fortran
cvs diff: Diffing samples/c_interface/simpler_c_calls_mercury
cvs diff: Diffing samples/c_interface/simpler_cplusplus_calls_mercury
cvs diff: Diffing samples/diff
cvs diff: Diffing samples/muz
cvs diff: Diffing samples/rot13
cvs diff: Diffing samples/solutions
cvs diff: Diffing samples/tests
cvs diff: Diffing samples/tests/c_interface
cvs diff: Diffing samples/tests/c_interface/c_calls_mercury
cvs diff: Diffing samples/tests/c_interface/cplusplus_calls_mercury
cvs diff: Diffing samples/tests/c_interface/mercury_calls_c
cvs diff: Diffing samples/tests/c_interface/mercury_calls_cplusplus
cvs diff: Diffing samples/tests/c_interface/mercury_calls_fortran
cvs diff: Diffing samples/tests/c_interface/simpler_c_calls_mercury
cvs diff: Diffing samples/tests/c_interface/simpler_cplusplus_calls_mercury
cvs diff: Diffing samples/tests/diff
cvs diff: Diffing samples/tests/muz
cvs diff: Diffing samples/tests/rot13
cvs diff: Diffing samples/tests/solutions
cvs diff: Diffing samples/tests/toplevel
cvs diff: Diffing scripts
cvs diff: Diffing tests
cvs diff: Diffing tests/benchmarks
cvs diff: Diffing tests/debugger
Index: tests/debugger/breakpoints.exp
===================================================================
RCS file: /home/mercury/mercury1/repository/tests/debugger/breakpoints.exp,v
retrieving revision 1.9
diff -u -b -r1.9 breakpoints.exp
--- tests/debugger/breakpoints.exp 17 Jan 2003 05:56:51 -0000 1.9
+++ tests/debugger/breakpoints.exp 9 Jan 2004 20:38:35 -0000
@@ -139,5 +139,27 @@
HeadVar__1 []
mdb> delete *
0: E stop interface pred breakpoints.qperm/2-0 (nondet)
+mdb> break -O test_in_both
+Ambiguous procedure specification. The matches are:
+0: pred breakpoints.test_in_both/2-0 (det)
+1: pred breakpoints.print_list.test_in_both/2-0 (det)
+mdb> break breakpoints.test_in_both
+ 0: + stop interface pred breakpoints.test_in_both/2-0 (det)
+mdb> break breakpoints.print_list.test_in_both
+ 1: + stop interface pred breakpoints.print_list.test_in_both/2-0 (det)
+mdb> delete *
+ 0: E stop interface pred breakpoints.test_in_both/2-0 (det)
+ 1: E stop interface pred breakpoints.print_list.test_in_both/2-0 (det)
+mdb> break print_list.test_in_both
+ 0: + stop interface pred breakpoints.print_list.test_in_both/2-0 (det)
+mdb> break print_list.test_only_in_printlist
+ 1: + stop interface pred breakpoints.print_list.test_only_in_printlist/2-0 (det)
+mdb> delete *
+ 0: E stop interface pred breakpoints.print_list.test_in_both/2-0 (det)
+ 1: E stop interface pred breakpoints.print_list.test_only_in_printlist/2-0 (det)
+mdb> break test_only_in_printlist
+ 0: + stop interface pred breakpoints.print_list.test_only_in_printlist/2-0 (det)
+mdb> delete *
+ 0: E stop interface pred breakpoints.print_list.test_only_in_printlist/2-0 (det)
mdb> continue
[1, 3, 5, 2, 4]
Index: tests/debugger/breakpoints.inp
===================================================================
RCS file: /home/mercury/mercury1/repository/tests/debugger/breakpoints.inp,v
retrieving revision 1.5
diff -u -b -r1.5 breakpoints.inp
--- tests/debugger/breakpoints.inp 17 Jan 2003 05:56:51 -0000 1.5
+++ tests/debugger/breakpoints.inp 9 Jan 2004 20:38:25 -0000
@@ -44,4 +44,13 @@
continue
print *
delete *
+break -O test_in_both
+break breakpoints.test_in_both
+break breakpoints.print_list.test_in_both
+delete *
+break print_list.test_in_both
+break print_list.test_only_in_printlist
+delete *
+break test_only_in_printlist
+delete *
continue
Index: tests/debugger/breakpoints.m
===================================================================
RCS file: /home/mercury/mercury1/repository/tests/debugger/breakpoints.m,v
retrieving revision 1.4
diff -u -b -r1.4 breakpoints.m
--- tests/debugger/breakpoints.m 26 May 2003 09:00:51 -0000 1.4
+++ tests/debugger/breakpoints.m 9 Jan 2004 18:57:13 -0000
@@ -77,3 +77,8 @@
nodiag(B, D1, L).
X / _ = X.
+
+:- pred test_in_both(io::di, io::uo) is det.
+
+test_in_both(!IO) :-
+ io__write_string("test_in_both in breakpoints\n", !IO).
Index: tests/debugger/breakpoints.print_list.m
===================================================================
RCS file: /home/mercury/mercury1/repository/tests/debugger/breakpoints.print_list.m,v
retrieving revision 1.1
diff -u -b -r1.1 breakpoints.print_list.m
--- tests/debugger/breakpoints.print_list.m 11 Feb 2002 12:52:54 -0000 1.1
+++ tests/debugger/breakpoints.print_list.m 9 Jan 2004 14:52:56 -0000
@@ -10,6 +10,10 @@
:- func string / string = string.
:- func string - string = string.
+:- pred test_only_in_printlist(io__state::di, io__state::uo) is det.
+
+:- pred test_in_both(io__state::di, io__state::uo) is det.
+
:- implementation.
print_list(Xs) -->
@@ -40,3 +44,9 @@
Str1 / Str2 = Str1 ++ "/" ++ Str2.
Str1 - Str2 = Str1 ++ "-" ++ Str2.
+
+test_only_in_printlist(!IO) :-
+ io__write_string("test_only_in_printlist\n", !IO).
+
+test_in_both(!IO) :-
+ io__write_string("test_in_both\n", !IO).
cvs diff: Diffing tests/debugger/declarative
cvs diff: Diffing tests/dppd
cvs diff: Diffing tests/general
cvs diff: Diffing tests/general/accumulator
cvs diff: Diffing tests/general/string_format
cvs diff: Diffing tests/general/structure_reuse
cvs diff: Diffing tests/grade_subdirs
cvs diff: Diffing tests/hard_coded
cvs diff: Diffing tests/hard_coded/exceptions
cvs diff: Diffing tests/hard_coded/purity
cvs diff: Diffing tests/hard_coded/sub-modules
cvs diff: Diffing tests/hard_coded/typeclasses
cvs diff: Diffing tests/invalid
cvs diff: Diffing tests/invalid/purity
cvs diff: Diffing tests/misc_tests
cvs diff: Diffing tests/mmc_make
cvs diff: Diffing tests/mmc_make/lib
cvs diff: Diffing tests/recompilation
cvs diff: Diffing tests/tabling
cvs diff: Diffing tests/term
cvs diff: Diffing tests/valid
cvs diff: Diffing tests/warnings
cvs diff: Diffing tools
cvs diff: Diffing trace
Index: trace/mercury_trace_tables.c
===================================================================
RCS file: /home/mercury/mercury1/repository/mercury/trace/mercury_trace_tables.c,v
retrieving revision 1.24
diff -u -b -r1.24 mercury_trace_tables.c
--- trace/mercury_trace_tables.c 26 Feb 2003 08:55:59 -0000 1.24
+++ trace/mercury_trace_tables.c 9 Jan 2004 14:43:21 -0000
@@ -24,18 +24,38 @@
#include <string.h>
#include <ctype.h>
+/*
+** We record module layout structures in two tables. The MR_module_infos
+** array contains one pointer to every module layout structure, and is ordered
+** by the fully qualified module name. The MR_module_nickname array contains
+** one reference to every module layout structure by the module's
+** less-than-fully-qualified name (which we call `nickname' here),
+** ordered by the nickname. The exception is that names that are the nicknames
+** of more than one module, the corresponding layout pointer will be NULL.
+*/
+
+typedef struct {
+ const char *MR_nick_name;
+ const MR_Module_Layout *MR_nick_layout;
+} MR_Module_Nick;
+
static const MR_Module_Layout **MR_module_infos;
static int MR_module_info_next = 0;
static int MR_module_info_max = 0;
+
+static MR_Module_Nick *MR_module_nicks;
+static int MR_module_nick_next = 0;
+static int MR_module_nick_max = 0;
+
static int MR_module_info_proc_count = 0;
#define INIT_MODULE_TABLE_SIZE 10
static const MR_Module_Layout *MR_search_module_info(const char *name);
-static void MR_insert_module_info(const MR_Module_Layout *);
+static void MR_insert_module_info(const MR_Module_Layout *module);
static void MR_process_matching_procedures_in_module(
const MR_Module_Layout *module, MR_Proc_Spec *spec,
- void f(void *, const MR_Proc_Layout *), void *);
+ void f(void *, const MR_Proc_Layout *), void *data);
static void MR_process_line_layouts(const MR_Module_File_Layout
*file_layout, int line,
MR_file_line_callback callback_func, int callback_arg);
@@ -141,14 +161,22 @@
if (found) {
return MR_module_infos[slot];
} else {
+ MR_bsearch(MR_module_nick_next, slot, found,
+ strcmp(MR_module_nicks[slot].MR_nick_name, name));
+ if (found) {
+ return MR_module_nicks[slot].MR_nick_layout;
+ } else {
return NULL;
}
+ }
}
static void
MR_insert_module_info(const MR_Module_Layout *module)
{
int slot;
+ MR_bool found;
+ const char *nickname;
MR_ensure_room_for_next(MR_module_info, const MR_Module_Layout *,
INIT_MODULE_TABLE_SIZE);
@@ -158,6 +186,29 @@
MR_module_infos[slot] = module;
MR_module_info_proc_count += module->MR_ml_proc_count;
+
+ nickname = strchr(module->MR_ml_name, '.');
+ while (nickname != NULL) {
+ nickname++; /* step over the '.' */
+ MR_bsearch(MR_module_nick_next, slot, found,
+ strcmp(MR_module_nicks[slot].MR_nick_name, nickname));
+ if (found) {
+ /* nickname is ambiguous */
+ MR_module_nicks[slot].MR_nick_layout = NULL;
+ } else {
+ MR_ensure_room_for_next(MR_module_nick,
+ MR_Module_Nick, INIT_MODULE_TABLE_SIZE);
+ MR_prepare_insert_into_sorted(MR_module_nicks,
+ MR_module_nick_next,
+ slot,
+ strcmp(MR_module_nicks[slot].MR_nick_name,
+ nickname));
+ MR_module_nicks[slot].MR_nick_name = nickname;
+ MR_module_nicks[slot].MR_nick_layout = module;
+ }
+
+ nickname = strchr(nickname, '.');
+ }
}
void
cvs diff: Diffing util
cvs diff: Diffing vim
cvs diff: Diffing vim/after
cvs diff: Diffing vim/ftplugin
cvs diff: Diffing vim/syntax
--------------------------------------------------------------------------
mercury-reviews mailing list
post: mercury-reviews at cs.mu.oz.au
administrative address: owner-mercury-reviews at cs.mu.oz.au
unsubscribe: Address: mercury-reviews-request at cs.mu.oz.au Message: unsubscribe
subscribe: Address: mercury-reviews-request at cs.mu.oz.au Message: subscribe
--------------------------------------------------------------------------
More information about the reviews
mailing list