Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use pretty text in MsgTrace case of debug toText #5210

Merged
merged 1 commit into from
Jul 11, 2024
Merged

Conversation

dolio
Copy link
Contributor

@dolio dolio commented Jul 11, 2024

This changes the behavior of the DBTX instruction to use the provided 'pretty' text in cases where decompilation isn't complete. I think when this was first written it wouldn't provide much output, but since we have made it so that decompilation always produces something relatively useful, even if there are parts of the value that cannot be decompiled into any term.

This should improve e.g. cases that @ceedubs was seeing where looking at debug text for a value with a promise in it would produce massively more verbose show output rather than somewhat more comprehensible 'pretty' output.

@dolio dolio requested review from aryairani and ceedubs July 11, 2024 16:16
@dolio
Copy link
Contributor Author

dolio commented Jul 11, 2024

Example output difference:

examples/main> run testo
DataB2 (ReferenceDerived (Id "2lg4ah6ir6t129m33d7gssnigacral39qdamo20mn6r2vefl
iubpeqnjhejai9ekjckv0qnu9mlu3k9nbpfhl2schec4dohn7rjhjt8" 0)) 3735552 (DataU1 (
ReferenceBuiltin "Nat") 1441792 5) (DataB2 (ReferenceDerived (Id "2lg4ah6ir6t1
29m33d7gssnigacral39qdamo20mn6r2vefliubpeqnjhejai9ekjckv0qnu9mlu3k9nbpfhl2sche
c4dohn7rjhjt8" 0)) 3735552 (DataU1 (ReferenceBuiltin "Nat") 1441792 5) (DataB2
 (ReferenceDerived (Id "2lg4ah6ir6t129m33d7gssnigacral39qdamo20mn6r2vefliubpeq
njhejai9ekjckv0qnu9mlu3k9nbpfhl2schec4dohn7rjhjt8" 0)) 3735552 (Foreign (Wrap 
ReferenceBuiltin "Promise" _)) (Enum (ReferenceDerived (Id "00nv2kob8fp11qdkr7
50rlppf81cda95m3q0niohj1pvljnjl4r3hqrhvp1un2p40ptgkhhsne7hocod90r3qdlus9guivh7
j3qcq0g" 0)) 3801088)))
examples/main> run testo
(5, 5, bug "<Foreign>")

@aryairani
Copy link
Contributor

@dolio What are we even seeing in that example?

@dolio
Copy link
Contributor Author

dolio commented Jul 11, 2024

The exact same value rendered two different ways. :)

The first is show output of the value in the second thing. The last value of the triple is an empty promise.

@aryairani
Copy link
Contributor

So they both represent a triple? But there was a bug encountered in the last element that was causing the original message to print? But now the error that gets printed is better?

@dolio
Copy link
Contributor Author

dolio commented Jul 11, 2024

There's no way to decompile a promise to a unison term, so the tracer gives back both the output of Haskell's show for the value, and a pretty printed value containing dummy bug calls for the things it couldn't decompile. The two snippets are the corresponding text you see for each of those. I changed the DBTX case to use the second text instead of the first.

If you're actually debugging the runtime you might want to see the first thing, but most people don't.

Copy link
Contributor

@ceedubs ceedubs left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh wow that's a small diff :)

Like @aryairani the bug confused me. It might be nice to make the output a little clearer. This doesn't seem like a slam dunk in its current form. The old output was super noisy, but at least I could tell that there was a Promise in there. Is Foreign necessarily this opaque?

Anyway this shouldn't affect most people, so I think that we can give it a try.

@aryairani aryairani merged commit 60596a2 into trunk Jul 11, 2024
35 checks passed
@aryairani aryairani deleted the topic/msg-trace branch July 11, 2024 20:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants