microsoft / MIEngine

The Visual Studio MI Debug Engine ("MIEngine") provides an open-source Visual Studio Debugger extension that works with MI-enabled debuggers such as gdb and lldb.
MIT License
818 stars 218 forks source link

ExclusiveCmdAsync stuck on "info sharedlibrary" #574

Open menting311 opened 7 years ago

menting311 commented 7 years ago

@gregg-miskelly When attaching to a running process through VS 17 it would always hang at some point in the process. So I cloned this project and but some breakpoints in to see where it is hanging. Turns out that the command "info sharedlibrary" is getting hung up, if I but some code in Debugger.cs to return "" when this command is going to run it no longer hangs.

I am also able to duplicate this randomly if I run the same command on the command line when attaching to a pid. This is what I run:

gdb --interpreter=mi Then from (gdb) prompt (I pulled these from the output of the MIEngine debug session): 1001-gdb-set target-async on 1002-gdb-set stop-on-solib-events 1 1003-interpreter-exec console "shell readlink -f /proc/1716/exe” 1004-file-exec-and-symbols /code/tmenting/dev/wms/src/my_pg 1005-interpreter-exec console "show architecture" 1006-target-attach 1716 1007-thread-info 1 1008-break-insert -f hubmgrmenu.cpp:290 1009-symbol-list-lines /code/tmenting/dev/wms/src/my_pg.cpp 1010-break-insert -f my_pgm.cpp:143 1011-interpreter-exec console "info sharedlibrary"

Sometimes I get the full list and that returns me to the (gdb) prompt. However, the problem is that sometimes I get part of the output displayed to screen, and it waits for me to press enter to display the rest. It is almost like it is being piped to "less" and I have to enter to continue

How can we work around this? I am evaluating VS17 to see if it works for our environment. I would like to get this figured out soon before my trial periods start running out.

I have more data I could send privately if you are willing. Thanks!

paulmaybee commented 7 years ago

I think you can turn off the pagination and that should keep gdb from asking for the RET.

From the command window enter Debug.MIDebugExec set pagination off

Or you can add the same text to your project properties Properties->Debugger->Additional Debugger Commands = set pagination off

We should be starting gdb with the –batch option which makes this command unnecessary. I will see that it gets fixed.

paulmaybee commented 7 years ago

Disregard the “-batch” comment. That’s not the correct fix on our side.

menting311 commented 7 years ago

This seems to work when I click on launch (clicking "remote GDB debugger"). However, my issues thus far, has been more with attaching to a process already running. Many of our programs have a UI that we need to navigate through so I need to start the pgm up and then attach to it.

I have used the MIEngine again to step through the commands going to gdb. -- When launching a prog through VS17 the command gets sent just before "info sharedlibrary" -- When attaching to a process (Ctrl-Alt-P) the "additional commands" are not sent

I guess that makes sense as that is a project specific setup. How can these "additional debugger commands" be set for all uses of debugging via GDB?

paulmaybee commented 7 years ago

There is no current way to customize the gdb setup for attach so I don't have a workaround for you. I have fixed this issues in the MIEngine (PR #577). It should show up in a VS2017 update in the near future.

menting311 commented 7 years ago

Will this change, when it makes it into VS17, then fix the "attach" scenario as well? I assume so because when I customize the MIEngine (with a hack to prevent the "info sharedlibrary") it fixes the "attach" scenario as well. I just want to make sure if I wait for the update it will have the impact I am expecting.

Lastly, thanks for the quick response and fix!

paulmaybee commented 7 years ago

If will fix both launch and attach.