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

Improved stack trace in Pallene using Pallene Tracer #597

Merged
merged 7 commits into from
Jun 11, 2024

Conversation

singul4ri7y
Copy link
Contributor

Initial commits on Pallene Tracer implementation in Pallene compiler for improved stack-traces using a separate debug traceback function pallene_tracer_debug_traceback.

The Pallene Tracer initial design specification can be found here: The Pallene Tracer

Resolves #565

@singul4ri7y singul4ri7y marked this pull request as ready for review May 31, 2024 15:10
@singul4ri7y singul4ri7y changed the title Imporved stack trace in Pallene using Pallene Tracer [DRAFT]: Imporved stack trace in Pallene using Pallene Tracer May 31, 2024
Copy link
Member

@hugomg hugomg left a comment

Choose a reason for hiding this comment

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

I still need to looked at the debug_traceback implementation, but might only be able to do so tomorrow.

src/pallene/pallenelib.lua Outdated Show resolved Hide resolved
src/pallene/pallenelib.lua Show resolved Hide resolved
src/pallene/pallenelib.lua Outdated Show resolved Hide resolved
@hugomg hugomg changed the title [DRAFT]: Imporved stack trace in Pallene using Pallene Tracer [DRAFT]: Improved stack trace in Pallene using Pallene Tracer May 31, 2024
src/pallene/pallenelib.lua Outdated Show resolved Hide resolved
src/pallene/pallenelib.lua Outdated Show resolved Hide resolved
src/pallene/pallenelib.lua Outdated Show resolved Hide resolved
Copy link
Member

@srijan-paul srijan-paul left a comment

Choose a reason for hiding this comment

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

Honestly, the overall idea looks pretty good to me.
Some minor feedback.

src/pallene/pallenelib.lua Show resolved Hide resolved
src/pallene/coder.lua Outdated Show resolved Hide resolved
src/pallene/pallenelib.lua Outdated Show resolved Hide resolved
src/pallene/pallenelib.lua Show resolved Hide resolved
@singul4ri7y
Copy link
Contributor Author

I have committed another change which fixes/enhances to the code in matter.

One problem I think we got, is the Pallene tracer line number is not quite correct. Any insights on this? @hugomg @srijan-paul

src/pallene/pallenelib.lua Outdated Show resolved Hide resolved
src/pallene/pallenelib.lua Outdated Show resolved Hide resolved
src/pallene/pallenelib.lua Outdated Show resolved Hide resolved
src/pallene/pallenelib.lua Outdated Show resolved Hide resolved
src/pallene/pallenelib.lua Outdated Show resolved Hide resolved
src/pallene/pallenelib.lua Show resolved Hide resolved
fprintf(stderr, "Runtime error: %s\nStack traceback: \n", message);

/* Lua: 1, Pallene: 0 */
int context = 1;
Copy link
Member

Choose a reason for hiding this comment

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

I wonder if we can structure our traversal as two nested loops and get rid of the context flag and some of the gotos.

for each frame in the Lua stack
    if this frame is linked to the Pallene stack
        for each frame in the Pallene stack block
             print C frame
    else
        print Lua frame

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Doable.

@singul4ri7y singul4ri7y self-assigned this Jun 7, 2024
@singul4ri7y singul4ri7y changed the title [DRAFT]: Improved stack trace in Pallene using Pallene Tracer Improved stack trace in Pallene using Pallene Tracer Jun 11, 2024
@hugomg hugomg dismissed srijan-paul’s stale review June 11, 2024 15:46

Changes were addressed / srijan is on sick leave

@hugomg hugomg merged commit 8366118 into master Jun 11, 2024
2 checks passed
@hugomg hugomg deleted the improved-stack-trace branch June 11, 2024 15:47
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.

Full pallene stack traces
3 participants