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

implement C_BP macro for throwing a C debugger breakpoint WIP #22670

Open
wants to merge 1 commit into
base: blead
Choose a base branch
from

Conversation

bulk88
Copy link
Contributor

@bulk88 bulk88 commented Oct 15, 2024

My fingers hurt typing DebugBreak() all these years. Time for an API. Commit is a WIP since there is some dead code from 1st impl, but I decided the "speed" of memcpy, isn't worth the extra 0x30 bytes of machine code, and '\0' padding to 8 byte alignment boundaries done by MSVC of 4 separate c strings in RO data section vs 1 c string (snprintf fmt str). Just call snprintf() the slow way. Runtime speed is irrelevant here. This code will never run except for an XS dev or p5p dev writing a new module or bug fixing.

If there aren't suggested changes, I'll clean it up into a final version in a day or 2. The code could also be added to ppport.h to mk life easier for all XS devs on all PL releases.


-short macro name, less to type
-cross platform
-makes it easier to work on Perl core or XS CPAN
-emits debug info to console for CI/smoke/unattended machine -writes to STDOUT and STDERR, incase one of the 2 FDs are redirected
to a disk file or piped to another process, or that disk file is temp
flagged, and OS instantly deletes it
-breaking TAP testing is good
-C_BP; is less to type vs DebugBreak(); or __debugbreak(); on Win32


  • This set of changes requires a perldelta entry, and I need help writing it.

@bulk88
Copy link
Contributor Author

bulk88 commented Oct 15, 2024

repushed __debugbreak_int3 prototype was wrong

@bulk88
Copy link
Contributor Author

bulk88 commented Oct 18, 2024

Prefer GCC calller's address API first even on Win32, use official MS API 2nd on Win32. Improve last resort fallback for all OSes. Add test that the macro works and prints to the screen.

@bulk88
Copy link
Contributor Author

bulk88 commented Oct 18, 2024

repushed, forgot to stage func prototype retval fix which was causing GCC warnings

@bulk88 bulk88 force-pushed the add_C_dbgr_bp_api branch 2 times, most recently from a30300f to 7a5b495 Compare October 18, 2024 06:17
@bulk88
Copy link
Contributor Author

bulk88 commented Oct 18, 2024

repushed fix for FUNCTION_ is a linker symbol on GCC not a string literal

@bulk88 bulk88 force-pushed the add_C_dbgr_bp_api branch 2 times, most recently from 1f963a8 to 57133fe Compare October 18, 2024 08:42
-short macro name, less to type
-cross platform
-makes it easier to work on Perl core or XS CPAN
-emits debug info to console for CI/smoke/unattended machine
-writes to STDOUT and STDERR, incase one of the 2 FDs are redirected
 to a disk file or piped to another process, or that disk file is temp
 flagged, and OS instantly deletes it
-breaking TAP testing is good
-C_BP; is less to type vs DebugBreak(); or __debugbreak(); on Win32
@Leont
Copy link
Contributor

Leont commented Oct 20, 2024

-short macro name, less to type

I do not see that as an advantage, it looks more like obfuscation to me

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

Successfully merging this pull request may close these issues.

2 participants