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

Changed debug::print to print hex values #3377

Merged
merged 1 commit into from
Jun 12, 2023
Merged

Changed debug::print to print hex values #3377

merged 1 commit into from
Jun 12, 2023

Conversation

yuvalsw
Copy link
Contributor

@yuvalsw yuvalsw commented Jun 12, 2023

This change is Reviewable

@yuvalsw yuvalsw requested a review from orizi June 12, 2023 09:10
Copy link
Collaborator

@orizi orizi left a comment

Choose a reason for hiding this comment

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

Reviewed all commit messages.
Reviewable status: 0 of 3 files reviewed, 1 unresolved discussion (waiting on @yuvalsw)


crates/cairo-lang-runner/src/casm_run/mod.rs line 1737 at r1 (raw file):

                } else {
                    println!("[DEBUG]\t{:<31}\t(raw: 0x{:X}) ", ' ', value.to_bigint());
                }

if the second one cries (as it has for me for some reason)
just extract let raw = value.to_bigint();

Suggestion:

                let value = vm.get_integer(curr)?;
                if let Some(shortstring) = as_cairo_short_string(&value) {
                    println!("[DEBUG]\t{shortstring: <31}\t(raw: {:#x})", value.to_bigint());
                } else {
                    println!("[DEBUG]\t{:<31}\t(raw: {:#x}) ", ' ', value.to_bigint());
                }

Copy link
Collaborator

@orizi orizi left a comment

Choose a reason for hiding this comment

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

Reviewed 3 of 3 files at r1.
Reviewable status: all files reviewed, 1 unresolved discussion (waiting on @yuvalsw)

Copy link
Contributor Author

@yuvalsw yuvalsw left a comment

Choose a reason for hiding this comment

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

Reviewable status: 2 of 3 files reviewed, 1 unresolved discussion (waiting on @orizi)


crates/cairo-lang-runner/src/casm_run/mod.rs line 1737 at r1 (raw file):

Previously, orizi wrote…

if the second one cries (as it has for me for some reason)
just extract let raw = value.to_bigint();

Done.

@yuvalsw yuvalsw enabled auto-merge June 12, 2023 12:20
Copy link
Collaborator

@orizi orizi left a comment

Choose a reason for hiding this comment

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

:lgtm:

Reviewed 1 of 1 files at r2, all commit messages.
Reviewable status: :shipit: complete! all files reviewed, all discussions resolved (waiting on @yuvalsw)

@yuvalsw yuvalsw added this pull request to the merge queue Jun 12, 2023
Merged via the queue into main with commit 8014884 Jun 12, 2023
@orizi orizi deleted the yuval/print_hex branch June 28, 2023 05:24
@parketh
Copy link

parketh commented Jul 24, 2023

Is there a way to continue printing values as decimals following this update? In our case decimals are more relevant than hex for debugging

@yuvalsw
Copy link
Contributor Author

yuvalsw commented Jul 25, 2023

Hey, please see this:
#3459

@parketh
Copy link

parketh commented Aug 3, 2023

What about printing decimal values rather than short strings? Is there a different print method to support this?

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