none
Confusion: IDebugInputCallbacks/SetInputCallbacks RRS feed

  • Question

  • Hello,

     I have question with windbg extension callbacks:

     

    https://docs.microsoft.com/en-us/windows-hardware/drivers/debugger/using-input-and-output

    When the engine asks for input from a client, it uses the IDebugInputCallbacks object registered with that client. An IDebugInputCallbacks object may be registered with a client using SetInputCallbacks. Each client can have at most one IDebugInputCallbacks object registered with it.

     

    1. Does “each” suggest it is designed to allow multiple clients coexist?
    2. I got confused because as in windbg 10 SDK’s exts sample, INIT_API() wraps call to the following function; And in the exts.dll example, when each !extension command is called, the “client” pointer is passed to the function (such like HRESULT CALLBACK cmdsample(PDEBUG_CLIENT4 ClientPCSTR args))’s first argument, and the COM interface get queried by the INIT_API() command. The logic looks quite obviously that there is only a single client object, i.e., the one pointed by the “PDEBUG_CLIENT4 Client” pointer, and it refers to the windbg program (or engine) itself. Correct me if I am wrong.
    extern "C" HRESULT
    ExtQuery(PDEBUG_CLIENT4 Client)
    {
        HRESULT Status;
     
        if ((Status = Client->QueryInterface(__uuidof(IDebugControl),
                                     (void **)&g_ExtControl)) != S_OK)
        {
            goto Fail;
        }
        if ((Status = Client->QueryInterface(__uuidof(IDebugSymbols2),
                                    (void **)&g_ExtSymbols)) != S_OK)
        {
        goto Fail;
        }
        g_ExtClient = Client;
     
        return S_OK;
     
     Fail:
        ExtRelease();
        return Status;

    }

    3. I tried to test if there is a unique or there are multiple clients by creating two extension dlls, each exposes fun1() and fun2(), and both functions contain a line

    dprintf("Client=%d\n", (unsigned int)Client);

    . When I test with !exts1.func1(),!exts1.func2(),!exts2.func1() and !exts2.func2(), they all print out the same converted uint value, which suggest there is only one client exist, namely the windbg main application itself.

    4. The IDebugInputCallbacks and SetInputCallbacks do not have corresponding in sdk sample. Please kindly refer me to official MS examples/tutorial to get started.

     

     

    Bob

    Thursday, May 31, 2018 10:31 AM

All replies

  • I do not know any official sample by MS for
    IDebugInputCallbacks/SetInputCallbacks
    Looks like the SDK sample you mentioned uses the debug-client of windbg, but as you can see here, it is possible to have more than one debug-client in a windbg extension:
    Debugger Engine API - Writing a Debugging Tools for Windows Extension, Part 3: Clients and Callbacks
    https://msdn.microsoft.com/en-us/magazine/hh205613.aspx

    With kind regards


    Friday, June 1, 2018 8:08 AM