【问题标题】:Only break on breakpoints in MacGDBp?只在 MacGDBp 中的断点处中断?
【发布时间】:2012-02-19 19:30:48
【问题描述】:

MacGDBp 有一个名为“Break on first line of execution”的设置,我关闭了它。但它似乎没有做任何事情。它仍然会捕获并中断每个查询,使其成为一个无用的应用程序。

有没有人使用 MacGDBp 知道如何解决这个问题?我很想利用它,但在这一点上它不值得。

谢谢

【问题讨论】:

    标签: php macos debugging gdb xdebug


    【解决方案1】:

    我意识到这可能涉及更多,但这听起来就像你单步执行代码时会发生的那样。

    您点击的是哪个按钮? Continue 按钮应该跳转到下一个断点。

    我从以下地址获取此信息:
    Debugging your PHP Code: XDebug on MAMP with TextMate and MacGDBp Support

    从左到右,按钮是:

    Step into:单击此按钮将使调试器前进一步,并在必要时“进入”函数、类、文件等。通过反复单击此按钮,您可以逐步完成该过程的每个部分。

    走出去:这将提升一个级别。例如,如果您正在执行一个函数并退出,调试器将前进到代码的下一部分,跳过函数的其余部分。

    跳过(跳过):这将跳过检查下一步。例如,如果当前行指向一个函数,而您不想看到该函数执行,则可以使用此按钮跳过它。单击它只会前进到当前范围内的下一行。

    继续(播放):继续执行直到下一个断点或脚本结束。

    重置:移除当前调试会话并等待来自服务器的下一个请求。

    使用这些按钮,您可以浏览脚本的执行。虽然这将在程序执行时为您提供详细的分步分析,但它通常可能是矫枉过正的。更多时候,您只想分析脚本的一小部分。最好使用断点来完成。

    断点是一个标记,它告诉调试器在到达该位置时暂停。使用断点,您可以将调试器设置为播放大部分代码,仅在到达感兴趣的部分时暂停。

    编辑:2012 年 2 月 26 日

    嗨,纳坦,

    您可以通过将此行添加到您的 php.ini 文件中来查看 xdebug 日志:

    xdebug.remote_log=/var/log/xdebug/xdebug.log
    

    您可以确定 MacGDBp 是否正在发送任何断点,以及它是否正在发送运行命令或 step_into 命令。

    这是我看到的六种不同场景。我删除了大部分数据,因为它占用了大量空间,如果您需要查看特定行的数据,请告诉我。

    1)“第一行执行中断”=关闭且没有断点

    Log opened at 2012-02-26 22:27:47
    -> <init
    
    <- feature_set -i 2859 -n show_hidden -v 1
    -> <response
    
    <- feature_set -i 2860 -n max_depth -v 3
    -> <response
    
    <- feature_set -i 2861 -n max_children -v 30
    -> <response
    
    <- feature_get -i 2862 -n max_data
    -> <response
    
    <- eval -i 2863 --
    -> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="http://xdebug.org/dbgp/xdebug" command="eval" transaction_id="2863"><property address=
    
    <- run -i 2864
    -> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="http://xdebug.org/dbgp/xdebug" command="run" transaction_id="2864" status="stopping" reason="ok"></response>
    


    2) “第一行执行中断”= 开启且没有断点

      Log opened at 2012-02-26 22:35:39
      -> <init
    
      <- feature_set -i 2913 -n show_hidden -v 1
      -> <response
    
      <- feature_set -i 2914 -n max_depth -v 3
      -> <response
    
      <- feature_set -i 2915 -n max_children -v 30
      -> <response
    
      <- feature_get -i 2916 -n max_data
      -> <response
    
      <- eval -i 2917 --
      -> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="http://xdebug.org/dbgp/xdebug" command="eval" transaction_id="2917"><property address=
    
      // 2a) STEP INTO CALLED BECAUSE "BREAK ON FIRST LINE OF EXECUTION" IS TURNED ON
      <- step_into -i 2918
      -> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="http://xdebug.org/dbgp/xdebug" command="step_into" transaction_id="2918" status="break" reason="ok"><xdebug:message filename="file:///var/www/application/html/index.php" lineno="2"></xdebug:message></response>
    
      <- stack_get -i 2919
      -> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="http://xdebug.org/dbgp/xdebug" command="stack_get" transaction_id="2919"><stack where="{main}" level="0" type="file" filename="file:///var/www/application/html/index.php" lineno="2"></stack></response>
    
      <- context_names -i 2920
      -> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="http://xdebug.org/dbgp/xdebug" command="context_names" transaction_id="2920"><context name="Locals" id="0"></context><context name="Superglobals" id="1"></context></response>
    
      <- context_get -i 2921 -c 0
      -> <response xmlns= // SHOWS "Locals" VARIABLES
    
      <- context_get -i 2922 -c 1
      -> <response xmlns= // SHOWS "Superglobals" VARIABLES
    
      // 2b) CLICK CONTINUE
      <- run -i 2923
      -> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="http://xdebug.org/dbgp/xdebug" command="run" transaction_id="2923" status="stopping" reason="ok"></response>
    


    3) “第一行执行中断”= 开启,第一行有断点

    Log opened at 2012-02-26 22:41:56
    -> <init
    
    <- feature_set -i 2936 -n show_hidden -v 1
    -> <response
    
    <- feature_set -i 2937 -n max_depth -v 3
    -> <response
    
    <- feature_set -i 2938 -n max_children -v 30
    -> <response
    
    <- feature_get -i 2939 -n max_data
    -> <response
    
    // 3a) LISTS ALL BREAKPOINTS THAT ARE SET
    <- breakpoint_set -i 2940 -t line -s enabled -f file:///var/www/application/html/index.php -n 2
    -> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="http://xdebug.org/dbgp/xdebug" command="breakpoint_set" transaction_id="2940" state="enabled" id="179940003"></response>
    
    <- eval -i 2941 --
    -> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="http://xdebug.org/dbgp/xdebug" command="eval" transaction_id="2941"><property address=
    
    // 3b) STEP INTO CALLED BECAUSE "BREAK ON FIRST LINE OF EXECUTION" = ON
    <- step_into -i 2942
    -> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="http://xdebug.org/dbgp/xdebug" command="step_into" transaction_id="2942" status="break" reason="ok"><xdebug:message filename="file:///var/www/application/html/index.php" lineno="2"></xdebug:message></response>
    
    <- stack_get -i 2943
    -> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="http://xdebug.org/dbgp/xdebug" command="stack_get" transaction_id="2943"><stack where="{main}" level="0" type="file" filename="file:///var/www/application/html/index.php" lineno="2"></stack></response>
    
    <- context_names -i 2944
    -> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="http://xdebug.org/dbgp/xdebug" command="context_names" transaction_id="2944"><context name="Locals" id="0"></context><context name="Superglobals" id="1"></context></response>
    
    <- context_get -i 2945 -c 0
    -> <response xmlns= // SHOWS "Locals" VARIABLES
    
    <- context_get -i 2946 -c 1
    -> <response xmlns= // SHOWS "Superglobals" VARIABLES
    
    // 3c) CLICK CONTINUE
    <- run -i 2947
    -> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="http://xdebug.org/dbgp/xdebug" command="run" transaction_id="2949" status="stopping" reason="ok"></response>
    


    4)“第一行执行中断”=开启,第 10 行有断点

    Log opened at 2012-02-27 00:29:26
    -> <init
    
    <- feature_set -i 3023 -n show_hidden -v 1
    -> <response
    
    <- feature_set -i 3024 -n max_depth -v 3
    -> <response
    
    <- feature_set -i 3025 -n max_children -v 30
    -> <response
    
    <- feature_get -i 3026 -n max_data
    -> <response
    
    // 4a) LISTS ALL BREAKPOINTS THAT ARE SET
    <- breakpoint_set -i 3027 -t line -s enabled -f file:///var/www/application/html/index.php -n 10
    -> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="http://xdebug.org/dbgp/xdebug" command="breakpoint_set" transaction_id="3027" state="enabled" id="180020001"></response>
    
    <- eval -i 3028 --
    -> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="http://xdebug.org/dbgp/xdebug" command="eval" transaction_id="3028"><property address=
    
    // 4b) STEP INTO CALLED BECAUSE "BREAK ON FIRST LINE OF EXECUTION" = ON
    <- step_into -i 3029
    -> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="http://xdebug.org/dbgp/xdebug" command="step_into" transaction_id="3029" status="break" reason="ok"><xdebug:message filename="file:///var/www/application/html/index.php" lineno="2"></xdebug:message></response>
    
    <- stack_get -i 3030
    -> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="http://xdebug.org/dbgp/xdebug" command="stack_get" transaction_id="3030"><stack where="{main}" level="0" type="file" filename="file:///var/www/application/html/index.php" lineno="2"></stack></response>
    
    <- context_names -i 3031
    -> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="http://xdebug.org/dbgp/xdebug" command="context_names" transaction_id="3031"><context name="Locals" id="0"></context><context name="Superglobals" id="1"></context></response>
    
    <- context_get -i 3032 -c 0
    -> <response xmlns= // SHOWS "Locals" VARIABLES
    
    <- context_get -i 3033 -c 1
      -> <response xmlns= // SHOWS "Superglobals" VARIABLES
    
    // 4c) CLICK CONTINUE - GOES TO BREAKPOINT ON LINE 10
    <- run -i 3034
    -> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="http://xdebug.org/dbgp/xdebug" command="run" transaction_id="3034" status="break" reason="ok"><xdebug:message filename="file:///var/www/application/html/index.php" lineno="10"></xdebug:message></response>
    
    <- stack_get -i 3035
    -> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="http://xdebug.org/dbgp/xdebug" command="stack_get" transaction_id="3035"><stack where="{main}" level="0" type="file" filename="file:///var/www/application/html/index.php" lineno="10"></stack></response>
    
    <- context_names -i 3036
    -> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="http://xdebug.org/dbgp/xdebug" command="context_names" transaction_id="3036"><context name="Locals" id="0"></context><context name="Superglobals" id="1"></context></response>
    
    <- context_get -i 3037 -c 0
    -> <response xmlns= // SHOWS "Locals" VARIABLES
    
    <- context_get -i 3038 -c 1
      -> <response xmlns= // SHOWS "Superglobals" VARIABLES
    
    // 4d) CLICK CONTINUE
    <- run -i 3039
    -> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="http://xdebug.org/dbgp/xdebug" command="run" transaction_id="2864" status="stopping" reason="ok"></response>
    


    5) “第一行执行中断”= 关闭,第一行有断点

    Log opened at 2012-02-26 22:49:46
    -> <init
    
    <- feature_set -i 2962 -n show_hidden -v 1
    -> <response
    
    <- feature_set -i 2963 -n max_depth -v 3
    -> <response
    
    <- feature_set -i 2964 -n max_children -v 30
    -> <response
    
    <- feature_get -i 2965 -n max_data
    -> <response
    
    // 5a) LISTS ALL BREAKPOINTS THAT ARE SET
    <- breakpoint_set -i 2966 -t line -s enabled -f file:///var/www/application/html/index.php -n 2
    -> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="http://xdebug.org/dbgp/xdebug" command="breakpoint_set" transaction_id="2966" state="enabled" id="180160005"></response>
    
    <- eval -i 2967 --
    -> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="http://xdebug.org/dbgp/xdebug" command="eval" transaction_id="2967"><property address="140734566267920" type="string" size="77" encoding="base64"><![CDATA[aHR0cDovL2RldmVsb3BtZW50Lm1hcmluYXMuY29tL2luZGV4LnBocD9YREVCVUdfU0VTU0lPTl9TVEFSVD1uZXRiZWFucy14ZGVidWc=]]></property></response>
    
    <- run -i 2968
    -> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="http://xdebug.org/dbgp/xdebug" command="run" transaction_id="2968" status="break" reason="ok"><xdebug:message filename="file:///var/www/application/html/index.php" lineno="2"></xdebug:message></response>
    
    <- stack_get -i 2969
    -> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="http://xdebug.org/dbgp/xdebug" command="stack_get" transaction_id="2969"><stack where="{main}" level="0" type="file" filename="file:///var/www/application/html/index.php" lineno="2"></stack></response>
    
    <- context_names -i 2970
    -> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="http://xdebug.org/dbgp/xdebug" command="context_names" transaction_id="2970"><context name="Locals" id="0"></context><context name="Superglobals" id="1"></context></response>
    
    <- context_get -i 2971 -c 0
    -> <response xmlns= // SHOWS "Locals" VARIABLES
    
    <- context_get -i 2972 -c 1
    -> <response xmlns= // SHOWS "Superglobals" VARIABLES
    
    // 5b) CLICK CONTINUE
    <- run -i 2973
    -> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="http://xdebug.org/dbgp/xdebug" command="run" transaction_id="2973" status="stopping" reason="ok"></response>
    


    6) “第一行执行中断”= 关闭,第 10 行有断点

    Log opened at 2012-02-27 00:46:23
    -> <init
    
    <- feature_set -i 3052 -n show_hidden -v 1
    -> <response
    
    <- feature_set -i 3053 -n max_depth -v 3
    -> <response
    
    <- feature_set -i 3054 -n max_children -v 30
    -> <response
    
    <- feature_get -i 3055 -n max_data
    -> <response
    
    // 6a) LISTS ALL BREAKPOINTS THAT ARE SET
    <- breakpoint_set -i 3056 -t line -s enabled -f file:///var/www/application/html/index.php -n 10
    -> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="http://xdebug.org/dbgp/xdebug" command="breakpoint_set" transaction_id="3056" state="enabled" id="179990006"></response>
    
    <- eval -i 3057 --
    -> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="http://xdebug.org/dbgp/xdebug" command="eval" transaction_id="3057"><property address="140734566267920" type="string" size="77" encoding="base64"><![CDATA[aHR0cDovL2RldmVsb3BtZW50Lm1hcmluYXMuY29tL2luZGV4LnBocD9YREVCVUdfU0VTU0lPTl9TVEFSVD1uZXRiZWFucy14ZGVidWc=]]></property></response>
    
    <- run -i 3058
    -> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="http://xdebug.org/dbgp/xdebug" command="run" transaction_id="3058" status="break" reason="ok"><xdebug:message filename="file:///var/www/application/html/index.php" lineno="10"></xdebug:message></response>
    
    <- stack_get -i 3059
    -> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="http://xdebug.org/dbgp/xdebug" command="stack_get" transaction_id="3059"><stack where="{main}" level="0" type="file" filename="file:///var/www/application/html/index.php" lineno="10"></stack></response>
    
    <- context_names -i 3060
    -> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="http://xdebug.org/dbgp/xdebug" command="context_names" transaction_id="3060"><context name="Locals" id="0"></context><context name="Superglobals" id="1"></context></response>
    
    <- context_get -i 3061 -c 0
    -> <response xmlns= // SHOWS "Locals" VARIABLES
    
    <- context_get -i 3062 -c 1
    -> <response xmlns= // SHOWS "Superglobals" VARIABLES
    
    // 6b) CLICK CONTINUE
    <- run -i 3063
    -> <response xmlns="urn:debugger_protocol_v1" xmlns:xdebug="http://xdebug.org/dbgp/xdebug" command="run" transaction_id="3063" status="stopping" reason="ok"></response>
    

    好好的,

    【讨论】:

    • 谢谢乔,我熟悉如何使用调试器。我的问题是 MacGDBp 总是在执行的第一行中断,即使我已经关闭了该设置。我不确定是程序问题还是 xDebug 问题。
    • 嗨 Naatan,我添加了一些关于 xdebug 日志条目的信息。
    • 嗨 Naatan,还有一些想法。 MacGDBp 的源代码是可用的,我查看了它,如果您有 xcode ide(它可以从 mac 应用商店免费下载),您可以将该设置更改为关闭并编译它。另一种选择是使用 netbeans ide 的 mac 版本。我使用的是windows版本,它与xdebug配合得很好。
    • 哇,令人印象深刻的工作乔,如果我找到解决方案,我一定会调查并报告。我目前使用 Komodo IDE 进行调试,但我使用 Sublime Text 2 作为我的主要 IDE,因此使用像 MacDBGp 这样的轻量级程序进行调试会更理想。顺便说一句,你用什么来记录那些 xDebug 查询?我一直在研究构建一个 xDebug 客户端,并且能够记录这样的查询将非常有用。谢谢!
    • 嗨 Naatan,您可以将 xdebug.remote_log=PATH/FILE_NAME 添加到您添加其他 xdebug 设置的 php.ini 文件中。我的服务器是 linux,所以我可以在调试模式下使用“tail”命令查看日志,以观察日志的更新情况。
    猜你喜欢
    • 2012-01-26
    • 1970-01-01
    • 2021-03-03
    • 1970-01-01
    • 2016-06-07
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2012-02-23
    相关资源
    最近更新 更多