+2002-03-23 Martin Baulig <martin@gnome.org>
+
+ * rawbuffer.c (mono_raw_buffer_load_mmap): Use MAP_SHARED when
+ is_writeable is set.
+ (mono_raw_buffer_update): New function to write the modified map
+ back to disk.
+
+ * debug-symfile.h (MonoDebugSymbolFile): Added `raw_contents_size'.
+
+ * debug-symfile.c (mono_debug_update_symbol_file): Call
+ mono_raw_buffer_update() when done writing.
+
2002-03-23 Martin Baulig <martin@gnome.org>
* debug-symfile.h (MONO_DEBUG_SYMBOL_FILE_VERSION): Increased to 5.
symfile->file_name = g_strdup (filename);
symfile->image = image;
symfile->raw_contents = ptr;
+ symfile->raw_contents_size = file_size;
if (!get_sections (symfile, emit_warnings)) {
mono_debug_close_symbol_file (symfile);
break;
}
}
+
+ mono_raw_buffer_update (symfile->raw_contents, symfile->raw_contents_size);
}
MonoImage *image;
/* Pointer to the mmap()ed contents of the file. */
void *raw_contents;
+ size_t raw_contents_size;
/* Array of MONO_DEBUG_SYMBOL_SECTION_MAX elements. */
MonoDebugSymbolFileSection *section_offsets;
gpointer user_data;
if (is_writable){
prot |= PROT_WRITE;
+ flags = MAP_SHARED;
+ } else {
+ flags = MAP_PRIVATE;
}
- flags = MAP_PRIVATE;
ptr = mmap (0, end - start, prot, flags, fd, start);
#endif
}
+static void
+mono_raw_buffer_update_mmap (void *base, size_t size)
+{
+#ifdef USE_WIN32_API
+ FlushViewOfFile (base, size);
+#else
+ msync (base, size, MS_SYNC);
+#endif
+}
+
void *
mono_raw_buffer_load (int fd, int is_writable, guint32 base, size_t size)
{
return ptr;
}
+void
+mono_raw_buffer_update (void *buffer, size_t size)
+{
+ char *mmap_base;
+
+ mmap_base = GINT_TO_POINTER (ROUND_DOWN (GPOINTER_TO_INT (buffer), alignment));
+
+ if (mmap_map && g_hash_table_lookup (mmap_map, mmap_base))
+ mono_raw_buffer_update_mmap (mmap_base, size);
+}
+
void
mono_raw_buffer_free (void *buffer)
{
void *mono_raw_buffer_load (int fd, int writable, guint32 base, size_t size);
+void mono_raw_buffer_update (void *buffer, size_t size);
void mono_raw_buffer_free (void *buffer);