locked
Getting a reference to the debugger in the active debugging session RRS feed

  • Question

  • Hi,

    1. I am writing a VS Extension package ( Microsoft.VisualStudio.Shell.Package )
    2. The extension pack is mainly intended for native code
    3. The application has to be able to get read-only access to the debugee process address space

    Is it possible to access the active debugger in order to get direct access to the Debugee memory space? ( should also work with remote debugging )

    is 'Package.GetGlobalService' the way to go? what type should I provide?

    Any help will be appreciated

     


    Nadav Rubinstein, http://www.sophin.com
    Saturday, April 10, 2010 8:40 AM

Answers

  • Hi Nadavrub,

    You can use IVsDebugger interface to access active debugger in Package, but it just provides a way to access to the current debugger so that the package can listen for debugger events. And I think there is no way to get read-only access to the debugee process address space. If you want to get active debugger, you can use:

     IVsDebugger debugger = Package.GetGlobalService(typeof(SVsShellDebugger)) as IVsDebugger;
    
    

    For more information about IVsDebuger Interface, please see:

    http://msdn.microsoft.com/en-us/library/bb167446(v=VS.80).aspx

    If I misunderstood you, or you have any comments, please let me know.

    Best Regards,

    Nancy


    Please remember to mark the replies as answers if they help and unmark them if they provide no help.
    Welcome to the All-In-One Code Framework! If you have any feedback, please tell us.
    • Marked as answer by Nancy Shao Monday, April 19, 2010 4:44 AM
    Wednesday, April 14, 2010 2:48 PM

All replies

  • Hi Nadavrub,

    You can use IVsDebugger interface to access active debugger in Package, but it just provides a way to access to the current debugger so that the package can listen for debugger events. And I think there is no way to get read-only access to the debugee process address space. If you want to get active debugger, you can use:

     IVsDebugger debugger = Package.GetGlobalService(typeof(SVsShellDebugger)) as IVsDebugger;
    
    

    For more information about IVsDebuger Interface, please see:

    http://msdn.microsoft.com/en-us/library/bb167446(v=VS.80).aspx

    If I misunderstood you, or you have any comments, please let me know.

    Best Regards,

    Nancy


    Please remember to mark the replies as answers if they help and unmark them if they provide no help.
    Welcome to the All-In-One Code Framework! If you have any feedback, please tell us.
    • Marked as answer by Nancy Shao Monday, April 19, 2010 4:44 AM
    Wednesday, April 14, 2010 2:48 PM
  • Hi Nancy,

    Thanks for your responce, unfortunetely, as U have noted, IVsDebugger doesn't provide the ability of reading the debugee addrspace, the next best thing for me to do is to get a reference to the VsDebugTargetProcessInfo structure of the debugee process, this will enable me to use unmanage code to read the process memory, BUT, will not work while debugging a remote process.

    A reference to VsDebugTargetProcessInfo can be retrived using the IVsDebugLaunchHook.OnLaunchDebugTargets method, however, how do I get that interface... ??

    Another Q, reading IVsDebug*.* definition I can C that all use COM Interop, is the COM interfaces specified anywhare? migth there B unmanaged COM API for debugging native assemblies such as the Unmanaged CLR debugging API ?

    Any help will B appreciated


    Nadav Rubinstein, http://www.sophin.com
    Friday, April 23, 2010 7:27 PM