Esempio n. 1
0
void do_page_fault(struct pt_regs *regs, unsigned long error_code)
{
    unsigned long addr = read_cr2();
    struct sched_shutdown sched_shutdown = { .reason = SHUTDOWN_crash };

    if ((error_code & TRAP_PF_WRITE) && handle_cow(addr))
	return;

    /* If we are already handling a page fault, and got another one
       that means we faulted in pagetable walk. Continuing here would cause
       a recursive fault */       
    if(handling_pg_fault == 1) 
    {
        printk("Page fault in pagetable walk (access to invalid memory?).\n"); 
        HYPERVISOR_sched_op(SCHEDOP_shutdown, &sched_shutdown);
    }
    handling_pg_fault++;
    barrier();

    printk("Page fault at linear address %p, rip %p, regs %p, sp %p, our_sp %p, code %lx\n",
           addr, regs->rip, regs, regs->rsp, &addr, error_code);

    dump_regs(regs);
    //do_stack_walk(regs->rbp);
    dump_mem(regs->rsp);
    dump_mem(regs->rbp);
    dump_mem(regs->rip);
    page_walk(addr);
    HYPERVISOR_sched_op(SCHEDOP_shutdown, &sched_shutdown);
    /* We should never get here ... but still */
    handling_pg_fault--;
}
Esempio n. 2
0
static int __die(const char *str, int err, struct thread_info *thread,
		 struct pt_regs *regs)
{
	unsigned long sp, stack;
	struct task_struct *tsk = thread->task;
	static int die_counter;
	int ret;

	pr_emerg("Internal error: %s: %x [#%d]" S_PREEMPT S_SMP "\n",
		 str, err, ++die_counter);

	/* trap and error numbers are mostly meaningless on ARM */
	ret = notify_die(DIE_OOPS, str, regs, err, 0, SIGSEGV);
	if (ret == NOTIFY_STOP)
		return ret;

	print_modules();
	__show_regs(regs);
	pr_emerg("Process %.*s (pid: %d, stack limit = 0x%p)\n",
		 TASK_COMM_LEN, tsk->comm, task_pid_nr(tsk), thread + 1);

	if (!user_mode(regs) || in_interrupt()) {
		sp = regs->sp;
		stack = (unsigned long)task_stack_page(tsk);
		dump_mem(KERN_EMERG, "Stack: ", sp, ALIGN(sp, THREAD_SIZE));
		if (sp < stack || (sp - stack) > THREAD_SIZE) {
			printk(KERN_EMERG "Invalid sp[%lx] or stack address[%lx]\n", sp, stack);
			dump_mem(KERN_EMERG, "Stack(backup) ", stack, THREAD_SIZE + stack);
		}
		dump_backtrace(regs, tsk);
		dump_instr(KERN_EMERG, regs);
	}

	return ret;
}
Esempio n. 3
0
void test_cts(int bench, void cts_interp(), int iterations)
{
  int start_time, end_time;
  int i;

  /* normal */
  printf("[Tempo CTS]\n");

  init_state();			   /* initialize memory */
  if (bench == TEST) {

    dump_mem();		           /* verify memory contents */
    cts_interp();
    dump_mem();

  } else {

    start_time = unix_time();
    for( i = 0; i < iterations; i++)
      cts_interp();
    end_time = unix_time();
    print_time(start_time, end_time, 1);
    
  }
  printf("\n"); 
}
Esempio n. 4
0
static int
gdbsim_xfer_inferior_memory (CORE_ADDR memaddr, char *myaddr, int len,
			     int write, struct mem_attrib *attrib,
			     struct target_ops *target)
{
  if (!program_loaded)
    error ("No program loaded.");

  if (sr_get_debug ())
    {
      /* FIXME: Send to something other than STDOUT? */
      printf_filtered ("gdbsim_xfer_inferior_memory: myaddr 0x");
      gdb_print_host_address (myaddr, gdb_stdout);
      printf_filtered (", memaddr 0x%s, len %d, write %d\n",
		       paddr_nz (memaddr), len, write);
      if (sr_get_debug () && write)
	dump_mem (myaddr, len);
    }

  if (write)
    {
      len = sim_write (gdbsim_desc, memaddr, myaddr, len);
    }
  else
    {
      len = sim_read (gdbsim_desc, memaddr, myaddr, len);
      if (sr_get_debug () && len > 0)
	dump_mem (myaddr, len);
    }
  return len;
}
Esempio n. 5
0
int main(int argc, char *argv[], char *env[])
{
	__start___ex_table = (struct exception_table_entry *)array;
	__stop___ex_table = __start___ex_table + ARRAY_SIZE(array)/2;
	//printf("%d\n", __stop___ex_table - __start___ex_table);
	dump_mem(__start___ex_table, (unsigned long)__stop___ex_table - (unsigned long)__start___ex_table);
	sort(__start___ex_table, __stop___ex_table - __start___ex_table, sizeof(struct exception_table_entry), cmp_ex, NULL);
	dump_mem(__start___ex_table, (unsigned long)__stop___ex_table - (unsigned long)__start___ex_table);
	return 0;
}
Esempio n. 6
0
void do_general_protection(struct pt_regs *regs, long error_code)
{
    struct sched_shutdown sched_shutdown = { .reason = SHUTDOWN_crash };
    printk("GPF rip: %p, error_code=%lx\n", regs->rip, error_code);
    dump_regs(regs);
    //do_stack_walk(regs->rbp);
    dump_mem(regs->rsp);
    dump_mem(regs->rbp);
    dump_mem(regs->rip);
    HYPERVISOR_sched_op(SCHEDOP_shutdown, &sched_shutdown);
}
static int show_process_stack_all (void)
{
	struct task_struct *p;
	unsigned int cur_sp;

	for_each_task(p) {
		cur_sp = ((unsigned int *)p)[792/4];			/* why 792:please reference the disassemble code of __switch_to */
		printk ("pid:%d(%s) sp=0x%08x\n", p->pid, p->comm, cur_sp);
		dump_mem ("Stack: ", cur_sp, 8192 + (unsigned long) p); /* current sp upwards to origin of stack */
		dump_mem ("Below stack: ", (unsigned long) p, cur_sp);	/* base of tsk upwards to current sp */
	}
	return 0;
}
Esempio n. 8
0
int main(void)
{
	
	int v1 = 64 + 16;
	int v2 = -v1;
	double v3 = 0.5;
	double v4  = 0.1;
	dump_mem((Octet*)&v1, sizeof(v1));		// !!!!!!!!!!!!!!!!!!!
	dump_mem((Octet*)&v2, sizeof(v2));
	dump_mem((Octet*)&v3, sizeof(v3));
	dump_mem((Octet*)&v4, sizeof(v4));

	return 0;
}
Esempio n. 9
0
/**
 * gst_rtsp_message_dump:
 * @msg: a #GstRTSPMessage
 *
 * Dump the contents of @msg to stdout.
 *
 * Returns: #GST_RTSP_OK.
 */
GstRTSPResult
gst_rtsp_message_dump (GstRTSPMessage * msg)
{
  guint8 *data;
  guint size;

  g_return_val_if_fail (msg != NULL, GST_RTSP_EINVAL);

  switch (msg->type) {
    case GST_RTSP_MESSAGE_REQUEST:
      g_print ("RTSP request message %p\n", msg);
      g_print (" request line:\n");
      g_print ("   method: '%s'\n",
          gst_rtsp_method_as_text (msg->type_data.request.method));
      g_print ("   uri:    '%s'\n", msg->type_data.request.uri);
      g_print ("   version: '%s'\n",
          gst_rtsp_version_as_text (msg->type_data.request.version));
      g_print (" headers:\n");
      key_value_foreach (msg->hdr_fields, dump_key_value, NULL);
      g_print (" body:\n");
      gst_rtsp_message_get_body (msg, &data, &size);
      dump_mem (data, size);
      break;
    case GST_RTSP_MESSAGE_RESPONSE:
      g_print ("RTSP response message %p\n", msg);
      g_print (" status line:\n");
      g_print ("   code:   '%d'\n", msg->type_data.response.code);
      g_print ("   reason: '%s'\n", msg->type_data.response.reason);
      g_print ("   version: '%s'\n",
          gst_rtsp_version_as_text (msg->type_data.response.version));
      g_print (" headers:\n");
      key_value_foreach (msg->hdr_fields, dump_key_value, NULL);
      gst_rtsp_message_get_body (msg, &data, &size);
      g_print (" body: length %d\n", size);
      dump_mem (data, size);
      break;
    case GST_RTSP_MESSAGE_DATA:
      g_print ("RTSP data message %p\n", msg);
      g_print (" channel: '%d'\n", msg->type_data.data.channel);
      g_print (" size:    '%d'\n", msg->body_size);
      gst_rtsp_message_get_body (msg, &data, &size);
      dump_mem (data, size);
      break;
    default:
      g_print ("unsupported message type %d\n", msg->type);
      return GST_RTSP_EINVAL;
  }
  return GST_RTSP_OK;
}
Esempio n. 10
0
static void
gdbsim_store_register (struct target_ops *ops,
		       struct regcache *regcache, int regno)
{
  struct gdbarch *gdbarch = get_regcache_arch (regcache);
  if (regno == -1)
    {
      for (regno = 0; regno < gdbarch_num_regs (gdbarch); regno++)
	gdbsim_store_register (ops, regcache, regno);
      return;
    }
  else if (gdbarch_register_sim_regno (gdbarch, regno) >= 0)
    {
      char tmp[MAX_REGISTER_SIZE];
      int nr_bytes;
      regcache_cooked_read (regcache, regno, tmp);
      nr_bytes = sim_store_register (gdbsim_desc,
				     gdbarch_register_sim_regno
				       (gdbarch, regno),
				     tmp, register_size (gdbarch, regno));
      if (nr_bytes > 0 && nr_bytes != register_size (gdbarch, regno))
	internal_error (__FILE__, __LINE__,
			_("Register size different to expected"));
      /* FIXME: cagney/2002-05-27: Should check `nr_bytes == 0'
	 indicating that GDB and the SIM have different ideas about
	 which registers are fetchable.  */
      if (remote_debug)
	{
	  printf_filtered ("gdbsim_store_register: %d", regno);
	  /* FIXME: We could print something more intelligible.  */
	  dump_mem (tmp, register_size (gdbarch, regno));
	}
    }
}
/*
 * Something tried to access memory that isn't in our memory map..
 * User mode accesses just cause a SIGSEGV
 */
static void
__do_user_fault(struct task_struct *tsk, unsigned long addr,
		unsigned int fsr, int code, struct pt_regs *regs)
{
	struct siginfo si;

#ifdef CONFIG_DEBUG_USER
	printk("%s: unhandled page fault at pc=0x%08lx, "
	       "lr=0x%08lx (bad address=0x%08lx, code %#x, fsr = %x)\n",
	       tsk->comm, regs->ARM_pc, regs->ARM_lr, addr, code, fsr);
	show_regs(regs);

	dump_mem("user-space stacks:", regs->ARM_sp,(regs->ARM_sp&~0xfff)+0x1000);
#endif

#if defined (CONFIG_ARCH_PNX0106)
	if ((strncmp (tsk->comm, "mcp", 3) == 0) ||
	    (strncmp (tsk->comm, "setui", 5) == 0) ||
	    (strncmp (tsk->comm, "linuxrc", 7) == 0))
	{
		printk ("Unexpected fault in '%s'", tsk->comm);
		//panic ("Unexpected fault in '%s'", tsk->comm);
	}
#endif

	tsk->thread.address = addr;
	tsk->thread.error_code = fsr;
	tsk->thread.trap_no = 14;
	si.si_signo = SIGSEGV;
	si.si_errno = 0;
	si.si_code = code;
	si.si_addr = (void *)addr;
	force_sig_info(SIGSEGV, &si, tsk);
}
Esempio n. 12
0
static void dump_backtrace_entry(unsigned long where, unsigned long stack)
{
	print_ip_sym(where);
	if (in_exception_text(where))
		dump_mem("", "Exception stack", stack,
			 stack + sizeof(struct pt_regs) + 180); /* Additional 180 to workaround sp offset */
}
Esempio n. 13
0
static int __die(const char *str, int err, struct pt_regs *regs)
{
	struct task_struct *tsk = current;
	static int die_counter;
	int ret;

	pr_emerg("Internal error: %s: %x [#%d]" S_PREEMPT S_SMP "\n",
		 str, err, ++die_counter);

	/* trap and error numbers are mostly meaningless on ARM */
	ret = notify_die(DIE_OOPS, str, regs, err, 0, SIGSEGV);
	if (ret == NOTIFY_STOP)
		return ret;

	print_modules();
	__show_regs(regs);
	pr_emerg("Process %.*s (pid: %d, stack limit = 0x%p)\n",
		 TASK_COMM_LEN, tsk->comm, task_pid_nr(tsk),
		 end_of_stack(tsk));

	if (!user_mode(regs)) {
		dump_mem(KERN_EMERG, "Stack: ", regs->sp,
			 THREAD_SIZE + (unsigned long)task_stack_page(tsk));
		dump_backtrace(regs, tsk);
		dump_instr(KERN_EMERG, regs);
	}

	return ret;
}
Esempio n. 14
0
static void handle_next(int key, struct tty_struct *tty)
{
	if (dump_address)
		dump_mem();
	else if (dump_slab_ptr)
		dump_slab();
}
Esempio n. 15
0
static void dump_backtrace_entry(unsigned long where, unsigned long stack)
{
	print_ip_sym(where);
	if (in_exception_text(where))
		dump_mem("", "Exception stack", stack,
			 stack + sizeof(struct pt_regs));
}
Esempio n. 16
0
/// Dump out a CDP packet - not very intelligently
void
dump_cdp_packet(const void* vpacket,	///< [in]Pointer to a the start of a CDP packet
                const void* vpktend)	///< [in]Pointer of first byte past end of CDP packet
{
	const guchar*	packet = vpacket;
	const guchar*	pktend = vpktend;
	const guchar*	tlv_vp;

	if (NULL == packet
	||  !is_valid_cdp_packet(packet, pktend)) {
		fprintf(stderr, "%ld byte packet at address %p is not a valid CDP packet.\n"
		,	(long)(pktend-packet), packet);
		return;
	}
	fprintf(stdout, "{CDP vers: %d, cksum: 0x%04x, ttl: %d}\n"
	,	get_cdp_vers(packet, pktend), get_cdp_cksum(packet, pktend), get_cdp_ttl(packet, pktend));

	for (tlv_vp = get_cdptlv_first(packet, pktend)
	;	tlv_vp != NULL
	;	tlv_vp = get_cdptlv_next(tlv_vp, pktend)) {
		unsigned		ttype	= get_cdptlv_type(tlv_vp, pktend);
		gsize			tlen	= get_cdptlv_vlen(tlv_vp, pktend);
		const unsigned char*	tbody	= get_cdptlv_body(tlv_vp, pktend);

		fprintf(stdout, "CDP TLV type: %s, length: %"G_GSIZE_FORMAT", values: "
		,	get_cdp_type_string(ttype), tlen);
		dump_mem(tbody, tbody+tlen);
		fprintf(stdout, "\n");
	}
}
Esempio n. 17
0
static void
gdbsim_store_register (int regno)
{
  if (regno == -1)
    {
      for (regno = 0; regno < NUM_REGS; regno++)
	gdbsim_store_register (regno);
      return;
    }
  else if (REGISTER_SIM_REGNO (regno) >= 0)
    {
      char tmp[MAX_REGISTER_SIZE];
      int nr_bytes;
      deprecated_read_register_gen (regno, tmp);
      nr_bytes = sim_store_register (gdbsim_desc,
				     REGISTER_SIM_REGNO (regno),
				     tmp, register_size (current_gdbarch, regno));
      if (nr_bytes > 0 && nr_bytes != register_size (current_gdbarch, regno))
	internal_error (__FILE__, __LINE__,
			"Register size different to expected");
      /* FIXME: cagney/2002-05-27: Should check `nr_bytes == 0'
	 indicating that GDB and the SIM have different ideas about
	 which registers are fetchable.  */
      if (sr_get_debug ())
	{
	  printf_filtered ("gdbsim_store_register: %d", regno);
	  /* FIXME: We could print something more intelligible.  */
	  dump_mem (tmp, register_size (current_gdbarch, regno));
	}
    }
}
Esempio n. 18
0
static void
gdbsim_fetch_register (int regno)
{
  if (regno == -1)
    {
      for (regno = 0; regno < NUM_REGS; regno++)
	gdbsim_fetch_register (regno);
      return;
    }

  switch (REGISTER_SIM_REGNO (regno))
    {
    case LEGACY_SIM_REGNO_IGNORE:
      break;
    case SIM_REGNO_DOES_NOT_EXIST:
      {
	/* For moment treat a `does not exist' register the same way
           as an ``unavailable'' register.  */
	char buf[MAX_REGISTER_SIZE];
	int nr_bytes;
	memset (buf, 0, MAX_REGISTER_SIZE);
	regcache_raw_supply (current_regcache, regno, buf);
	set_register_cached (regno, -1);
	break;
      }
    default:
      {
	static int warn_user = 1;
	char buf[MAX_REGISTER_SIZE];
	int nr_bytes;
	gdb_assert (regno >= 0 && regno < NUM_REGS);
	memset (buf, 0, MAX_REGISTER_SIZE);
	nr_bytes = sim_fetch_register (gdbsim_desc,
				       REGISTER_SIM_REGNO (regno),
				       buf, register_size (current_gdbarch, regno));
	if (nr_bytes > 0 && nr_bytes != register_size (current_gdbarch, regno) && warn_user)
	  {
	    fprintf_unfiltered (gdb_stderr,
				"Size of register %s (%d/%d) incorrect (%d instead of %d))",
				REGISTER_NAME (regno),
				regno, REGISTER_SIM_REGNO (regno),
				nr_bytes, register_size (current_gdbarch, regno));
	    warn_user = 0;
	  }
	/* FIXME: cagney/2002-05-27: Should check `nr_bytes == 0'
	   indicating that GDB and the SIM have different ideas about
	   which registers are fetchable.  */
	/* Else if (nr_bytes < 0): an old simulator, that doesn't
	   think to return the register size.  Just assume all is ok.  */
	regcache_raw_supply (current_regcache, regno, buf);
	if (sr_get_debug ())
	  {
	    printf_filtered ("gdbsim_fetch_register: %d", regno);
	    /* FIXME: We could print something more intelligible.  */
	    dump_mem (buf, register_size (current_gdbarch, regno));
	  }
	break;
      }
    }
}
static int show_process_stack (int pid)
{
	struct task_struct *p;
	unsigned int cur_sp;

	if ((pid > 0) && (p = find_task_by_pid (pid))) {
		cur_sp = ((unsigned int *)p)[792/4];			/* why 792:please reference the disassemble code of __switch_to */
		printk("pid:%d, sp=0x%08x\n", pid, cur_sp);
		dump_mem ("Stack: ", cur_sp, 8192 + (unsigned long) p); /* current sp upwards to origin of stack */
		dump_mem ("Below stack: ", (unsigned long) p, cur_sp);	/* base of tsk upwards to current sp */
	}
	else {
		printk ("\nwrong pid\n");
	}

	return 0;
}
Esempio n. 20
0
void test_rts(int bench,
	      void *f(struct inst *, int, int),
	      struct inst cprog[],
	      int iterations)
{
  int start_time, end_time, i;
  void (* rts_spec)();

  /* determine length of program here */
  for(prg_size = 0 ; cprog[prg_size].opcode != END ; prg_size++)
    ;
  printf("Program size: %d\n", prg_size);

  printf("[Tempo RTS]\n");

  if (bench == TEST) {

    rts_spec = (*f)(cprog, 0, 0); /* specialize function */
    init_state();		             /* initialize memory  */
    dump_mem();			       /* verify memory contents */
    (*rts_spec)();
    dump_mem();

  } else {
    
    /* Can't currently measure code generation time */
    rts_spec = (*f)(cprog, 0, 0);
    /*
    start_time = unix_time();
    for( i = 0; i < iterations / 10; i++)
      rts_spec = rts_interpret_1(cprog, 0, 0);
    end_time = unix_time();
    printf("Code generation (NOTE: * 10 !!!):\n");
    print_time(start_time, end_time, 1);
    */
    
    start_time = unix_time();
    for( i = 0; i < iterations; i++)
      (* rts_spec)();	                 /* execute specialized function */
    end_time = unix_time();
    printf("Code execution:\n");
    print_time(start_time, end_time, 1);
  }
  printf("\n"); 
}
Esempio n. 21
0
void S9x_dumpcheat(unsigned int id)
{
	cprintf("\nid %d------------\n", id);
	cprintf("total %d; part %d\n", Cheat.c[id].total_part, Cheat.c[id].part_id);
	cprintf("address: %08x; data: %d\n", Cheat.c[id].address, Cheat.c[id].part_len);
	if(Cheat.c[id].part_len == 1)
		cprintf("data: %02x\n", Cheat.c[id].byte);
	else
		dump_mem((unsigned char*)Cheat.c[id].name, Cheat.c[id].part_len);
	cprintf("           ------\n");
}
Esempio n. 22
0
static void stepcallback(const DBNZ_CELL_TYPE *state, size_t plen, size_t cursor, unsigned int step) {
  if (!step)
    dump_mem(state, plen);
#ifdef HEARTBEAT
  if (!(step & 1023))
    printf("Step %u, cursor %" PRIuMAX "\n", step, (uintmax_t) cursor);
#endif
  current_state = state;
  last_plen = plen;
  last_step = step;
  last[step & 63] = cursor;
}
Esempio n. 23
0
int main(int argc, char **argv) {
  if (argc < 2) {
    fprintf(stderr, "Please specify a program to run.\n");
    fprintf(stderr, "Usage:\n");
    fprintf(stderr, "./viz statefile\n");
    exit(1);
  }
  int ret = dbnz_file_bootstrap(argv[1], &stepcallback);
  printf("Execution finished returning %d after %u steps.\n", ret, last_step);
  dump_mem(current_state, last_plen);
  return 0;
}
Esempio n. 24
0
/// @brief dumps leaf elems
/// @param[in] leaf  pointer to node
static void node_dump_leaf(node_ptr leaf) {
	const item_ref *elem_end = leaf->l_elems + leaf->hdr.cnt;
	for (const item_ref *elem = leaf->l_elems; elem < elem_end; ++elem) {
		fprintf(stderr, "        item %-4" PRIdPTR " %s len %" PRIu32 "\n",
			(elem - leaf->l_elems), key_str(&elem->key), elem->len);
		
		if (elem->len != 0) {
			uint16_t idx = (elem - leaf->l_elems);
			dump_mem(leaf_elem_data(leaf, idx), elem->len);
		}
	}
}
Esempio n. 25
0
static int buspirate_send_bin(struct programmer_t *pgm, char *data, size_t len)
{
	int rc;

	if (verbose > 1) {
		fprintf(stderr, "%s: buspirate_send_bin():\n", progname);
		dump_mem(data, len);
	}

	rc = serial_send(&pgm->fd, (unsigned char *)data, len);

	return rc;
}
Esempio n. 26
0
static int buspirate_recv_bin(struct programmer_t *pgm, char *buf, size_t len)
{
	int rc;

	rc = serial_recv(&pgm->fd, (unsigned char *)buf, len);
	if (rc < 0)
		return EOF;
	if (verbose > 1) {
		fprintf(stderr, "%s: buspirate_recv_bin():\n", progname);
		dump_mem(buf, len);
	}

	return len;
}
Esempio n. 27
0
static void return_dump_mem(char *str)
{
	unsigned long address;
	char *end;

	address = simple_strtoul(str, &end, 0);
	if (*end != '\0') {
		printk("Bad address [%s]\n", str);
		return;
	}

	dump_address = (unsigned long *)address;
	dump_mem();
}
Esempio n. 28
0
XPCF_CB(USBSIM_XACT_STS) testapp_dev_out_xact(void *ctx, void *buf, size_t len)
{
	TESTAPP_DEV *dev = (TESTAPP_DEV *) ctx;

	printf("*** OUT transfer ***\n");
	printf("%u bytes received\n", len);
	dump_mem(buf, len);

	if (len > HS_BULK_MPS)
		len = HS_BULK_MPS;
	memcpy(dev->buf, buf, len);
	dev->len = len;
	return USBSIM_XACT_STS_OK;
}
Esempio n. 29
0
static int
gdbsim_xfer_inferior_memory (CORE_ADDR memaddr, gdb_byte *myaddr, int len,
			     int write, struct mem_attrib *attrib,
			     struct target_ops *target)
{
  /* If no program is running yet, then ignore the simulator for
     memory.  Pass the request down to the next target, hopefully
     an exec file.  */
  if (!target_has_execution)
    return 0;

  if (!program_loaded)
    error (_("No program loaded."));

  if (sr_get_debug ())
    {
      /* FIXME: Send to something other than STDOUT? */
      printf_filtered ("gdbsim_xfer_inferior_memory: myaddr 0x");
      gdb_print_host_address (myaddr, gdb_stdout);
      printf_filtered (", memaddr 0x%s, len %d, write %d\n",
		       paddr_nz (memaddr), len, write);
      if (sr_get_debug () && write)
	dump_mem (myaddr, len);
    }

  if (write)
    {
      len = sim_write (gdbsim_desc, memaddr, myaddr, len);
    }
  else
    {
      len = sim_read (gdbsim_desc, memaddr, myaddr, len);
      if (sr_get_debug () && len > 0)
	dump_mem (myaddr, len);
    }
  return len;
}
Esempio n. 30
0
void show_stack(struct task_struct *tsk, unsigned long *sp)
{
	unsigned long stack;

	if (!tsk)
		tsk = current;
	if (tsk == current)
		sp = (unsigned long *)current_stack_pointer;
	else
		sp = (unsigned long *)tsk->thread.sp;

	stack = (unsigned long)sp;
	dump_mem("Stack: ", stack, THREAD_SIZE +
		 (unsigned long)task_stack_page(tsk));
	show_trace(tsk, sp, NULL);
}