Code::Blocks Forums

Developer forums (C::B DEVELOPMENT STRICTLY!) => Development => Topic started by: Wkerry on February 01, 2025, 02:20:32 am

Title: asm("int3"); /*trap*/ query
Post by: Wkerry on February 01, 2025, 02:20:32 am
In the code there are a few of the following calls:
asm("int3"); /*trap*/

This works for x86 based CPU's, but when I use google to check what the arm equivalent it is not the same.

I have seen some historical posts of people building C::B on a RPi. As such it may be an idea to add protection around the asm("int3"); for x86 CPU's only and add support for ARM so that in the future when/if C::B does officially support running on RPi or other ARM SBC's/PC's then the code should hopefully then require less changes.
Title: Re: asm("int3"); /*trap*/ query
Post by: Pecan on February 01, 2025, 06:45:10 am
In the code there are a few of the following calls:
asm("int3"); /*trap*/

This works for x86 based CPU's, but when I use google to check what the arm equivalent it is not the same.

I have seen some historical posts of people building C::B on a RPi. As such it may be an idea to add protection around the asm("int3"); for x86 CPU's only and add support for ARM so that in the future when/if C::B does officially support running on RPi or other ARM SBC's/PC's then the code should hopefully then require less changes.

Which code do you see the int3's in that are unprotected?
Title: Re: asm("int3"); /*trap*/ query
Post by: ollydbg on February 01, 2025, 06:54:56 am
Hi, Pecan, my guess is that your recent to commits have some code change related to the "int3" instruction.

Maybe, we can find a way for both X86 based CPU and ARM based CPU.
Title: Re: asm("int3"); /*trap*/ query
Post by: Wkerry on February 01, 2025, 10:42:31 am
It was in the latest SVN change, but I am 1000% confident the same int 3 is in other places as I have included it in apps I have done where I enable it in a debug build.

This is some thing to thin about when you see an "int 3".
Title: Re: asm("int3"); /*trap*/ query
Post by: Pecan on February 01, 2025, 07:32:39 pm
It was in the latest SVN change, but I am 1000% confident the same int 3 is in other places as I have included it in apps I have done where I enable it in a debug build.

This is some thing to thin about when you see an "int 3".

All use of "int3" has been commented out. SVN revision 13608
Title: Re: asm("int3"); /*trap*/ query
Post by: Wkerry on February 02, 2025, 08:20:34 am
Thanks.
Title: Re: asm("int3"); /*trap*/ query
Post by: reckless on March 15, 2025, 08:54:02 am
Code
#if defined(__i386__) || defined(__x86_64__)
  __asm__ __volatile__("int {$}3":);
#elif defined(__arm__)
  __asm__ __volatile__("udf #0xfe");
#elif defined(__aarch64__)
  __asm__ __volatile__("brk #0xf000");
#else
  __asm__ __volatile__("unimplemented");
#endif

this should cover it if you need it again.