148102Sbostic /*-
2*62130Sbostic * Copyright (c) 1982, 1993
3*62130Sbostic * The Regents of the University of California. All rights reserved.
448102Sbostic *
548102Sbostic * %sccs.include.redist.c%
622761Smckusick */
75473Slinton
822761Smckusick #ifndef lint
9*62130Sbostic static char sccsid[] = "@(#)remake.c 8.1 (Berkeley) 06/06/93";
1048102Sbostic #endif /* not lint */
115473Slinton
125473Slinton /*
135473Slinton * Remake the object file from the source.
145473Slinton */
155473Slinton
165473Slinton #include "defs.h"
175473Slinton #include "command.h"
185473Slinton #include "object.h"
195473Slinton
205473Slinton /*
215473Slinton * Invoke "pi" on the dotpfile, then reread the symbol table information.
225473Slinton *
235473Slinton * We have to save tracing info before, and read it in after, because
245473Slinton * it might contain symbol table pointers.
256071Slinton *
266071Slinton * We also have to restart the process so that px dependent information
276071Slinton * is recomputed.
285473Slinton */
295473Slinton
remake()305473Slinton remake()
315473Slinton {
326071Slinton char *tmpfile;
335473Slinton
346071Slinton if (call("pi", stdin, stdout, dotpfile, NIL) == 0) {
356071Slinton if (strcmp(objname, "obj") != 0) {
366071Slinton call("mv", stdin, stdout, "obj", objname, NIL);
375473Slinton }
3847033Sdonn tmpfile = mktemp(strdup("/tmp/pdxXXXX"));
396071Slinton setout(tmpfile);
406071Slinton status();
416071Slinton unsetout();
426071Slinton bpfree();
436071Slinton objfree();
446071Slinton initstart();
456071Slinton readobj(objname);
466071Slinton setinput(tmpfile);
476071Slinton unlink(tmpfile);
486071Slinton } else {
496071Slinton puts("pi unsuccessful");
506071Slinton }
515473Slinton }
52