Hello,
here comes a patch that corrects an error in user.c and speeds
up memory dumping so that's really usable now. And the dump file
is beautifyed a little bit.
jens
P.S. I didn't say it yet, but it's a good idea to have a chief cvs man ;)
-----------------------
--- user.c Wed Jan 12 11:49:08 2000
+++ user_new.c Wed Jan 12 11:45:30 2000
@@ -583,47 +583,53 @@
/* the VM has been aborted; if requested, perform a memory dump */
- if (dump)
- {
- int dumpno, counter, tmp;
- char outbuf;
+ if(dump) {
+ int dumpno, counter, tmp, tmp2, j, diff;
+ unsigned char outbuf[330];
- counter = 0;
- fprintf (stderr, "Dumping memory to %s\n", dump_file_name);
- dumpno = open (dump_file_name, O_CREAT | O_RDWR, S_IRUSR | S_IWUSR);
- for (i = 0; i < max_memory * 1024 * 1024; i++)
- {
- tmp = ((char *) ptr)[i] >> 4;
- if (tmp > 9)
- tmp += (int) 'A';
- else
- tmp += (int) '0';
- outbuf = (char) tmp;
- write (dumpno, &outbuf, 1);
- tmp = ((char *) ptr)[i] & 0x0f;
- if (tmp > 9)
- tmp += (int) 'A';
- else
- tmp += (int) '0';
- outbuf = (char) tmp;
- write (dumpno, &outbuf, 1);
+ counter = 0;
+ fprintf(stderr,"Dumping memory to %s\n",dump_file_name);
+ dumpno = open(dump_file_name, O_CREAT|O_RDWR,S_IRUSR|S_IWUSR);
+ diff = (int)'a' - 10 - (int)'0';
+ for(i=0;i<max_memory*1024*1024;i++) {
- counter++;
- if (!(counter % 4))
- {
- outbuf = ' ';
- write (dumpno, &outbuf, 1);
- }
- if (!(counter % 16))
- {
- outbuf = '\n';
- write (dumpno, &outbuf, 1);
- }
+ if(!(i%32)) {
+ for(j=20;j>=0;j-=4) {
+ tmp = (i >> j) & 0x0f;
+ tmp+=(int)'0';
+ if(tmp > '9')
+ tmp+=diff;
+ outbuf[counter++]=(unsigned char)tmp;
+ }
+ outbuf[counter++]=':';
+ outbuf[counter++]=' ';
}
- close (dumpno);
- }
+ tmp = ((unsigned char *)ptr)[i];
+ tmp2 = tmp >> 4;
+ tmp &= 0x0f;
+ tmp2+=(int)'0';
+ if(tmp2 > '9')
+ tmp2+=diff;
+ outbuf[counter++]=(unsigned char)tmp2;
+ tmp+=(int)'0';
+ if(tmp > '9')
+ tmp+=diff;
+ outbuf[counter++]=(unsigned char)tmp;
+ if(!((i+1)%4)) {
+ outbuf[counter++]=' ';
+ }
+ if(!((i+1)%32)) {
+ outbuf[counter++]='\n';
+ }
+ if(!((i+1)%128)) {
+ write(dumpno,&outbuf,324);
+ counter = 0;
+ }
+ }
+ close(dumpno);
+ }
/* deinitialize all plugins */