Skip to content

Commit df09ed8

Browse files
committed
Merge pull request #1798 from mat-hek/mf/mock-process-info-stacktrace
Add mock implementation for process_info(Pid, current_stacktrace) 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
2 parents 3b6901b + af391cb commit df09ed8

File tree

3 files changed

+15
-0
lines changed

3 files changed

+15
-0
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
5454
- Added `binary:match/2` and `binary:match/3`
5555
- Added `supervisor:which_children/1`
5656
- Added `monitored_by` in `process_info/2`
57+
- Added mock implementation for `current_stacktrace` in `process_info`
5758

5859
### Changed
5960

src/libAtomVM/context.c

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -505,6 +505,10 @@ bool context_get_process_info(Context *ctx, term *out, size_t *term_size, term a
505505
}
506506
break;
507507
}
508+
case CURRENT_STACKTRACE_ATOM: {
509+
ret_size = TUPLE_SIZE(2);
510+
break;
511+
}
508512
default:
509513
if (out != NULL) {
510514
*out = BADARG_ATOM;
@@ -614,6 +618,14 @@ bool context_get_process_info(Context *ctx, term *out, size_t *term_size, term a
614618
break;
615619
}
616620

621+
case CURRENT_STACKTRACE_ATOM: {
622+
term_put_tuple_element(ret, 0, CURRENT_STACKTRACE_ATOM);
623+
// FIXME: since it's not possible how to build stacktrace here with the current API,
624+
// this mock implementation returns an empty list
625+
term_put_tuple_element(ret, 1, term_nil());
626+
break;
627+
}
628+
617629
default:
618630
UNREACHABLE();
619631
}

src/libAtomVM/defaultatoms.def

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -192,3 +192,5 @@ X(NOMATCH_ATOM, "\x7", "nomatch")
192192
X(INIT_ATOM, "\x4", "init")
193193

194194
X(MONITORED_BY_ATOM, "\xC", "monitored_by")
195+
196+
X(CURRENT_STACKTRACE_ATOM, "\x12", "current_stacktrace")

0 commit comments

Comments
 (0)