Skip to content

Unify RGBASM and RGBLINK fstack node backtrace printing methods into one generic function - #2253

Merged
Rangi42 merged 2 commits into
gbdev:masterfrom
Rangi42:print-fstack-backtrace
Nov 24, 2026
Merged

Rangi42 merged 2 commits into
gbdev:masterfrom
Rangi42:print-fstack-backtrace

Conversation

@Rangi42

@Rangi42 Rangi42 commented Nov 24, 2026

Copy link
Copy Markdown
Contributor

RGBASM and RGBLINK each declare their own struct FileStackNode, with many similarities but enough differences that we haven't totally unified them. However, both of them were separately implementing a printBacktrace method to derive a stack of "trace nodes" from their ancestry of parent nodes, and then call trace_PrintBacktrace to render it. Those two printBacktrace implementations were almost completely identical, except for whether the parent nodes were behind shared_ptrs or regular pointers, and whether the ancestry was in reversed order or not.

This PR unifies them as one generic trace_PrintFstackNodeBacktrace function. Note that trace_PrintBacktrace because it's also needed for printing backtraces of linkerscript nodes, which are less complicated than fstack nodes and don't need to construct their trace node history on the fly from rept/macro/file node ancestors -- their INCLUDEd ancestors already are sufficient for printing as-is.

@Rangi42 Rangi42 added this to the 1.0.5 milestone Nov 24, 2026
@Rangi42
Rangi42 requested a review from ISSOtm November 24, 2026 00:37
@Rangi42 Rangi42 added rgbasm This affects RGBASM rgblink This affects RGBLINK refactoring This PR is intended to clean up code more than change functionality labels Nov 24, 2026
@Rangi42 Rangi42 changed the title Print fstack backtrace Unify RGBASM and RGBLINK fstack node backtrace printing methods into one generic function Nov 24, 2026
@Rangi42

Rangi42 commented Nov 24, 2026

Copy link
Copy Markdown
Contributor Author

Confirmed that this works on Apple OSes older than what CI provides (macOS 11 with clang++ 22, and Mac OS X 10.8 with g++ 14, both available on MacPorts).

@Rangi42
Rangi42 merged commit 18a6f8b into gbdev:master Nov 24, 2026
31 checks passed
@Rangi42
Rangi42 deleted the print-fstack-backtrace branch November 24, 2026 17:52
@Rangi42
Rangi42 removed the request for review from ISSOtm November 24, 2026 17:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

refactoring This PR is intended to clean up code more than change functionality rgbasm This affects RGBASM rgblink This affects RGBLINK

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant