OpenCores
URL https://opencores.org/ocsvn/or1k/or1k/trunk

Subversion Repositories or1k

[/] [or1k/] [branches/] [stable_0_1_x/] [or1ksim/] [support/] [simprintf.c] - Diff between revs 1319 and 1350

Go to most recent revision | Show entire file | Details | Blame | View Log

Rev 1319 Rev 1350
Line 26... Line 26...
#include <string.h>
#include <string.h>
#include <errno.h>
#include <errno.h>
#include <stdarg.h>
#include <stdarg.h>
#include <stdlib.h>
#include <stdlib.h>
 
 
#include "abstract.h"
#include "config.h"
 
 
 
#ifdef HAVE_INTTYPES_H
 
#include <inttypes.h>
 
#endif
 
 
 
#include "port.h"
#include "arch.h"
#include "arch.h"
 
#include "abstract.h"
#include "sim-config.h"
#include "sim-config.h"
#include "debug.h"
#include "debug.h"
 
 
/* Length of PRINTF format string */
/* Length of PRINTF format string */
#define FMTLEN 2000
#define FMTLEN 2000
 
 
char fmtstr[FMTLEN];
char fmtstr[FMTLEN];
 
 
char *simgetstr(unsigned long stackaddr, unsigned long regparam)
char *simgetstr(oraddr_t stackaddr, unsigned long regparam)
{
{
  unsigned long fmtaddr;
  oraddr_t fmtaddr;
  int i;
  int i;
  int breakpoint = 0;
  int breakpoint = 0;
 
 
  fmtaddr = regparam;
  fmtaddr = regparam;
 
 
Line 56... Line 63...
  fmtstr[i] = '\0';
  fmtstr[i] = '\0';
 
 
  return fmtstr;
  return fmtstr;
}
}
 
 
void simprintf(unsigned long stackaddr, unsigned long regparam)
void simprintf(oraddr_t stackaddr, unsigned long regparam)
{
{
  FILE *f;
  FILE *f;
  int breakpoint = 0;
  int breakpoint = 0;
 
 
  simgetstr(stackaddr, regparam);
  simgetstr(stackaddr, regparam);
 
 
  debug(6, "simprintf: stackaddr: 0x%.8lx\n", stackaddr);
  debug(6, "simprintf: stackaddr: 0x%"PRIxADDR"\n", stackaddr);
  if ((f = fopen(config.sim.fstdout, "a+"))) {
  if ((f = fopen(config.sim.fstdout, "a+"))) {
    unsigned long arg;
    uint32_t arg;
    unsigned long argaddr;
    oraddr_t argaddr;
    char *fmtstrend;
    char *fmtstrend;
    char *fmtstrpart = fmtstr;
    char *fmtstrpart = fmtstr;
    int tee_exe_log;
    int tee_exe_log;
 
 
#if STACK_ARGS
#if STACK_ARGS
Line 97... Line 104...
        argaddr += 4;
        argaddr += 4;
#else
#else
        {
        {
          unsigned char regstr[5];
          unsigned char regstr[5];
 
 
          sprintf(regstr, "r%u", ++argaddr);
          sprintf(regstr, "r%"PRIxADDR, ++argaddr);
          arg = evalsim_reg32(atoi(regstr));
          arg = evalsim_reg(atoi(regstr));
        }
        }
#endif
#endif
        debug(6, " 4: fmtstrpart=%p fmtstrpart=%s arg=%p\n", fmtstrpart, fmtstrpart, arg);
        debug(6, " 4: fmtstrpart=%p fmtstrpart=%s arg=%p\n", fmtstrpart, fmtstrpart, arg);
        tmp = fmtstrpart;
        tmp = fmtstrpart;
        if (*tmp == '%') {
        if (*tmp == '%') {

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.