Search code examples
monogendarme

Running Gendarme after copying Mono.Cecil.Mdb.dll into mono/lib/gendarme/ causes an error


The Gendarme installation (v3.10.0.0) on my machine CentOS (release 6.5 Final) was unable to report line numbers. Upon some searching I found that Mono.Cecil.Mdb.dll was missing in the installation as suggested in the FAQs

After doing some search on resolving this, I came across this link. Therefore, I copied the dll from MonoDevelop installation directory as suggested in the link.

Now, when I run Gendarme, I get the following trace:

Gendarme v3.10.0.0
Copyright (C) 2005-2011 Novell, Inc. and contributors

InitializationUnhandled loader error: 8, (null) Mono.Cecil, Version=0.9.5.12082, Culture=neutral, PublicKeyToken=0738eb9f132ed756 (null)
* Assertion: should not be reached at loader.c:299

Stacktrace:

  at <unknown> <0xffffffff>
  at (wrapper managed-to-native) System.Type.internal_from_name (string,bool,bool) <0x00069>
  at System.Type.GetType (string) <0x00023>
  at Gendarme.Framework.Rocks.ModuleRocks.LoadDebuggingSymbols (Mono.Cecil.ModuleDefinition) <0x000a6>
  at Gendarme.Framework.Runner.Initialize () <0x00124>
  at Gendarme.ConsoleRunner.Initialize () <0x00075>
  at Gendarme.ConsoleRunner.Execute (string[]) <0x00422>
  at Gendarme.ConsoleRunner.Main (string[]) <0x00049>
  at (wrapper runtime-invoke) <Module>.runtime_invoke_int_object (object,intptr,intptr,intptr) <0x00103>

Native stacktrace:

        /opt/mono/bin/mono() [0x5f28e8]
        /lib64/libpthread.so.0(+0xf7e0) [0x7f1f91d497e0]
        /lib64/libc.so.6(gsignal+0x35) [0x7f1f917c25e5]
        /lib64/libc.so.6(abort+0x175) [0x7f1f917c3dc5]
        /opt/mono/bin/mono() [0x79b58e]
        /opt/mono/bin/mono() [0x79b37b]
        /opt/mono/bin/mono() [0x79b4dc]
        /opt/mono/bin/mono() [0x6a74da]
        /opt/mono/bin/mono() [0x68811d]
        /opt/mono/bin/mono() [0x68802d]
        /opt/mono/bin/mono() [0x689221]
        /opt/mono/bin/mono() [0x68948a]
        /opt/mono/bin/mono(mono_class_from_name+0x10) [0x689910]
        /opt/mono/bin/mono() [0x71f535]
        /opt/mono/bin/mono() [0x71f813]
        /opt/mono/bin/mono() [0x696141]
        [0x40f14c2a]

Debug info from gdb:

warning: File "/opt/mono/bin/mono-sgen-gdb.py" auto-loading has been declined by your `auto-load safe-path' set to "/usr/share/gdb/auto-load:/usr/lib/debug:/usr/bin/mono-gdb.py".
To enable execution of this file add
        add-auto-load-safe-path /opt/mono/bin/mono-sgen-gdb.py
line to your configuration file "/home/msehgal/.gdbinit".
To completely disable this security protection add
        set auto-load safe-path /
line to your configuration file "/home/msehgal/.gdbinit".
For more information about this security protection see the
"Auto-loading safe path" section in the GDB manual.  E.g., run from the shell:
        info "(gdb)Auto-loading safe path"
[New LWP 7645]
[New LWP 7644]
[Thread debugging using libthread_db enabled]
0x00007f1f91d4937d in waitpid () from /lib64/libpthread.so.0
  3 Thread 0x7f1f90fff700 (LWP 7644)  0x00007f1f91d4568c in pthread_cond_wait@@GLIBC_2.3.2 () from /lib64/libpthread.so.0
  2 Thread 0x7f1f9178f700 (LWP 7645)  0x00007f1f91d47a00 in sem_wait () from /lib64/libpthread.so.0
* 1 Thread 0x7f1f92aea780 (LWP 7643)  0x00007f1f91d4937d in waitpid () from /lib64/libpthread.so.0

Thread 3 (Thread 0x7f1f90fff700 (LWP 7644)):
#0  0x00007f1f91d4568c in pthread_cond_wait@@GLIBC_2.3.2 () from /lib64/libpthread.so.0
#1  0x0000000000763edc in ?? ()
#2  0x00007f1f91d41aa1 in start_thread () from /lib64/libpthread.so.0
#3  0x00007f1f91878aad in clone () from /lib64/libc.so.6

Thread 2 (Thread 0x7f1f9178f700 (LWP 7645)):
#0  0x00007f1f91d47a00 in sem_wait () from /lib64/libpthread.so.0
#1  0x000000000070a1a7 in ?? ()
#2  0x00000000006eb761 in ?? ()
#3  0x0000000000792e1a in ?? ()
#4  0x00007f1f91d41aa1 in start_thread () from /lib64/libpthread.so.0
#5  0x00007f1f91878aad in clone () from /lib64/libc.so.6

Thread 1 (Thread 0x7f1f92aea780 (LWP 7643)):
#0  0x00007f1f91d4937d in waitpid () from /lib64/libpthread.so.0
#1  0x00000000005f2970 in ?? ()
#2  <signal handler called>
#3  0x00007f1f917c25e5 in raise () from /lib64/libc.so.6
#4  0x00007f1f917c3dc5 in abort () from /lib64/libc.so.6
#5  0x000000000079b58e in ?? ()
#6  0x000000000079b37b in ?? ()
#7  0x000000000079b4dc in ?? ()
#8  0x00000000006a74da in ?? ()
#9  0x000000000068811d in ?? ()
#10 0x000000000068802d in ?? ()
#11 0x0000000000689221 in ?? ()
#12 0x000000000068948a in ?? ()
#13 0x0000000000689910 in mono_class_from_name ()
#14 0x000000000071f535 in ?? ()
#15 0x000000000071f813 in ?? ()
#16 0x0000000000696141 in ?? ()
#17 0x0000000040f14c2a in ?? ()
#18 0x000000000288d6b0 in ?? ()
#19 0x0000000000000000 in ?? ()

=================================================================
Got a SIGABRT while executing native code. This usually indicates
a fatal error in the mono runtime or one of the native libraries
used by your application.
=================================================================

What should I do to get line numbers in the report?


Solution

  • I was missing another dependency Mono.Cecil.dll. I got it from here and copied it to /mono/lib/gendarme along with Mono.Cecil.Mdb.dll from the installation of MonoDevelop as mentioned in the question.