[Mono-dev] fix load_modules() on OpenBSD
Zoltan Varga
vargaz at gmail.com
Sun Apr 4 15:32:49 EDT 2010
Done.
Zoltan
On Sun, Apr 4, 2010 at 9:03 PM, Robert Nagy <robert at openbsd.org> wrote:
> Hi
>
> Zoltan, can you please commit the following fix because I've fucked the
> start and end addresses up. It also adds a debug printf.
>
> Thanks
>
> Index: io-layer/processes.c
> ===================================================================
> --- io-layer/processes.c (revision 154762)
> +++ io-layer/processes.c (working copy)
> @@ -1901,7 +1901,6 @@
> #include <link.h>
> static int load_modules_callback (struct dl_phdr_info *info, size_t size,
> void *ptr)
> {
> -
> if (size < offsetof (struct dl_phdr_info, dlpi_phnum)
> + sizeof (info->dlpi_phnum))
> return (-1);
> @@ -1928,21 +1927,22 @@
> return (ret);
>
> for (i = 0; i < dlarray->len; i++) {
> - int j;
> - char *end = NULL;
> -
> struct dl_phdr_info *info = g_ptr_array_index (dlarray, i);
> - for (j = 0; j < info->dlpi_phnum; j++)
> - end = (char *)(info->dlpi_addr +
> info->dlpi_phdr[j].p_vaddr);
>
> mod = g_new0 (WapiProcModule, 1);
> - mod->address_start = GINT_TO_POINTER(info->dlpi_addr);
> - mod->address_end = end;
> + mod->address_start = (gpointer)(info->dlpi_addr +
> info->dlpi_phdr[0].p_vaddr);
> + mod->address_end = (gpointer)(info->dlpi_addr +
> + info->dlpi_phdr[info->dlpi_phnum -
> 1].p_vaddr);
> mod->perms = g_strdup ("r--p");
> mod->address_offset = 0;
> mod->inode = (ino_t) i;
> mod->filename = g_strdup (info->dlpi_name);
>
> +#ifdef DEBUG
> + g_message ("%s: inode=%d, filename=%s, address_start=%p,
> address_end=%p", __func__,
> + mod->inode, mod->filename, mod->address_start,
> mod->address_end);
> +#endif
> +
> free(info);
>
> if (g_slist_find_custom (ret, mod, find_procmodule) == NULL)
> {
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.ximian.com/pipermail/mono-devel-list/attachments/20100404/e05c0140/attachment-0001.html
More information about the Mono-devel-list
mailing list