Giter VIP home page Giter VIP logo

Comments (5)

mattwarren avatar mattwarren commented on August 28, 2024

Just for reference, if I create a full memory dump of the same process, load it into WinDbg and then run the SOS command -u, I get the following method names resolved, i.e.:

mov rdx,offset mscorlib_ni+0x6b1180 (000007fe`f5691180) (MT: System.Collections.Generic.Dictionary`2+Enumerator[[System.String, mscorlib],[System.String, mscorlib]])
call    mscorlib_ni+0x46c010 (000007fe`f544c010) (System.Collections.Generic.Dictionary`2+Enumerator[[System.__Canon, mscorlib],[System.__Canon, mscorlib]].MoveNext(), mdToken: 0000000006006b95)

Here's the full output:

000007fe`973a6e83 488b4d10        mov     rcx,qword ptr [rbp+10h]
000007fe`973a6e87 488b4908        mov     rcx,qword ptr [rcx+8]
000007fe`973a6e8b 8b11            mov     edx,dword ptr [rcx]
000007fe`973a6e8d 33d2            xor     edx,edx
000007fe`973a6e8f 488d4590        lea     rax,[rbp-70h]
000007fe`973a6e93 c4e17957c0      vxorpd  xmm0,xmm0,xmm0
000007fe`973a6e98 c4e17a7f00      vmovdqu xmmword ptr [rax],xmm0
000007fe`973a6e9d c4e17a7f4010    vmovdqu xmmword ptr [rax+10h],xmm0
000007fe`973a6ea3 48895020        mov     qword ptr [rax+20h],rdx
000007fe`973a6ea7 48894d90        mov     qword ptr [rbp-70h],rcx
000007fe`973a6eab 8b493c          mov     ecx,dword ptr [rcx+3Ch]
000007fe`973a6eae 894d98          mov     dword ptr [rbp-68h],ecx
000007fe`973a6eb1 89559c          mov     dword ptr [rbp-64h],edx
000007fe`973a6eb4 c745a002000000  mov     dword ptr [rbp-60h],2
000007fe`973a6ebb 488d4da8        lea     rcx,[rbp-58h]
000007fe`973a6ebf c4e17957c0      vxorpd  xmm0,xmm0,xmm0
000007fe`973a6ec4 c4e17a7f01      vmovdqu xmmword ptr [rcx],xmm0
000007fe`973a6ec9 c4e17a6f4590    vmovdqu xmm0,xmmword ptr [rbp-70h]
000007fe`973a6ecf c4e17a7f45c8    vmovdqu xmmword ptr [rbp-38h],xmm0
000007fe`973a6ed5 c4e17a6f45a0    vmovdqu xmm0,xmmword ptr [rbp-60h]
000007fe`973a6edb c4e17a7f45d8    vmovdqu xmmword ptr [rbp-28h],xmm0
000007fe`973a6ee1 488b4db0        mov     rcx,qword ptr [rbp-50h]
000007fe`973a6ee5 48894de8        mov     qword ptr [rbp-18h],rcx
000007fe`973a6ee9 488d4dc8        lea     rcx,[rbp-38h]
000007fe`973a6eed 48ba801169f5fe070000 mov rdx,offset mscorlib_ni+0x6b1180 (000007fe`f5691180) (MT: System.Collections.Generic.Dictionary`2+Enumerator[[System.String, mscorlib],[System.String, mscorlib]])
000007fe`973a6ef7 e814510a5e      call    mscorlib_ni+0x46c010 (000007fe`f544c010) (System.Collections.Generic.Dictionary`2+Enumerator[[System.__Canon, mscorlib],[System.__Canon, mscorlib]].MoveNext(), mdToken: 0000000006006b95)
000007fe`973a6efc 84c0            test    al,al
000007fe`973a6efe 742a            je      000007fe`973a6f2a
000007fe`973a6f00 488d4de0        lea     rcx,[rbp-20h]
000007fe`973a6f04 488b11          mov     rdx,qword ptr [rcx]
000007fe`973a6f07 488955b8        mov     qword ptr [rbp-48h],rdx
000007fe`973a6f0b 488b4908        mov     rcx,qword ptr [rcx+8]
000007fe`973a6f0f 48894dc0        mov     qword ptr [rbp-40h],rcx
000007fe`973a6f13 488d4dc8        lea     rcx,[rbp-38h]
000007fe`973a6f17 48ba801169f5fe070000 mov rdx,offset mscorlib_ni+0x6b1180 (000007fe`f5691180) (MT: System.Collections.Generic.Dictionary`2+Enumerator[[System.String, mscorlib],[System.String, mscorlib]])
000007fe`973a6f21 e8ea500a5e      call    mscorlib_ni+0x46c010 (000007fe`f544c010) (System.Collections.Generic.Dictionary`2+Enumerator[[System.__Canon, mscorlib],[System.__Canon, mscorlib]].MoveNext(), mdToken: 0000000006006b95)
000007fe`973a6f26 84c0            test    al,al
000007fe`973a6f28 75d6            jne     000007fe`973a6f00
000007fe`973a6f2a 488b4c2420      mov     rcx,qword ptr [rsp+20h]
000007fe`973a6f2f e811000000      call    000007fe`973a6f45 (BenchmarkDotNet.Samples.Framework.Framework_DictionaryVsIDictionary.DictionaryEnumeration(), mdToken: 000000000600008f)
``

from clrmd.

leculver avatar leculver commented on August 28, 2024

Sorry for the (long) delay in responding. Things tend to be very slow around here from the end of November to January 1st. I have been on vacation.

IDebugControl doesn't know anything about CLR constructs. In fact, the implementation !u in SOS actually captures the output of IDebugControl::Disassemble, runs it through text processing, resolves references to managed code, and does inline text replacement. That's how SOS's !u works under-the-hood. If you want similar functionality you'll need to similarly parse the output of Disassemble and do the inline replacement yourself, mostly using ClrRuntime.GetMethodByAddress.

As for Disassemble resolving mscorwks!JIT_Throw or not: this isn't managed code. Whether Disassemble can resolve it or not depends entirely on whether you have mscorwks.pdb loaded into your instance of IDebugClient or not. This should be indexed on the public symbol server, so doing the equivalent of .sympath http://msdl.microsoft.com/download/symbols; .reload in the IDebug interfaces should get mscorwks!JIT_Throw (and similar).

Does that help at all?

from clrmd.

mattwarren avatar mattwarren commented on August 28, 2024

Thanks for the reply, it's very helpful. It turns out that I'm actually already parsing the output in the same way it that SOS !u (based on your description), so that's cool. Although I was creating a lookup of method address -> name, I somehow missed ClrRuntime.GetMethodByAddress, so thanks for that.

Also thanks for the tips about the symbol paths, for anyone else who finds this issue I'm currently using code like this, which seems to work:

var symbols = dataTarget.DebuggerInterface as IDebugSymbols;
symbols.SetSymbolPath("http://msdl.microsoft.com/download/symbols");
var control = dataTarget.DebuggerInterface as IDebugControl;
control.Execute(DEBUG_OUTCTL.NOT_LOGGED, ".reload", DEBUG_EXECUTE.NOT_LOGGED);

from clrmd.

ayende avatar ayende commented on August 28, 2024

@mattwarren Is the disassembly code available?

from clrmd.

mattwarren avatar mattwarren commented on August 28, 2024

@ayende Unfortunately I never finished the disassembly code, but if you want a working version take a look at the excellent msos library from @goldshtn.

It's built on-top of CLRMD and supports the !u cmd, see here https://github.com/goldshtn/msos/blob/master/msos/Disassemble.cs

from clrmd.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.