Hi Dave, On Sat, Oct 1, 2011 at 2:18 AM, Dave Anderson <anderson@xxxxxxxxxx> wrote: > > > ----- Original Message ----- >> >> >> ----- Original Message ----- >> > Hi, >> > >> > I recent make a patch which give the rd command to dump the raw data. With this, >> > we could then do the dump the specified range of memory to the file with console's >> > redirection feature like: rd -r 0x7000000 -e 0x8000000 > dump.img. >> > >> > What about this idea? Could it be accepted? >> > >> > Thanks, >> > Lei >> >> I think it's a pretty good idea. >> >> However, one problem with the patch is that if you forget to append >> the "> dump.img" part, it would end up spewing non-ASCII data to >> the terminal. I would suggest using a construct like "-r dump.img", >> which would force the user to supply a filename argument with >> the -r. Good idea, I would send another patch to include this. >> >> Also, maybe you could write a more efficient output function that >> ignores the "typesz", and fwrite()'s larger fixed-size blocks of >> data until it reaches the end of the desired memory chunk. Em... the typesz, may cannot be ignored... Since the count has been divided by display type before passing to display_memory(). > > Just to clarify -- don't put the output loop in the main "for" > loop at the bottom of display_memory(), put it up near the > beginning: > > static void > display_memory(ulonglong addr, long count, ulong flag, int memtype) > { > ... > > if (CRASHDEBUG(4)) > fprintf(fp, "<addr: %llx count: %ld flag: %lx (%s)>\n", > addr, count, flag, addrtype); > > + if (flag & DISPLAY_RAW) { > + < your output loop here> > + return; > + } > I tend to put it a little furthur, after the typesz has been calculated out. How about this? Thanks, Lei -- Crash-utility mailing list Crash-utility@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/crash-utility