pkulchenko / MobDebug

Remote debugger for Lua.
Other
889 stars 192 forks source link

Breakpoints never hit #52

Closed YuDang1024 closed 4 years ago

YuDang1024 commented 4 years ago

I use IDEA to debug my mobile Lua program image When using the default port 8172, the Android client cannot connect to my IDEA, so I use port 8082, because of this port, I have used adb to link it. But when everything is ready and IDEA shows "Connected", No breakpoint is hit image Where the code will run, the breakpoint will not hit. Has anyone encountered this problem? thank

YuDang1024 commented 4 years ago

In the code, I only use the start function, But in the github example, I found that they use: listen and loop functions. I don't know if this is the reason? And in my code, after I use the listen function, there will be an error: image I don’t know if the problem is caused by the current reason? If I can debug Lua on my phone, it will be a big deal for me

pkulchenko commented 4 years ago

You should use start() call. listen and loop calls are not going to help here.

If the connection between the application and the IDE is established during debugging, you may want to check this answer for details on why breakpoints may not be working: https://studio.zerobrane.com/doc-faq#why-breakpoints-are-not-triggered

If the connection is not established, you need to check if the application on the phone can get access to the computer port you are specifying and configure the IDE to listen on that port (using debugger.port setting: https://studio.zerobrane.com/doc-general-preferences#debugger).

You may also want to check these instructions for on-device debugging: http://notebook.kulchenko.com/zerobrane/corona-on-device-debugging-with-zerobrane-studio. They are for Corona SDK, but most of the steps will apply to other toolkits as well (in particular, I'm not sure if android.permission.INTERNET still needs to be adjusted).

YuDang1024 commented 4 years ago

I have carefully read this document above: https://studio.zerobrane.com/doc-faq#why-breakpoints-are-not-triggered. Ten possible reasons are listed in it, I compared them one by one. The first and second exclusions, the reason: I did not use any coroutine-related content in my Lua code. The fourth exclusion, reason: all my file names are in lowercase letters. The fifth rule is that the reason: after all the scripts are downloaded from the server to the Android memory, they have never been changed. There is no place in the Lua code that will modify the Lua script itself. The ninth exclusion, the reason: My Lua code line number exceeds 200 lines, but I still add the (require('mobdebug').checkcount = 1) field, and the breakpoint still cannot be hit. So now I have five reasons, there is no way to rule out. The third, sixth, seventh, eighth reasons. About the file path. My program is in C++, and I get the entry file of the Lua script: main.lua, The path used by C++ is also the absolute path of the server. Then use this main.lua to get other lua files from the server, The addresses given in lua are also the absolute path of the server, and then these files are downloaded to the Android memory through the network download module implemented in C++.

My debugging environment is: IDEA + Android Studio (Windows), The client is running on an Android phone,

IDEA opens the script folder stored on the server. I don’t know if this will affect it, but the only thing that bothers me now is the path issue.

As for the tenth reason, I am still determining whether it caused it. If there is any new development, I will come here to communicate with you. Thank you for taking the time to answer my questions in your busy schedule. Thank you very much!

YuDang1024 commented 4 years ago

I used another method, and now I can perform normal debugging. When I start the project, I use the start function. Then use the pause function when I need to make a breakpoint. I don’t know where I have a problem with the environment configuration in IDEA. The breakpoints generated by my mouse click operation in IDEA cannot stop my program for debugging. I think it may be necessary to write an adaptation layer for MobDebug. This is what I want to accomplish next. Thank you for providing MobDebug to us. Tips: Before, my breakpoint can only be moved in a single step in the current function, and cannot go to another function called in the function. The reason is that: the path of my server does not correspond to the path of the script in my client, so if there are friends who have the same problem as me, you can see if the path is inconsistent. Thanks again, you can close this question,

pkulchenko commented 4 years ago

I'm not sure what version of Mobdebug you are using, but can you try with the version from the master branch of the repository and report if there is any improvement with the breakpoint handling?

Can you also let me know what value is returned by debug.getinfo(1,"S").source call after require("mobdebug").start() command and what value the project directory is set to?

YuDang1024 commented 4 years ago

Feel your care, I solved this problem, and wrote my reason and solution in github, you can close my problem

https://github.com/pkulchenko/MobDebug/issues/52

------------------ 原始邮件 ------------------ 发件人: "pkulchenko/MobDebug" <notifications@github.com>; 发送时间: 2020年8月17日(星期一) 中午12:51 收件人: "pkulchenko/MobDebug"<MobDebug@noreply.github.com>; 抄送: "dy"<374489401@qq.com>;"Comment"<comment@noreply.github.com>; 主题: Re: [pkulchenko/MobDebug] Breakpoints never hit (#52)

I'm not sure what version of Mobdebug you are using, but can you try with the version from the master branch of the repository and report if there is any improvement with the breakpoint handling?

Can you also let me know what value is returned by debug.getinfo(1,"S").source call after require("mobdebug").start() command and what value the project directory is set to?

— You are receiving this because you commented. Reply to this email directly, view it on GitHub, or unsubscribe.