Files
mercury/tests/declarative_debugger/trust.exp
Zoltan Somogyi b3b9b87696 Speed up trust tests in the declarative debugger.
browser/declarative_oracle.m:
    Optimize table lookups when checking whether a procedure is trusted.
    Instead of doing three separate lookups to test

    - whether the module in which the procedure is in is trusted,
    - whether the Mercury standard library is trusted, and this module
      is in the Mercury standard library, and
    - whether the predicate or function the procedure is in is trusted,

    look up the module the procedure is in just once, then

    - replace both of the first two lookups above with testing a single flag
      each, and then
    - look up the procedure in a map of trusted predicate or function names.

    The last test should be faster than its old equivalent, because the map
    it searches will be local to the module, whereas it used to be global.

    Print the list of trusted entities (which this module calls trusted
    "objects") in the same order regardless of whether we are printing
    for users or as commands. The order will be the order in which they were
    trusted.

    Undo an unnecessary capitalization in the list of trusted objects.

browser/declarative_debugger.m:
    Improve the style of some related code.

tests/debugger/save.exp:
tests/declarative_debugger/skip.exp:
tests/declarative_debugger/trust.exp:
    Expect the changes described above in the list of trusted objects.
2022-06-28 23:35:41 +10:00

81 lines
1.9 KiB
Plaintext

E1: C1 CALL pred trust.main/2-0 (cc_multi) trust.m:18
mdb> mdb> mdb> Contexts will not be printed.
mdb> echo on
Command echo enabled.
mdb> trust trust_1.
Trusting pred trust_1.w_cmp/3
mdb> trusted
Trusted objects:
1: predicate trust_1.w_cmp/3
mdb> untrust 1
mdb> trusted
There are no trusted modules, predicates or functions.
mdb> trust trust_2
Trusting module trust_2
mdb> trust trust.
Ambiguous predicate or function specification. The matches are:
0: pred trust.main/2
1: pred trust.dostuff/2
Which predicate or function do you want to trust (0-1 or *)? 0
Trusting pred trust.main/2
mdb> trusted
Trusted objects:
2: module trust_2
3: predicate trust.main/2
mdb> trust trust_2
Trusting module trust_2
mdb> trusted
Trusted objects:
2: module trust_2
3: predicate trust.main/2
mdb> untrust 2
mdb> trust trust_1
Trusting module trust_1
mdb> trust no_such_module
mdb: there is no such module, predicate or function.
mdb> trust trust_2.
Trusting pred trust_2.concat/3
mdb> trust std lib
Trusting the Mercury standard library
mdb> trust standard library
Trusting the Mercury standard library
mdb> trusted
Trusted objects:
3: predicate trust.main/2
4: module trust_1
5: predicate trust_2.concat/3
6: the Mercury standard library
mdb> untrust 3
mdb> trusted
Trusted objects:
4: module trust_1
5: predicate trust_2.concat/3
6: the Mercury standard library
mdb> untrust 3
mdb: no such trusted object
mdb> untrust 99
mdb: no such trusted object
mdb> untrust 4
mdb> untrust 5
mdb> step
E2: C2 CALL pred trust.dostuff/2-0 (cc_multi)
mdb> finish
E3: C2 EXIT pred trust.dostuff/2-0 (cc_multi)
mdb> dd -d 3 -n 7
dostuff(w("aaabbb"), '=')
Valid? n
w_cmp('=', w("aaB"), w("aAB"))
Valid? trust
concat(w("aaa"), w("bbb"), w("aaabbb"))
Valid? trust module
Found incorrect contour:
w_cmp('=', w("aaB"), w("aAB"))
concat(w("aaa"), w("bbb"), w("aaabbb"))
dostuff(w("aaabbb"), '=')
Is this a bug? y
E3: C2 EXIT pred trust.dostuff/2-0 (cc_multi)
mdb> continue
aaabbb
'='