*
* To log more kind of locks just do the following:
* - add an entry into the RuntimeLocks enum
- * - change EnterCriticalSection(mutex) to mono_locks_acquire (mutex, LockName)
- * - change LeaveCriticalSection to mono_locks_release (mutex, LockName)
+ * - change mono_mutex_lock(mutex) to mono_locks_acquire (mutex, LockName)
+ * - change mono_mutex_unlock to mono_locks_release (mutex, LockName)
* - change the decoder to understand the new lock kind.
*
* TODO:
#endif
static FILE *trace_file;
-static CRITICAL_SECTION tracer_lock;
+static mono_mutex_t tracer_lock;
static size_t base_address;
typedef enum {
Dl_info info;
int res;
char *name;
- InitializeCriticalSection (&tracer_lock);
+ mono_mutex_init_recursive (&tracer_lock);
if (!g_getenv ("MONO_ENABLE_LOCK_TRACER"))
return;
name = g_strdup_printf ("locks.%d", getpid ());
add_record (RecordType record_kind, RuntimeLocks kind, gpointer lock)
{
int i = 0;
- gpointer frames[10];
+ const int no_frames = 6;
+ gpointer frames[no_frames];
+
char *msg;
if (!trace_file)
return;
- memset (frames, 0, sizeof (gpointer));
- mono_backtrace (frames, 6);
- for (i = 0; i < 6; ++i)
+ memset (frames, 0, sizeof (gpointer) * no_frames);
+ mono_backtrace (frames, no_frames);
+ for (i = 0; i < no_frames; ++i)
frames [i] = (gpointer)((size_t)frames[i] - base_address);
/*We only dump 5 frames, which should be more than enough to most analysis.*/