-
Notifications
You must be signed in to change notification settings - Fork 130
Fix advanced trace #128
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
Merged
Merged
Fix advanced trace #128
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
bettio
added a commit
that referenced
this pull request
Nov 23, 2019
Fixes some code that is untouched unless advanced tracing is turned on. These changes are made under the terms of the LGPL v2.1 (or any later version) and Apache 2.0 licenses.
mat-hek
added a commit
to mat-hek/AtomVM
that referenced
this pull request
Aug 20, 2025
Instead of ignoring the stacktrace passed to `:erlang.raise/3` it
properly (?) handles it. Thans to that, the following code:
```elixir
try do
# This needs a fix BTW
inspect(fn x -> x + 1 end)
rescue
e -> {e, __STACKTRACE__}
end
```
that used to return:
```elixir
{%ArgumentError{message: "argument error"},
[
{:elixir, :eval_external_handler, 3,
[file: ~c"patches/estdlib/elixir.erl", line: 145]},
{:erl_eval, :avmo_do_apply, 4, [file: ~c"erl_eval", line: 754]},
{:erl_eval, :avmo_do_apply, 7, [file: ~c"erl_eval", line: 750]},
{:erl_eval, :avmo_try_clauses, 10, [file: ~c"erl_eval", line: 1052]},
{:erl_eval, :avmo_try_clauses, 10, [file: ~c"erl_eval", line: 1060]},
{:erl_eval, :avmo_try_clauses, 10, [file: ~c"erl_eval", line: 1077]},
{:elixir, :avmo_eval_forms, 4, [file: ~c"src/elixir.erl", line: 364]},
{:elixir, :avmo_eval_forms, 4, [file: ~c"src/elixir.erl", line: 374]},
{Module.ParallelChecker, :verify, 1,
[file: ~c"lib/module/parallel_checker.ex", line: 112]},
{Module.ParallelChecker, :verify, 1,
[file: ~c"lib/module/parallel_checker.ex", line: 111]},
{Code, :avmo_validated_eval_string, 3, [file: ~c"lib/code.ex", line: 572]},
{RunExpr, :run, 1,
[file: ~c"tmp/modules/117000009/_build/code.ex", line: 17]},
{RunExpr, :start, 0,
[file: ~c"tmp/modules/117000009/_build/code.ex", line: 6]}
]}
```
now returns:
```elixir
{%ArgumentError{message: "argument error"},
[
{Inspect.Function, :uniq, 1, [file: ~c"lib/inspect.ex", line: 497]},
{Inspect.Function, :default_inspect, 2,
[file: ~c"lib/inspect.ex", line: 479]},
{Inspect.Algebra, :to_doc, 2, [file: ~c"lib/inspect/algebra.ex", line: 396]},
{Kernel, :inspect, 2, [file: ~c"lib/kernel.ex", line: 2381]},
{:elixir_eval, :__FILE__, 1,
[
file: ~c"/Users/matheksm/ewr/fission_lib/tmp/modules/117000009/_build/code.ex",
line: 18
]},
{:elixir, :eval_external_handler, 3,
[file: ~c"patches/estdlib/elixir.erl", line: 98]},
{:elixir, :eval_external_handler, 3,
[file: ~c"patches/estdlib/elixir.erl", line: 99]},
{:erl_eval, :avmo_do_apply, 4, [file: ~c"erl_eval", line: 754]},
{:erl_eval, :avmo_do_apply, 7, [file: ~c"erl_eval", line: 750]},
{:erl_eval, :avmo_try_clauses, 10, [file: ~c"erl_eval", line: 1052]},
{:erl_eval, :avmo_try_clauses, 10, [file: ~c"erl_eval", line: 1060]},
{:erl_eval, :avmo_try_clauses, 10, [file: ~c"erl_eval", line: 1077]},
{:elixir, :avmo_eval_forms, 4, [file: ~c"src/elixir.erl", line: 364]},
{:elixir, :avmo_eval_forms, 4, [file: ~c"src/elixir.erl", line: 374]},
{Module.ParallelChecker, :verify, 1,
[file: ~c"lib/module/parallel_checker.ex", line: 112]},
{Module.ParallelChecker, :verify, 1,
[file: ~c"lib/module/parallel_checker.ex", line: 111]},
{Code, :avmo_validated_eval_string, 3, [file: ~c"lib/code.ex", line: 572]},
{RunExpr, :run, 1,
[file: ~c"tmp/modules/117000009/_build/code.ex", line: 17]}
]}
```
However, I'm not 100% sure this doesn't break something ¯\\_(ツ)\_/¯ I
plan to upstream this shortly and hopefully get some feedback.
cc @bblaszkow06 @FKubisSWM
---
These changes are made under both the "Apache 2.0" and the "GNU Lesser
General
Public License 2.1 or later" license terms (dual license).
SPDX-License-Identifier: Apache-2.0 OR LGPL-2.1-or-later
mat-hek
added a commit
to mat-hek/AtomVM
that referenced
this pull request
Aug 20, 2025
Instead of ignoring the stacktrace passed to `:erlang.raise/3` it
properly (?) handles it. Thans to that, the following code:
```elixir
try do
# This needs a fix BTW
inspect(fn x -> x + 1 end)
rescue
e -> {e, __STACKTRACE__}
end
```
that used to return:
```elixir
{%ArgumentError{message: "argument error"},
[
{:elixir, :eval_external_handler, 3,
[file: ~c"patches/estdlib/elixir.erl", line: 145]},
{:erl_eval, :avmo_do_apply, 4, [file: ~c"erl_eval", line: 754]},
{:erl_eval, :avmo_do_apply, 7, [file: ~c"erl_eval", line: 750]},
{:erl_eval, :avmo_try_clauses, 10, [file: ~c"erl_eval", line: 1052]},
{:erl_eval, :avmo_try_clauses, 10, [file: ~c"erl_eval", line: 1060]},
{:erl_eval, :avmo_try_clauses, 10, [file: ~c"erl_eval", line: 1077]},
{:elixir, :avmo_eval_forms, 4, [file: ~c"src/elixir.erl", line: 364]},
{:elixir, :avmo_eval_forms, 4, [file: ~c"src/elixir.erl", line: 374]},
{Module.ParallelChecker, :verify, 1,
[file: ~c"lib/module/parallel_checker.ex", line: 112]},
{Module.ParallelChecker, :verify, 1,
[file: ~c"lib/module/parallel_checker.ex", line: 111]},
{Code, :avmo_validated_eval_string, 3, [file: ~c"lib/code.ex", line: 572]},
{RunExpr, :run, 1,
[file: ~c"tmp/modules/117000009/_build/code.ex", line: 17]},
{RunExpr, :start, 0,
[file: ~c"tmp/modules/117000009/_build/code.ex", line: 6]}
]}
```
now returns:
```elixir
{%ArgumentError{message: "argument error"},
[
{Inspect.Function, :uniq, 1, [file: ~c"lib/inspect.ex", line: 497]},
{Inspect.Function, :default_inspect, 2,
[file: ~c"lib/inspect.ex", line: 479]},
{Inspect.Algebra, :to_doc, 2, [file: ~c"lib/inspect/algebra.ex", line: 396]},
{Kernel, :inspect, 2, [file: ~c"lib/kernel.ex", line: 2381]},
{:elixir_eval, :__FILE__, 1,
[
file: ~c"/Users/matheksm/ewr/fission_lib/tmp/modules/117000009/_build/code.ex",
line: 18
]},
{:elixir, :eval_external_handler, 3,
[file: ~c"patches/estdlib/elixir.erl", line: 98]},
{:elixir, :eval_external_handler, 3,
[file: ~c"patches/estdlib/elixir.erl", line: 99]},
{:erl_eval, :avmo_do_apply, 4, [file: ~c"erl_eval", line: 754]},
{:erl_eval, :avmo_do_apply, 7, [file: ~c"erl_eval", line: 750]},
{:erl_eval, :avmo_try_clauses, 10, [file: ~c"erl_eval", line: 1052]},
{:erl_eval, :avmo_try_clauses, 10, [file: ~c"erl_eval", line: 1060]},
{:erl_eval, :avmo_try_clauses, 10, [file: ~c"erl_eval", line: 1077]},
{:elixir, :avmo_eval_forms, 4, [file: ~c"src/elixir.erl", line: 364]},
{:elixir, :avmo_eval_forms, 4, [file: ~c"src/elixir.erl", line: 374]},
{Module.ParallelChecker, :verify, 1,
[file: ~c"lib/module/parallel_checker.ex", line: 112]},
{Module.ParallelChecker, :verify, 1,
[file: ~c"lib/module/parallel_checker.ex", line: 111]},
{Code, :avmo_validated_eval_string, 3, [file: ~c"lib/code.ex", line: 572]},
{RunExpr, :run, 1,
[file: ~c"tmp/modules/117000009/_build/code.ex", line: 17]}
]}
```
However, I'm not 100% sure this doesn't break something ¯\\_(ツ)\_/¯ I
plan to upstream this shortly and hopefully get some feedback.
cc @bblaszkow06 @FKubisSWM
---
These changes are made under both the "Apache 2.0" and the "GNU Lesser
General
Public License 2.1 or later" license terms (dual license).
SPDX-License-Identifier: Apache-2.0 OR LGPL-2.1-or-later
Signed-off-by: Mateusz Front <[email protected]>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Fixes some code that is untouched unless advanced tracing is turned on.
These changes are made under the terms of the LGPL v2.1 (or any later version)
and Apache 2.0 licenses.