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

Sync Libasr for Runtime Stacktrace #2350

Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Refactor: Show main_program location in the stacktrace
  • Loading branch information
Thirumalai-Shaktivel committed Sep 29, 2023
commit 05025b0ef868430526f3e4afb02b90a797ee3668
6 changes: 3 additions & 3 deletions src/libasr/runtime/lfortran_intrinsics.c
Original file line number Diff line number Diff line change
Expand Up @@ -372,7 +372,7 @@ char** parse_fortran_format(char* format, int *count) {
switch (tolower(format[index])) {
case ',' :
break;
case '/' :
case '/' :
format_values_2[format_values_count++] = "/";
break;
case '"' :
Expand Down Expand Up @@ -2619,9 +2619,9 @@ LFORTRAN_API void print_stacktrace_addresses(char *filename, bool use_colors) {
get_local_info_dwarfdump(&d);

#ifdef HAVE_LFORTRAN_MACHO
for (int32_t i = d.local_pc_size-2; i >= 0; i--) {
for (int32_t i = d.local_pc_size-1; i >= 0; i--) {
#else
for (int32_t i = d.local_pc_size-3; i >= 0; i--) {
for (int32_t i = d.local_pc_size-2; i >= 0; i--) {
#endif
uint64_t index = bisection(d.addresses, d.stack_size, d.local_pc[i]);
if(use_colors) {
Expand Down
2 changes: 1 addition & 1 deletion tests/reference/run_dbg-test_assert_01-2f34744.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,6 @@
"stdout": null,
"stdout_hash": null,
"stderr": "run_dbg-test_assert_01-2f34744.stderr",
"stderr_hash": "5ded88da4106fc9a3cfbaad6f82cc820a79a6ef8cc1661ecfcb37924",
"stderr_hash": "4811af471c73572b285e9ea01c8689abdd3cb32c717b3cd4876d2669",
"returncode": 1
}
2 changes: 2 additions & 0 deletions tests/reference/run_dbg-test_assert_01-2f34744.stderr
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
File "tests/runtime_errors/test_assert_01.py", line 1
def test():
File "tests/runtime_errors/test_assert_01.py", line 4
test()
File "tests/runtime_errors/test_assert_01.py", line 2
Expand Down
2 changes: 1 addition & 1 deletion tests/reference/run_dbg-test_assert_02-c6de25a.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,6 @@
"stdout": null,
"stdout_hash": null,
"stderr": "run_dbg-test_assert_02-c6de25a.stderr",
"stderr_hash": "ddba8a92bcfd5a30016735589da0dc56f2785e7636afcc0edeca4139",
"stderr_hash": "d5bfce55992e8d0630849442ee1f9b32864c64c328917c29fafc9424",
"returncode": 1
}
2 changes: 2 additions & 0 deletions tests/reference/run_dbg-test_assert_02-c6de25a.stderr
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
File "tests/runtime_errors/test_assert_02.py", line 1
def test():
File "tests/runtime_errors/test_assert_02.py", line 4
test()
File "tests/runtime_errors/test_assert_02.py", line 2
Expand Down
2 changes: 1 addition & 1 deletion tests/reference/run_dbg-test_assert_03-bd7b7dd.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,6 @@
"stdout": null,
"stdout_hash": null,
"stderr": "run_dbg-test_assert_03-bd7b7dd.stderr",
"stderr_hash": "7f97899439260443b40867e81d7c481c2fc23ec84ee777e7b43984d8",
"stderr_hash": "cae7dd955478787917e9dbb0bc1f63631317b13da1d892c3ebab9097",
"returncode": 1
}
2 changes: 2 additions & 0 deletions tests/reference/run_dbg-test_assert_03-bd7b7dd.stderr
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
File "tests/runtime_errors/test_assert_03.py", line 1
def f():
File "tests/runtime_errors/test_assert_03.py", line 10
main()
File "tests/runtime_errors/test_assert_03.py", line 8
Expand Down
2 changes: 1 addition & 1 deletion tests/reference/run_dbg-test_quit_01-30889cc.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,6 @@
"stdout": null,
"stdout_hash": null,
"stderr": "run_dbg-test_quit_01-30889cc.stderr",
"stderr_hash": "f5a660003a2da017d3ced437825a1e6f1c0c046d73cf68d183c92a40",
"stderr_hash": "b3dac87462f9f0650e5a6af68791137ca9d29f9a64139ba7718a9f96",
"returncode": 10
}
2 changes: 2 additions & 0 deletions tests/reference/run_dbg-test_quit_01-30889cc.stderr
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
File "tests/runtime_errors/test_quit_01.py", line 1
def test():
File "tests/runtime_errors/test_quit_01.py", line 4
test()
File "tests/runtime_errors/test_quit_01.py", line 2
Expand Down
2 changes: 1 addition & 1 deletion tests/reference/run_dbg-test_raise_01-dfd86ca.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,6 @@
"stdout": null,
"stdout_hash": null,
"stderr": "run_dbg-test_raise_01-dfd86ca.stderr",
"stderr_hash": "073aae20bbe7cf78e116825e3e825365b07230972ff7bcb3a5dddb93",
"stderr_hash": "76085f527077a81ba6457af8f982a497038168f555ab4027d0d6340e",
"returncode": 1
}
2 changes: 2 additions & 0 deletions tests/reference/run_dbg-test_raise_01-dfd86ca.stderr
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
File "tests/runtime_errors/test_raise_01.py", line 1
def test():
File "tests/runtime_errors/test_raise_01.py", line 4
test()
File "tests/runtime_errors/test_raise_01.py", line 2
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

The new location info (main_program Program node info) is useless for LPython, but it is required for LFortran.

Copy link
Contributor

Choose a reason for hiding this comment

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

Right, I knew this would be an issue. It's fine for now, we can refine this as we go. Possibly not doing so many indirections in LPython.

Expand Down