Path: utzoo!attcan!uunet!husc6!uwvax!umn-d-ub!gandreas From: gandreas@umn-d-ub.D.UMN.EDU (Glenn Andreas) Newsgroups: comp.sys.mac.programmer Subject: Re: Core Dump Message-ID: <461@umn-d-ub.D.UMN.EDU> Date: 16 Aug 88 16:02:25 GMT References: <136@lloyd.camex.uucp> Reply-To: gandreas@ub.d.umn.edu.UUCP (Glenn Andreas) Organization: University of Minnesota, Duluth Lines: 94 In article <136@lloyd.camex.uucp> kent@lloyd.camex.uucp (Kent Borg) writes: >Is there a way from Macsbug to do a "core dump" to disk? Recently when >pasteing some text into uw, my Macintosh Plus crashed. Using Macsbug I >managed to find (3 copies of) my text and copy 3 pages by hand. I would >gladly been willing to type in quite a few lines of opcodes if it ment I >could have used a text editor to find my text, and not have had to write >it out be hand. I have yet to type it back in. Well, there sort of is a way. Kindof. But it's not very easy. And off hand I don't remember the exact details, but here is the general procedure. First, figure out where the information you want is in the memory and how big it is. Now lower the low memory variable 'BufPtr' by the size of the data. Also set A7 (SP) (and maybe A6 for the hell of it) to that new BufPtr value. This reserves memory above the (new) stack for you to move your data. Now load A0 with the address of your data, A1 with the value of BufPtr, and D0 with the size of the data. (You can double check this by looking up BlockMove in IM). Find a free place in memory (i.e. a free block as shown by MacsBug, so you don't frag the heap too bad) and code in the traps for BlockMove followed by ExitToShell. Set the PC to this and "g". This will copy your data above the stack and exit back to the finder. Now you need a program that will copy things from any location in memory to a disk file. Off hand, I can't think of any program that would do this, but something in Pascal would look somewhat like this: PROGRAM CoreDump(input,output); USES MemTypes,QuickDraw,OSIntf,ToolIntf,PackIntf; VAR f,e:INTEGER; fromAddr,size:LongInt; FUNCTION MemToDisk(fromAddr,size:LongInt; toFile:INTEGER): INTEGER; { returns error code from write } BEGIN MemToDisk:=FSWrite(toFile,Pointer(fromAddr),size); END; BEGIN f:= Your favorite funtion that uses GetStdFile to open a file and return its file number; Writeln('What is the address of the data '); Readln(fromAddr); Writeln('What is the size of the data '); Readln(size); IF MemToDisk(fromAddr,size,f) <> NoErr THEN Writeln('There was an error in saving...') ELSE Writeln('Saved ok.'); END. { NOTE: I do not condone using vanilla i/o for real program, but this is a small program to quickly try to fix the problem. You can add Dialogs as appropriate } After saving the file (and perhaps checking it quickly), RESTART! I do not guarentee that this will always work, since sometimes the crash that brought this about in the first place will be so severe (especially if the heap is badly mangled/low memory is wiped) that you will not be able to exit to the shell. Chances are, however, if you can, you should be able to recover the data with this. This will not likely work under MultiFinder either, and trying to do this will probably make things worse. Good luck. (Gee, maybe I should write an INIT that patches SysError and dumps the current heap zone to disk? What a can of worms this could be! (Especially if you have lots of memory and are running on floppies!)). >Also, in searching through my megabyte I found several ASCII references to >Mishawana and Mishawana Bold (I think I have the name right). Sounds like >a font name. I've never installed it, I have never seen it an any font >menu, I've never heard of it. What is it? If I remember correctly, it is the font that is used automatically by uw in its windows. You should be able to open uw up with Font/DA Mover (holding down the option key when you select open) and you should see the font there. You don't have to install, nor will you see it on any font menu, since it resides only in uw, and not the system. > >Kent Borg >kent@lloyd.uucp >or >hscfvax!lloyd!kent =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-= = "When I was young, all I wanted was to be | - gandreas@ub.d.umn.edu - = = ruler of the universe. Now that isn't | Glenn Andreas = = enough" - Alex P. Keaton | = =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=