Entries:
Comments:
Discussions:

Loading user information from Channel 9

Something went wrong getting user information from Channel 9

Latest Achievement:

Loading user information from MSDN

Something went wrong getting user information from MSDN

Visual Studio Achievements

Latest Achievement:

Loading Visual Studio Achievements

Something went wrong getting the Visual Studio Achievements

Comments

Andrew Richards windev Andrew Richards
  • Defrag Tools: #14 - WinDbg - SOS

    @DakotaGeek: Here's the (abridged) code I have in my 'preferences' extension that does the same thing as your script. I load my extension on the command line with "-a myext.dll" and auto-load SOS in DebugExtensionInitialize (or manually via !loadsos). (In my version, it also executes .prefer_dml 1, etc.)

    HRESULT Execute(IDebugClient* pDebugClient, PCSTR szCommand, BOOL bPrivate)
    {
        HRESULT hr = E_FAIL;
        // Make our own client
        IDebugClient* pDebugCreated;
        if (SUCCEEDED(hr = pDebugClient->CreateClient(&pDebugCreated)))
        {
            IDebugControl* pDebugControl;
            if (SUCCEEDED(hr = pDebugCreated->QueryInterface(__uuidof(IDebugControl), (void **)&pDebugControl)))
            {
                if (bPrivate)
                {
                    hr = pDebugControl->Execute(DEBUG_OUTCTL_THIS_CLIENT | DEBUG_OUTCTL_NOT_LOGGED, szCommand, DEBUG_EXECUTE_NOT_LOGGED | DEBUG_EXECUTE_NO_REPEAT);
                }
                else
                {
                    hr = pDebugControl->Execute(DEBUG_OUTCTL_ALL_CLIENTS, szCommand, DEBUG_EXECUTE_NO_REPEAT);
                }
                pDebugControl->Release();
            }
            pDebugCreated->Release();
        }
        return hr;
    }
    
    HRESULT loadsos(IDebugClient* pDebugClient, PCSTR args)
    {
        UNREFERENCED_PARAMETER(args);
        HRESULT hr = S_OK;
        IDebugSymbols* pDebugSymbols;
        hr = pDebugClient->QueryInterface(__uuidof(IDebugSymbols), (void **)&pDebugSymbols);
        if (SUCCEEDED(hr))
        {
            ULONG nIndex = 0xFFFF;
    
            // .NET 2.0
            hr = pDebugSymbols->GetModuleByModuleName("mscorwks", 0, &nIndex, NULL);
            if ((hr == S_OK) && (nIndex !=0xFFFF))
            {
                hr = Execute(pDebugClient, ".loadby sos mscorwks", TRUE);
                hr = Execute(pDebugClient, ".cordll -l", TRUE);
                goto CleanUp;
            }
    
            // .NET 4.0
            hr = pDebugSymbols->GetModuleByModuleName("clr", 0, &nIndex, NULL);
            if ((hr == S_OK) && (nIndex !=0xFFFF))
            {
                hr = Execute(pDebugClient, ".loadby sos clr", TRUE);
                hr = Execute(pDebugClient, ".cordll -l", TRUE);
                goto CleanUp;
            }
    
            // Silverlight
            hr = pDebugSymbols->GetModuleByModuleName("coreclr", 0, &nIndex, NULL);
            if ((hr == S_OK) && (nIndex !=0xFFFF))
            {
                hr = Execute(pDebugClient, ".loadby sos coreclr", TRUE);
                hr = Execute(pDebugClient, ".cordll -l", TRUE);
                goto CleanUp;
            }
    CleanUp:
            pDebugSymbols->Release();
        }
        return hr;
    }
    extern "C" HRESULT CALLBACK
    DebugExtensionInitialize(PULONG Version, PULONG Flags)
    {
        *Version = DEBUG_EXTENSION_VERSION(EXT_MAJOR_VER, EXT_MINOR_VER);
        *Flags = 0;  // Reserved for future use.
    
        HRESULT hr = S_OK;
        IDebugClient* pDebugClient;
        hr = DebugCreate(__uuidof(IDebugClient), (void **)&pDebugClient);
        if (hr == S_OK)
        {
            // Load SOS and do .cordll
            loadsos(pDebugClient, NULL);
            pDebugClient->Release();
        }
        return hr;
    }
    

  • Defrag Tools: #14 - WinDbg - SOS

    @Cyberbrad: You have to have a full dump for any managed application. Annoying - I know... especially when the application has 24Gb+ of RAM (eg. Exchange).

    !clrstack just lists the managed frames. !dumpstack lists the managed and native frames (it's the closest to 'k').

  • Defrag Tools: #14 - WinDbg - SOS

    @MagicAndre1981: That is definitely a planned series of episodes. We will do that for user and kernel..

  • Defrag Tools: #14 - WinDbg - SOS

    @MagicAndre1981: I didn't want to mention PSSCORx as it is a download, and not in the box.  The vast majority of debugs don't need it (over SOS). Saying that, I did use it for the last few years up until recently where some bugs in them made me go back to SOS. If you like PSSCOR, also check out SOSEx, which is a companion to SOS or PSSCORx.

    Kernel - I think Chad mentions CtrlScrollScroll and CrashOnNMI in next week's episode, and I think I might have in #1 too... If it was missed, email the show (defragtools@microsoft.com) and I'll go over them in the next kernel debugging video shoot.

    If you question is more about kernel hang debugging vs. crash debugging, we'll cover that ~6 episodes from now.

    @Philip Saunders: ProcDump v5.1 is still going through the signing process. I'll ping Mark to see if it can be expedited.

    [UPDATE: 16th Nov. 2012 -- ProcDump v5.1 is now available]

  • Defrag Tools: #14 - WinDbg - SOS

    @Shayan_Anique: It was taped pre-GA (3rd Oct).  My laptop is now Windows 8.

  • Defrag: Bing Desktop on 8, RAID0 SSD, Build Favorites

    @dentaku: Try Best Buy. They are definitely selling the OS and devices. And there is always the MS Stores - if there is one nearby, it is worth the trip.

    If you can wait a week or so, you should see a new wave of x86/x64 touch devices hit the stores - the OEMs are releasing the rest of their models just before Thanksgiving.

  • Defrag Tools: Live - //build/ 2012

    It's correct - it just got reposted here as the other post was associated with //build/, and not Defrag Tools.  The plan was to post the //build/ video last week and post a new episode this week, but we got too far behind schedule. The WinDBG series will return next Monday - with an episode on SOS.

  • Defrag Tools: #12 - TaskMgr and ResMon

    @Kaz: That's a really good question. I don't think you can via any menu. And you can't select the text in the added column. I think Process Monitor is the answer (using the properties dialog).

  • Part 1: Series Introduction

    @BobTabor: BTW, it takes about 14hrs to go through it all (with some replays and breaks)... I started at 8am and ended after 10pm. Only had a short lunch and dinner and took a few phone calls -- so all-in-all, about 11-12hrs of training.

  • Part 1: Series Introduction

    Just watched all 34 episodes back-to-back. (Power was out in the office so I thought I'd make the most of the day).

    Wow, what a great series. I'm a Win32 C++ guy, with little UI or C# experience, and I followed along easily with all the concepts Bob presented. I'm enthused to write my own app now - just need an idea... Maybe something to do with my series "Defrag Tools"? Tip of the day/week perhaps?

    Thanks Bob!