rainers / mago

Visual Studio plug-in for debugging D programs
http://dsource.org/projects/mago_debugger
Apache License 2.0
42 stars 10 forks source link

mago-mi: -break-insert -f does not work. #14

Open pirocks opened 6 years ago

pirocks commented 6 years ago

-break-insert -f allows for the insertion of breakpoints before the actual executable file is loaded. Breakpoints created like this seem to never be hit.

rainers commented 6 years ago

@buggins I guess this refers to mago-mi.

pirocks commented 6 years ago

Yes it does refer to mago-mi.

buggins commented 6 years ago

I will check it. I'm planning to work on dlangide debugging support improvement next month, so I can hack mago-mi

pirocks commented 6 years ago

Thanks. I've noticed another unrelated issue. See #15.

andre2007 commented 6 years ago

I also hit this issue. @pirocks I assume you ask because this is related to IntelliJ D plugin you are involved. I did some tests and it seems it is related to the order:

-- Breakpoint is not hit --

C:\D\tools\mago-mi.exe --interpreter=mi2
-break-insert -f C:/D/projects/magotest/source/app.d:6
-file-exec-and-symbols C:/D/projects/magotest/magotest.exe
run

-- Breakpoint is hit --

C:\D\tools\mago-mi.exe --interpreter=mi2
-file-exec-and-symbols C:/D/projects/magotest/magotest.exe
-break-insert -f C:/D/projects/magotest/source/app.d:6
run

-- Breakpoint is hit --

C:\D\tools\mago-mi.exe --interpreter=mi2 C:/D/projects/magotest/magotest.exe
-break-insert -f C:/D/projects/magotest/source/app.d:6
-list-features
run

The IntelliJ D Plugin has 2 issues:

I do not know whether setting breakpoints should be supported before the executable is set. But an easy way to solve the issue is just to change the OS call from C:\D\tools\mago-mi.exe --interpreter=mi2 to C:\D\tools\mago-mi.exe --interpreter=mi2 C:/D/projects/magotest/magotest.exe and remove the command "file C:/D/projects/magotest/magotest.exe" because the executable is already set. As far as I understood this is also the way DlangIDE is working.

andre2007 commented 6 years ago

I compared the behavior of GDB mi2 (linux) with MagoMI. In my test also GDB mi2 does not allow setting a breakpoint before the executable is specified. Doing so, will throw an error with the message "please specify executable first with command file".

Please note, while gdb mi2 knows the commands "file" and "-file-exec-and-symbols", MagoMI only knows command "-file-exec-and-symbols". Therefore "-file-exec-and-symbols" should be used by IntelliJ D plugin.

andre2007 commented 6 years ago

This issue can be closed. Today the merge of the pr was done which loads the executable first and then sets the breakpoints.

rainers commented 6 years ago

It might no longer be necessary for intellij, but the GDB/MI-API defines this function. So I think the issue can stay open.