コード例 #1
0
/* open pipeline trace */
void ptrace_open(char *fname, /* output filename */
char *range) /* trace range */
{
	char *errstr;

	/* parse the output range */
	if (!range) {
		/* no range */
		errstr = range_parse_range(":", &ptrace_range);
		if (errstr)
			panic("cannot parse pipetrace range, use: {<start>}:{<end>}");
		ptrace_active = TRUE;
	} else {
		errstr = range_parse_range(range, &ptrace_range);
		if (errstr)
			fatal("cannot parse pipetrace range, use: {<start>}:{<end>}");
		ptrace_active = FALSE;
	}

	if (ptrace_range.start.ptype != ptrace_range.end.ptype)
		fatal("range endpoints are not of the same type");

	/* open output trace file */
	if (!fname || !strcmp(fname, "-") || !strcmp(fname, "stderr"))
		ptrace_outfd = stderr;
	else if (!strcmp(fname, "stdout"))
		ptrace_outfd = stdout;
	else {
		ptrace_outfd = fopen(fname, "w");
		if (!ptrace_outfd)
			fatal("cannot open pipetrace output file `%s'", fname);
	}
}
コード例 #2
0
ファイル: sim-eio.c プロジェクト: palmerc/lab
/* load program into simulated state */
void
sim_load_prog(char *fname,		/* program to load */
	      int argc, char **argv,	/* program arguments */
	      char **envp)		/* program environment */
{
  /* load program text and data, set up environment, memory, and regs */
  ld_load_prog(fname, argc, argv, envp, &regs, mem, TRUE);

  if (chkpt_nelt == 2)
    {
      char *errstr;

      /* generate a checkpoint */
      if (!sim_eio_fd)
	fatal("checkpoints can only be generated while running an EIO trace");

#if 0 /* this should work fine... */
      if (trace_fname != NULL)
	fatal("checkpoints cannot be generated with generating an EIO trace");
#endif

      /* parse the range */
      errstr = range_parse_range(chkpt_opts[1], &chkpt_range);
      if (errstr)
	fatal("cannot parse pipetrace range, use: {<start>}:{<end>}");

      /* create the checkpoint file */
      chkpt_fname = chkpt_opts[0];
      chkpt_fd = eio_create(chkpt_fname);

      /* indicate checkpointing is now active... */
      chkpt_active = TRUE;
    }

  if (trace_fname != NULL)
    {
      fprintf(stderr, "sim: tracing execution to EIO file `%s'...\n",
	      trace_fname);

      /* create an EIO trace file */
      trace_fd = eio_create(trace_fname);
    }

  /* initialize the DLite debugger */
  dlite_init(md_reg_obj, dlite_mem_obj, dlite_mstate_obj);
}
コード例 #3
0
/* load program into simulated state */
void
sim_load_prog(char *fname,		/* program to load */
	      int argc, char **argv,	/* program arguments */
	      char **envp)		/* program environment */
{
  /* load program text and data, set up environment, memory, and regs */
  ld_load_prog(fname, argc, argv, envp, &regs, mem, TRUE);

  if (chkpt_nelt == 2)
    {
      char *errstr;

      /* generate a checkpoint */
      if (!sim_eio_fd)
	fatal("checkpoints can only be generated while running an EIO trace");

      /* can't do regular & periodic chkpts at the same time */
      if (per_chkpt_nelt != 0)
	fatal("can't do both regular and periodic checkpoints");

#if 0 /* this should work fine... */
      if (trace_fname != NULL)
	fatal("checkpoints cannot be generated with generating an EIO trace");
#endif

      /* parse the range */
      errstr = range_parse_range(chkpt_opts[1], &chkpt_range);
      if (errstr)
	fatal("cannot parse pipetrace range, use: {<start>}:{<end>}");

      /* create the checkpoint file */
      chkpt_fname = chkpt_opts[0];
      chkpt_fd = eio_create(chkpt_fname);

      /* indicate checkpointing is now active... */
      chkpt_kind = one_shot_chkpt;
    }

  if (per_chkpt_nelt == 2)
    {
      chkpt_fname = per_chkpt_opts[0];
      if (strchr(chkpt_fname, '%') == NULL)
	fatal("periodic checkpoint filename must be printf-style format");

      if (sscanf(per_chkpt_opts[1], "%Ld", &per_chkpt_interval) != 1)
	fatal("can't parse periodic checkpoint interval '%s'",
	      per_chkpt_opts[1]);

      /* indicate checkpointing is now active... */
      chkpt_kind = periodic_chkpt;
      chkpt_num = 1;
      next_chkpt_cycle = per_chkpt_interval;
    }

  if (trace_fname != NULL)
    {
      fprintf(stderr, "sim: tracing execution to EIO file `%s'...\n",
	      trace_fname);

      /* create an EIO trace file */
      trace_fd = eio_create(trace_fname);
    }

  /* initialize the DLite debugger */
  dlite_init(md_reg_obj, dlite_mem_obj, dlite_mstate_obj);
}