相当于"debugger"的铬,在Cygwin的"gdb"上? [英] Chromium `debugger` equivalent, on `gdb` for Cygwin?

查看:72
本文介绍了相当于"debugger"的铬,在Cygwin的"gdb"上?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

人们如何从源代码中触发gdb(特别是对于Cygwin)的断点?

How do people trigger a breakpoint on gdb (for Cygwin, specifically) from the very source code?

就像当JS脚本中包含debugger字并且Chromium开发工具触发调试停止一样吗?

Like when a JS script has the debugger word in it and Chromium dev tools trigger stop for debugging?

推荐答案

以下是SDL2的方式

Here's how SDL2 implements this feature:

#if defined(_MSC_VER)
/* Don't include intrin.h here because it contains C++ code */
    extern void __cdecl __debugbreak(void);
    #define SDL_TriggerBreakpoint() __debugbreak()
#elif ( (!defined(__NACL__)) && ((defined(__GNUC__) || defined(__clang__)) && (defined(__i386__) || defined(__x86_64__))) )
    #define SDL_TriggerBreakpoint() __asm__ __volatile__ ( "int $3\n\t" )
#elif defined(__386__) && defined(__WATCOMC__)
    #define SDL_TriggerBreakpoint() { _asm { int 0x03 } }
#elif defined(HAVE_SIGNAL_H) && !defined(__WATCOMC__)
    #include <signal.h>
    #define SDL_TriggerBreakpoint() raise(SIGTRAP)
#else
    /* How do we trigger breakpoints on this platform? */
    #define SDL_TriggerBreakpoint()
#endif

在Cygwin上,条件条件可能应该解析为__asm__ __volatile__ ( "int $3\n\t" ).

The conditionals should probably resolve to __asm__ __volatile__ ( "int $3\n\t" ) on Cygwin.

这篇关于相当于"debugger"的铬,在Cygwin的"gdb"上?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆