9

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

2 Answers2

9

there is __builtin_trap() GCC intrinsic.

Gregory Pakosz
  • 69,011
  • 20
  • 139
  • 164
  • Whav! this is what I am looking for http://mainisusuallyafunction.blogspot.in/2012/01/embedding-gdb-breakpoints-in-c-source.html and to get sample program have a look in to https://github.com/kmcallister/embedded-breakpoints – Viswesn Apr 11 '12 at 05:52
  • This causes SIGILL (illegal instruction) when hit, and subsequently kills the program. At least for me. Using `raise(SIGTRAP)` works. – Calmarius Feb 21 '18 at 16:17
2

Whav! this is what I am looking for Embedded break points in C http://mainisusuallyafunction.blogspot.in/2012/01/embedding-gdb-breakpoints-in-c-source.html and to get sample program have a look in to https://github.com/kmcallister/embedded-breakpoints

Viswesn
  • 4,674
  • 2
  • 28
  • 45