Questions tagged [debugbreak]

DebugBreak is the user-mode break routine of Microsoft Windows.

DebugBreak is the user-mode break routine of Microsoft Windows.

26 questions
84
votes
11 answers

Is there a portable equivalent to DebugBreak()/__debugbreak?

In MSVC, DebugBreak() or __debugbreak cause a debugger to break. On x86 it is equivalent to writing "_asm int 3", on x64 it is something different. When compiling with gcc (or any other standard compiler) I want to do a break into debugger, too. Is…
vividos
  • 6,468
  • 9
  • 43
  • 53
31
votes
5 answers

How can I use DebugBreak() in C#?

What is the syntax and which namespace/class needs to be imported? Give me sample code if possible. It would be of great help.
Prache
  • 533
  • 1
  • 6
  • 8
23
votes
7 answers

Xcode equivalent of ' __asm int 3 / DebugBreak() / Halt?

What's the instruction to cause a hard-break in Xcode? For example under Visual Studio I could do '_asm int 3' or 'DebugBreak()'. Under some GCC implementations it's asm("break 0") or asm("trap"). I've tried various combos under Xcode without any…
Andrew Grant
  • 58,260
  • 22
  • 130
  • 143
21
votes
11 answers

What is the best way of implementing assertion checking in C++?

By that I mean, what do I need to do to have useful assertions in my code? MFC is quite easy, i just use ASSERT(something). What's the non-MFC way? Edit: Is it possible to stop assert breaking in assert.c rather than than my file which called…
Mark Ingram
  • 71,849
  • 51
  • 176
  • 230
19
votes
8 answers

What is the best way to attach a debugger to a process in VC++ at just the right point in time?

When debugging, sometimes you need to attach an already running process instead of just starting the application in a debugger. It's common for myself to put in a Sleep() or MessageBox call, so that it's easier to attach a debugger. I worry that…
Brian R. Bondy
  • 339,232
  • 124
  • 596
  • 636
17
votes
2 answers

How to disable a programmatical breakpoint / assert?

I am using Visual Studio, developing a native application, I have a programmatical breakpoint (assert) in my code placed using __asm int 3 or __debugbreak. Sometimes when I hit it, I would like to disable it so that successive hits in the same…
Suma
  • 33,181
  • 16
  • 123
  • 191
9
votes
2 answers

DebugBreak in Unix/ Linux?

Do we have similar windows API of DebugBreak in Unix/ Linux. I want to debug a daemon process which should open NetBeans when DebugBreak statement is executed. Thanks in advance.
Viswesn
  • 4,674
  • 2
  • 28
  • 45
8
votes
1 answer

How to handle V8 engine crash when process runs out of memory

Both node console and Qt5's V8-based QJSEngine can be crashed by the following code: a = []; for (;;) { a.push("hello"); } node's output before crash: FATAL ERROR: JS Allocation failed - process out of memory QJSEngine's output before crash: # #…
kol
  • 27,881
  • 12
  • 83
  • 120
4
votes
1 answer

how to attach to a process that loads my DLL and debug it

basically, I am developing a DLL (an open interface) that will be used by a third party software. I want to debug my DLL after it is loaded by this thirdparty DLL, because I found a specific bug that only happens when my DLL is loaded by this third…
hong pei
  • 929
  • 2
  • 13
  • 27
2
votes
3 answers

__debugbreak statement not triggering breakpoint

In my visual C++ code I have introduced a __debugbreak statement for triggering a breakpoint. I have compiled the project with /CLR option. But it does not trigger a breakpoint during execution. Why does this happen? Please help before I shoot…
Walking Corpse
  • 107
  • 7
  • 31
  • 49
2
votes
2 answers

How to install a DebugBreak handler?

We are setting up Appveyor for our Visual Studio solution, which produces a C++ library. A few of our tests [dumb] fuzz C++ objects to ensure they don't do something unexpected. Under debug builds it causes an assert to fire (and in release builds…
jww
  • 97,681
  • 90
  • 411
  • 885
2
votes
0 answers

cant debug using __asm int 3 or DebugBreak or __debugbreak() on win7 64 bit

i cant launch the visual studio 2008 debugger by using _asm int 3, or _debugbreak(), or DebugBreak(). I am trying to debug a C++ DLL by embedding "__asm int 3;" in it, build the project and replace the generated dll with the one that is launched by…
isingh
  • 21
  • 1
  • 4
1
vote
2 answers

Is Debugbreak() occupies memory in c++?

When I want to new an object in C++, I need to consider what should I do when there is not enough memory, so I wrote the following code: CacheHeapItem* m_Items; try{ m_Items = new CacheHeapItem[m_Count]; }catch(const bad_alloc& e){ …
alice.Li
  • 51
  • 4
1
vote
1 answer

Behavior of DebugBreak differs between unmanaged and mixed (unmanaged+managed) application?

Take the following simple source (name it test.cpp): #include void main() { DebugBreak(); } Compile and link this using the following commands: cl /MD /c test.cpp link /debug test.obj If TEST.EXE is now run (on a 64-bit Windows 7…
Patrick
  • 23,217
  • 12
  • 67
  • 130
1
vote
2 answers

Cleanest way to explicitly crash an application?

My application has custom crash-handling built-in (see John Robbins' excellent book about "Debugging Windows Applications"). To test this functionality, I always used the Windows function DebugBreak() and this always worked perfectly. But since…
Patrick
  • 23,217
  • 12
  • 67
  • 130
1
2