15473Slinton /* Copyright (c) 1982 Regents of the University of California */
25473Slinton 
3*6071Slinton static char sccsid[] = "@(#)remake.c 1.2 03/08/82";
45473Slinton 
55473Slinton /*
65473Slinton  * Remake the object file from the source.
75473Slinton  */
85473Slinton 
95473Slinton #include "defs.h"
105473Slinton #include "command.h"
115473Slinton #include "object.h"
125473Slinton 
135473Slinton /*
145473Slinton  * Invoke "pi" on the dotpfile, then reread the symbol table information.
155473Slinton  *
165473Slinton  * We have to save tracing info before, and read it in after, because
175473Slinton  * it might contain symbol table pointers.
18*6071Slinton  *
19*6071Slinton  * We also have to restart the process so that px dependent information
20*6071Slinton  * is recomputed.
215473Slinton  */
225473Slinton 
235473Slinton remake()
245473Slinton {
25*6071Slinton     char *tmpfile;
265473Slinton 
27*6071Slinton     if (call("pi", stdin, stdout, dotpfile, NIL) == 0) {
28*6071Slinton 	if (strcmp(objname, "obj") != 0) {
29*6071Slinton 	    call("mv", stdin, stdout, "obj", objname, NIL);
305473Slinton 	}
31*6071Slinton 	tmpfile = mktemp("/tmp/pdxXXXX");
32*6071Slinton 	setout(tmpfile);
33*6071Slinton 	status();
34*6071Slinton 	unsetout();
35*6071Slinton 	bpfree();
36*6071Slinton 	objfree();
37*6071Slinton 	initstart();
38*6071Slinton 	readobj(objname);
39*6071Slinton 	setinput(tmpfile);
40*6071Slinton 	unlink(tmpfile);
41*6071Slinton     } else {
42*6071Slinton 	puts("pi unsuccessful");
43*6071Slinton     }
445473Slinton }
45