Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to get the name of a Mono function from a stack using Windbg

I am trying to debug a mono application using WinDbg. The application hangs in an infinite loop inside the C# code that WinDbg is not able to decode internally.

I know I can use the function mono_pmip() to translate a stack address to the name of the function

I'm using .call mono!mono_pmip(0x63a0630) (verified as available using x *!*pmip*), but I still can't get the output of the function, I get an access violation instead.

This is the stack:

34 018feee8 071824eb 0x71824eb
35 018fef08 07181f4c 0x71824eb
36 018fef28 0717fd8a 0x7181f4c
37 018fef68 071708ae 0x717fd8a
38 018fefc8 07170328 0x71708ae
39 018ff078 0716efa5 0x7170328
3a 018ff0e8 0716ed4c 0x716efa5
3b 018ff108 18de8f88 0x716ed4c
3c 018ff1b8 18de75ff 0x18de8f88
3d 018ff208 18de6f6f 0x18de75ff
3e 018ff238 18de660c 0x18de6f6f
3f 018ff2f8 18de60ce 0x18de660c
40 018ff328 18de6033 0x18de60ce
41 018ff348 18ddf586 0x18de6033
42 018ff3e8 18ddebc6 0x18ddf586
43 018ff408 18dde13e 0x18ddebc6
44 018ff418 063a0630 0x18dde13e
45 018ff450 100f1328 0x63a0630
46 018ff480 1005d984 mono!mono_jit_runtime_invoke+0x214 [c:\buildslave\mono\build\mono\mini\mini.c @ 4936]
47 018ff4a4 0035e9ce mono!mono_runtime_invoke+0x51 [c:\buildslave\mono\build\mono\metadata\object.c @ 2623]

the same function actually works if I use the immediate windows in Visual Studio

(char*)mono.dll!mono_pmip((void*)0x63a0630)
0x15ebf258 " Login.Login:OnClickLoginButton () + 0x4b (21FF75F8 21FF765C) [06E26E70 - Unity Root Domain]"

still I need to make it run in Windbg :(

I wonder if I have to execute the call on the same thread of the call stack I want to debug.

like image 218
sebas Avatar asked Nov 09 '22 10:11

sebas


1 Answers

I realised I never answered this question. (char*)mono.dll!mono_pmip((void*)address) is available only on the mainthread, so I had to select the main thread first from the thread list.

like image 135
sebas Avatar answered Dec 26 '22 04:12

sebas