[Message Prev][Message Next][Thread Prev][Thread Next][Message Index][Thread Index]
[MD:2823]Portable dumper
- X-ml-count: 2823
- Subject: [MD:2823]Portable dumper
- From: Yoshiki Hayashi <yoshiki@xxxxxxxxxx>
- Date: 17 Jan 2002 20:00:21 +0900
- User-agent: T-gnus/6.15.3 (based on Oort Gnus v0.03) (revision 06)
Yoshiki Hayashi <yoshiki@xxxxxxxxxx> writes:
> と書いていて、いろいろ試していると、Desktop の方 (ちょっと古
> い Debian unstable) で再現するようなので、調べてみます。
pdump_relocate_objects に bug があって、mmap の返り値によっ
て動いたり動かなかったりすることが判明しました。
永野君の buffer local があやしいかも、というのはあたりで、
relocate を忘れているのがありました。後、PDUMP_OFFSET を 0
や 12288 にして MAP_FIXED でむりやりその場所に mmap した場合
に正しく動かない、という現象があるので、後で debug します。
おそらく、gdb で mmap の返り値をみて、それを PDUMP_OFFSET に
設定して compile しなおすと relocate しなくなるので他の人の
ところでも動くと思います。
今日はこれで帰るので、local とさっきまでの差分を付けておきま
す。
# 素の Emacs との差分はまた明日くらいに web にでも置きます。
## やはり memory を直接いじる program は大変だ。(;_;)
Index: src/alloc.c
===================================================================
--- src/alloc.c
+++ tmp.57208.00001 Thu Jan 17 19:51:31 2002
@@ -3043,6 +3043,10 @@
Qnil)))))));
}
+#include <stdio.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <fcntl.h>
#include <sys/file.h>
#include <sys/mman.h>
#include <assert.h>
@@ -3051,7 +3055,7 @@
typedef struct pdump_forward_t
{
Lisp_Object obj; /* object itself */
- long offset; /* Offset from the start of dumped file */
+ unsigned long offset; /* Offset from the start of dumped file */
long size; /* size of object */
} pdump_forward_t;
@@ -3234,7 +3238,6 @@
{
struct Lisp_Vector *ptr = XVECTOR (obj);
EMACS_INT size = ptr->size;
- int i;
if (size & PSEUDOVECTOR_FLAG)
size &= PSEUDOVECTOR_SIZE_MASK;
pdump_register_object (obj, (sizeof (struct Lisp_Vector)
@@ -3389,7 +3392,7 @@
{
pdump_forward_t *f;
Lisp_Object new_obj;
- Lisp_Object addr;
+ unsigned long addr;
int i;
enum pdump_object_type type;
@@ -3402,6 +3405,7 @@
for (i = 0; i < type; i++)
addr += pdump_lisp_object[i].size;
XSET (new_obj, XTYPE (obj), addr);
+ assert (XPNTR (new_obj) == addr);
return new_obj;
}
@@ -3723,7 +3727,7 @@
*staticvec[staticidx] = root.val;
}
if (offset != 0)
- pdump_relocate_objects (ret - pdump_header.offset);
+ pdump_relocate_objects (offset);
read (fd, &staticpidx, sizeof (staticpidx));
read (fd, &staticpvec, sizeof (staticpvec[0]) * staticpidx);
for (i = 0; i < pdump_header.pointers_length; i++)
@@ -3953,6 +3957,8 @@
case Lisp_Misc_Some_Buffer_Local_Value:
{
struct Lisp_Buffer_Local_Value *ptr = (struct Lisp_Buffer_Local_Value *)obj_ptr;
+ PDUMP_RELOCATE (ptr->buffer, offset);
+ PDUMP_RELOCATE (ptr->frame, offset);
PDUMP_RELOCATE (ptr->realvalue, offset);
PDUMP_RELOCATE (ptr->cdr, offset);
obj_ptr += sizeof (struct Lisp_Buffer_Local_Value);
@@ -4022,10 +4028,7 @@
obj_ptr += sizeof (struct Lisp_Symbol);
}
for (i = 0; i < pdump_header.float_length; i++)
- {
- struct Lisp_Float *ptr = (struct Lisp_Float *)obj_ptr;
- obj_ptr += sizeof (struct Lisp_Float);
- }
+ obj_ptr += sizeof (struct Lisp_Float);
for (i = 0; i < pdump_header.vector_length; i++)
{
if ((((struct Lisp_Vector *)obj_ptr)->size
@@ -4034,7 +4037,6 @@
{
struct Lisp_Vector *ptr = (struct Lisp_Vector *) obj_ptr;
EMACS_INT size = ptr->size;
- int i;
if (size & PSEUDOVECTOR_FLAG)
size &= PSEUDOVECTOR_SIZE_MASK;
obj_ptr += (sizeof (struct Lisp_Vector)
--
Yoshiki Hayashi