[OT] Which IDE / Editor do you use?
Johannes Pfau
nospam at example.com
Sun Sep 15 02:29:57 PDT 2013
Am Sat, 14 Sep 2013 21:52:52 +0200
schrieb Artur Skawina <art.08.09 at gmail.com>:
> On 09/14/13 21:15, Paulo Pinto wrote:
> > So much work when one could just call the debugger from running
> > code,
> >
> > http://msdn.microsoft.com/en-us/library/f408b4et.aspx
> >
> > at least on Windows. :)
>
> // version (x86|x86_64)
> enum __debugbreak = q{asm { "int $3"; }};
>
> void main() {
> import std.stdio;
> auto a = 42;
> writeln(a);
> mixin (__debugbreak);
> writeln(a);
> }
>
>
> $ gdc -O3 -g explbp.d -o explbp
> $ gdb ./explbp
> (gdb) run
> 42
version(GNU)
{
import gcc.builtins;
__builtin_trap();
}
Portable, but you can't continue the program as with int 3. GCC really
needs a __builtin_break.
There's also
version(Posix)
{
import core.sys.posix.signal;
raise(SIGTRAP);
}
which allows to continue the program. The breakpoint is in the C
raise function in libpthread however and not in main as with your mixin.
More information about the Digitalmars-d
mailing list