[Mono-bugs] [Bug 78378][Nor] New - binary data symbol store is not supported

bugzilla-daemon at bugzilla.ximian.com bugzilla-daemon at bugzilla.ximian.com
Fri May 12 08:31:15 EDT 2006


Please do not reply to this email- if you want to comment on the bug, go to the
URL shown below and enter your comments there.

Changed by joe at otee.dk.

http://bugzilla.ximian.com/show_bug.cgi?id=78378

--- shadow/78378	2006-05-12 08:31:15.000000000 -0400
+++ shadow/78378.tmp.20115	2006-05-12 08:31:15.000000000 -0400
@@ -0,0 +1,209 @@
+Bug#: 78378
+Product: Mono: Runtime
+Version: 1.1
+OS: 
+OS Details: 
+Status: NEW   
+Resolution: 
+Severity: 
+Priority: Normal
+Component: misc
+AssignedTo: mono-bugs at ximian.com                            
+ReportedBy: joe at otee.dk               
+QAContact: mono-bugs at ximian.com
+TargetMilestone: ---
+URL: 
+Cc: 
+Summary: binary data symbol store is not supported
+
+The attached patch fixes the exception when using Assembly.LoadFrom with a binary data 
+symbol store.
+
+
+diff -Naur --exclude .DS_Store --exclude '*.rej' mono/mono/metadata/appdomain.c mono-
+patch_unity/mono/metadata/appdomain.c
+--- mono/mono/metadata/appdomain.c	2006-04-01 03:58:14.000000000 +0200
++++ mono-patch_unity/mono/metadata/appdomain.c	2006-04-29 20:08:49.000000000 
++0200
+@@ -28,6 +28,7 @@
+ #include <mono/metadata/marshal.h>
+ #include <mono/metadata/monitor.h>
+ #include <mono/metadata/threadpool.h>
++#include <mono/metadata/mono-debug.h>
+ #include <mono/utils/mono-uri.h>
+ 
+ #define MONO_CORLIB_VERSION 49
+@@ -991,16 +992,19 @@
+ 	guint32 raw_assembly_len = mono_array_length (raw_assembly);
+ 	MonoImage *image = mono_image_open_from_data_full (mono_array_addr (raw_assembly, 
+gchar, 0), raw_assembly_len, TRUE, NULL, refonly);
+ 
+-	if (raw_symbol_store)
+-		mono_raise_exception (mono_get_exception_not_implemented ("LoadAssemblyRaw: 
+Raw Symbol Store not Implemented"));
+-  
+ 	if (!image) {
+ 		mono_raise_exception (mono_get_exception_bad_image_format (""));
+ 		return NULL;
+ 	}
+ 
++	if (raw_symbol_store != NULL)
++	{
++		mono_debug_init_2_memory (image, mono_array_addr (raw_symbol_store, guint8, 0), 
+mono_array_length (raw_symbol_store));	
++	}
++
+ 	ass = mono_assembly_load_from_full (image, "", &status, refonly);
+ 
++
+ 	if (!ass) {
+ 		mono_image_close (image);
+ 		mono_raise_exception (mono_get_exception_bad_image_format (""));
+diff -Naur --exclude .DS_Store --exclude '*.rej' mono/mono/metadata/debug-mono-symfile.c 
+mono-patch_unity/mono/metadata/debug-mono-symfile.c
+--- mono/mono/metadata/debug-mono-symfile.c	2006-03-13 23:57:48.000000000 +0100
++++ mono-patch_unity/mono/metadata/debug-mono-symfile.c
+	2006-04-29 20:12:57.000000000 +0200
+@@ -100,7 +100,7 @@
+ }
+ 
+ MonoSymbolFile *
+-mono_debug_open_mono_symbol_file (MonoDebugHandle *handle, gboolean in_the_debugger)
++mono_debug_open_mono_symbols (MonoDebugHandle *handle, const guint8 *raw_contents, 
+int size, gboolean in_the_debugger)
+ {
+ 	MonoSymbolFile *symfile;
+ 	FILE* f;
+@@ -108,9 +108,15 @@
+ 	mono_debugger_lock ();
+ 	symfile = g_new0 (MonoSymbolFile, 1);
+ 
+-	symfile->filename = g_strdup_printf ("%s.mdb", mono_image_get_filename (handle-
+>image));
+-
+-	if ((f = fopen (symfile->filename, "rb")) > 0) {
++	if (raw_contents != NULL)
++	{
++		symfile->raw_contents_size = size;
++		symfile->raw_contents = g_malloc (size);
++		memcpy(symfile->raw_contents, raw_contents, size);
++		symfile->filename = g_strdup_printf ("LoadedFromMemory");
++	}
++	else if ((f = fopen (symfile->filename, "rb")) > 0) {
++		symfile->filename = g_strdup_printf ("%s.mdb", mono_image_get_filename (handle-
+>image));
+ 		struct stat stat_buf;
+ 			
+ 		if (fstat (fileno (f), &stat_buf) < 0) {
+diff -Naur --exclude .DS_Store --exclude '*.rej' mono/mono/metadata/debug-mono-symfile.h 
+mono-patch_unity/mono/metadata/debug-mono-symfile.h
+--- mono/mono/metadata/debug-mono-symfile.h	2006-03-13 23:57:48.000000000 +0100
++++ mono-patch_unity/mono/metadata/debug-mono-symfile.h
+	2006-04-29 20:09:20.000000000 +0200
+@@ -132,8 +132,11 @@
+ G_BEGIN_DECLS
+ 
+ MonoSymbolFile *
+-mono_debug_open_mono_symbol_file   (MonoDebugHandle           *handle,
+-				    gboolean                   create_symfile);
++mono_debug_open_mono_symbols (MonoDebugHandle *	
+		handle,
++					const guint8 					
+			*raw_contents,
++					int 							
+			size,
++					gboolean						
+			in_the_debugger);
++
+ 
+ void
+ mono_debug_close_mono_symbol_file  (MonoSymbolFile           *symfile);
+diff -Naur --exclude .DS_Store --exclude '*.rej' mono/mono/metadata/mono-debug.c mono-
+patch_unity/mono/metadata/mono-debug.c
+--- mono/mono/metadata/mono-debug.c	2006-04-01 03:58:14.000000000 +0200
++++ mono-patch_unity/mono/metadata/mono-debug.c	2006-04-29 20:09:34.000000000 
++0200
+@@ -40,7 +40,8 @@
+ 
+ static GHashTable *method_hash = NULL;
+ 
+-static MonoDebugHandle     *mono_debug_open_image      (MonoImage *image);
++static MonoDebugHandle     *mono_debug_open_image      (MonoImage *image, const guint8 
+*raw_contents, int size);
++
+ static void                 mono_debug_close_image     (MonoDebugHandle *debug);
+ 
+ static MonoDebugHandle     *_mono_debug_get_image      (MonoImage *image);
+@@ -116,7 +117,7 @@
+ void
+ mono_debug_init_1 (MonoDomain *domain)
+ {
+-	MonoDebugHandle *handle = mono_debug_open_image (mono_get_corlib ());
++	MonoDebugHandle *handle = mono_debug_open_image (mono_get_corlib (), NULL, 0);
+ 
+ 	mono_symbol_table->corlib = handle;
+ }
+@@ -129,9 +130,21 @@
+ void
+ mono_debug_init_2 (MonoAssembly *assembly)
+ {
+-	mono_debug_open_image (mono_assembly_get_image (assembly));
++	mono_debug_open_image (mono_assembly_get_image (assembly), NULL, 0);
++}
++
++/*
++ * Initialize debugging support - part 2.
++ *
++ * This method must be called between loading the image and loading the assembly.
++ */
++void
++mono_debug_init_2_memory (MonoImage *image, const guint8 *raw_contents, int size)
++{
++	mono_debug_open_image (image, raw_contents, size);
+ }
+ 
++
+ gboolean
+ mono_debug_using_mono_debugger (void)
+ {
+@@ -175,7 +188,7 @@
+ }
+ 
+ static MonoDebugHandle *
+-mono_debug_open_image (MonoImage *image)
++mono_debug_open_image (MonoImage *image, const guint8 *raw_contents, int size)
+ {
+ 	MonoDebugHandle *handle;
+ 
+@@ -194,7 +207,7 @@
+ 
+ 	g_hash_table_insert (mono_debug_handles, image, handle);
+ 
+-	handle->symfile = mono_debug_open_mono_symbol_file (handle, in_the_mono_debugger);
++	handle->symfile = mono_debug_open_mono_symbols (handle, raw_contents, size, 
+in_the_mono_debugger);
+ 	if (in_the_mono_debugger)
+ 		mono_debugger_add_symbol_file (handle);
+ 
+@@ -217,7 +230,7 @@
+ mono_debug_add_assembly (MonoAssembly *assembly, gpointer user_data)
+ {
+ 	mono_debugger_lock ();
+-	mono_debug_open_image (mono_assembly_get_image (assembly));
++	mono_debug_open_image (mono_assembly_get_image (assembly), NULL, 0);
+ 	mono_debugger_unlock ();
+ }
+ 
+diff -Naur --exclude .DS_Store --exclude '*.rej' mono/mono/metadata/mono-debug.h mono-
+patch_unity/mono/metadata/mono-debug.h
+--- mono/mono/metadata/mono-debug.h	2006-03-13 23:57:48.000000000 +0100
++++ mono-patch_unity/mono/metadata/mono-debug.h	2006-04-29 20:09:39.000000000 
++0200
+@@ -187,6 +187,7 @@
+ void mono_debug_init (MonoDebugFormat format);
+ void mono_debug_init_1 (MonoDomain *domain);
+ void mono_debug_init_2 (MonoAssembly *assembly);
++void mono_debug_init_2_memory (MonoImage *image, const guint8 *raw_contents, int size);
+ void mono_debug_cleanup (void);
+ 
+ gboolean mono_debug_using_mono_debugger (void);


More information about the mono-bugs mailing list