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

Use debug macros even in N64-only code #2298

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

cadmic
Copy link
Contributor

@cadmic cadmic commented Nov 14, 2024

After #2296 building N64 ROMs with debug features will be supported, so it would be nice to use e.g. DMA_REQUEST_SYNC instead of DmaMgr_RequestSync everywhere so things are consistent. For the filename, I used whatever filename the existing debug macros used (except for code_n64dd_800AD410.c which we don't know). For unknown file names or line numbers, I used macros UNK_FILE and UNK_LINE which expand to "<unknown>" and 0 respectively.

@cadmic cadmic changed the title Use debug macros even in N64 code Use debug macros even in N64-only code Nov 14, 2024
DmaMgr_RequestSync(_n64ddSegmentStart, (uintptr_t)_n64ddSegmentRomStart,
_n64ddSegmentRomEnd - _n64ddSegmentRomStart);
DMA_REQUEST_SYNC(_n64ddSegmentStart, (uintptr_t)_n64ddSegmentRomStart,
_n64ddSegmentRomEnd - _n64ddSegmentRomStart, "../code_n64dd_800AD410.c", 0);
Copy link
Contributor

Choose a reason for hiding this comment

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

I think I'd be more comfortable with something like

Suggested change
_n64ddSegmentRomEnd - _n64ddSegmentRomStart, "../code_n64dd_800AD410.c", 0);
_n64ddSegmentRomEnd - _n64ddSegmentRomStart, UNK_FILE_NAME, UNK_LINE_NUMBER);

just so it's completely unambiguous to any reader who isn't in the loop that these are fake, in that we can't know what they originally were. These macros could then expand to __FILE__, __LINE__ or just to __FILE__, 0

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Alright, I've created UNK_FILE (and turns out UNK_LINE already exists). I don't think the macros should expand to __FILE__ and __LINE__, it seems weird to mix in decomp filenames and line numbers in with the originals. Instead I think it would be better to have versions of the debug macros that put in the real __FILE__ and __LINE__ everywhere if you wanted this for debugging (as @Dragorn421 has suggested before)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants