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

show object kind, name and address when using dbg! #2960

Merged
merged 4 commits into from
Jun 3, 2023

Conversation

jasonwilliams
Copy link
Member

This should implement Debug a bit better for objects, previously they recursed a lot and spewed out a lot of garbage. This shows the kind, name and address for each object, which should be enough when investigating issues.

Before:

After:
&func = (Function) "fib" 0x7F9A67F17218

@codecov
Copy link

codecov bot commented May 24, 2023

Codecov Report

Merging #2960 (efbd36b) into main (65bf54d) will decrease coverage by 0.12%.
The diff coverage is 41.66%.

@@            Coverage Diff             @@
##             main    #2960      +/-   ##
==========================================
- Coverage   50.22%   50.11%   -0.12%     
==========================================
  Files         446      446              
  Lines       46019    46027       +8     
==========================================
- Hits        23114    23065      -49     
- Misses      22905    22962      +57     
Impacted Files Coverage Δ
boa_engine/src/object/jsobject.rs 55.31% <41.66%> (-3.08%) ⬇️

... and 7 files with indirect coverage changes

Copy link
Member

@HalidOdat HalidOdat left a comment

Choose a reason for hiding this comment

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

Looks good! Check the comment to see how we might improve it :)

boa_engine/src/object/jsobject.rs Outdated Show resolved Hide resolved
boa_engine/src/object/jsobject.rs Outdated Show resolved Hide resolved
@HalidOdat HalidOdat requested a review from a team May 25, 2023 13:53
Copy link
Member

@HalidOdat HalidOdat left a comment

Choose a reason for hiding this comment

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

Looks good to me! :)

Just need to run rust-fmt

Copy link
Member

@jedel1043 jedel1043 left a comment

Choose a reason for hiding this comment

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

Thanks! This should significantly improve the output of dbg!.

@jedel1043 jedel1043 added enhancement New feature or request API labels May 30, 2023
jasonwilliams and others added 4 commits June 3, 2023 12:08
Co-authored-by: Haled Odat <8566042+HalidOdat@users.noreply.github.com>
Co-authored-by: Haled Odat <8566042+HalidOdat@users.noreply.github.com>
@raskad raskad added this pull request to the merge queue Jun 3, 2023
Merged via the queue into boa-dev:main with commit de241c2 Jun 3, 2023
@jasonwilliams
Copy link
Member Author

I can do this in a follow up or but I left the recursion stuff in there, I gues that can be removed as it’s not possible for recursion when printing a object now (unless we want to improve the output later on with properties etc)

@HalidOdat @raskad

@jedel1043
Copy link
Member

I can do this in a follow up or but I left the recursion stuff in there, I gues that can be removed as it’s not possible for recursion when printing a object now (unless we want to improve the output later on with properties etc)

While debugging I tend to use object.display().internals(true) more. This change should mostly benefit end users since it won't spit pages and pages of properties while asserting that two values are equal, for example. I think we should remove the recursion.

Razican pushed a commit that referenced this pull request Jun 26, 2023
* show object kind, name and address when using dbg!

* Update boa_engine/src/object/jsobject.rs

Co-authored-by: Haled Odat <8566042+HalidOdat@users.noreply.github.com>

* Update boa_engine/src/object/jsobject.rs

Co-authored-by: Haled Odat <8566042+HalidOdat@users.noreply.github.com>

* Run `rust-fmt`

---------

Co-authored-by: Haled Odat <8566042+HalidOdat@users.noreply.github.com>
@jasonwilliams jasonwilliams deleted the dbgObjects branch July 15, 2024 20:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
API enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants