MiraiForum

    • Register
    • Login
    • Search
    • Popular
    • Recent
    • Unsolved
    • Tags
    • Groups
    • 友情链接

    MCL Remote Debug, 在真实运行环境附加Debug

    开发交流
    2
    3
    87
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • cssxsh
      cssxsh last edited by cssxsh

      2.11.0 之后 mirai 更新了类加载方式,并实现了类隔离
      gradle/maven 的 test 并不能很好的模拟 真实运行环境
      不如使用 JVM Remote Debug

      • 准备一份 mcl 作为正常运行环境,将编译好的插件放入
      • 然后 mcl 启动时添加 java 参数, 8089是端口,你可以改
        -Xdebug -Xrunjdwp,transport=dt_socket,server=y,suspend=y,address=8089
        编辑启动脚本,这里是 mcl.bat
      @echo off
      set JAVA_BINARY=java
      %JAVA_BINARY% -Xdebug -Xrunjdwp,transport=dt_socket,server=y,suspend=y,address=8089 -jar mcl.jar %*
      
      • mcl 启动之后会等待 Remote Debug 链接

      • 然后在 idea 里 添加 一个 Remote Debug ,端口是上面 的 8089, 启动测试,
        be9f775f-d57e-446d-8cd5-ef7697cd275b-image.png
        703c0d38-ab0d-4c6f-a4b0-b41317f245ee-image.png
        选择合适的 module classpath

      • 你就可以打断点查看正常运行环境下的运行状态了

      1 Reply Last reply Reply Quote 1
      • cssxsh
        cssxsh last edited by cssxsh

        或者你可以直接使用 idea 运行 mcl,
        30f5b77a-91fc-4983-90ab-1680102356b5-image.png

        1 Reply Last reply Reply Quote 0
        • Orisland
          Orisland 摸鱼 last edited by

          听说spring用得到?

          1 Reply Last reply Reply Quote 0
          • 1 / 1
          • First post
            Last post
          Powered by Mamoe Technologies & NodeBB | 友情链接 | 服务监控 | Contact