当前位置: 首页>>代码示例>>C++>>正文


C++ dump_mem函数代码示例

本文整理汇总了C++中dump_mem函数的典型用法代码示例。如果您正苦于以下问题:C++ dump_mem函数的具体用法?C++ dump_mem怎么用?C++ dump_mem使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了dump_mem函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: do_page_fault

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--;
}
开发者ID:d5nguyenvan,项目名称:mirage,代码行数:32,代码来源:x86_traps.c

示例2: __die

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;
}
开发者ID:GZDooM,项目名称:dexp_es2,代码行数:35,代码来源:traps.c

示例3: test_cts

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"); 
}
开发者ID:tararc,项目名称:talc,代码行数:26,代码来源:test_tempo.c

示例4: gdbsim_xfer_inferior_memory

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;
}
开发者ID:DonCN,项目名称:haiku,代码行数:31,代码来源:remote-sim.c

示例5: main

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;
}
开发者ID:rednoax,项目名称:preparation,代码行数:10,代码来源:sort.c

示例6: do_general_protection

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);
}
开发者ID:d5nguyenvan,项目名称:mirage,代码行数:11,代码来源:x86_traps.c

示例7: show_process_stack_all

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;
}
开发者ID:SimonKagstrom,项目名称:mci500h-linux-2.4.27,代码行数:13,代码来源:panic_handler.c

示例8: main

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;
}
开发者ID:loicschurch,项目名称:ProgOSexercice,代码行数:14,代码来源:ausculteur.c

示例9: gdbsim_store_register

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));
	}
    }
}
开发者ID:davearrama,项目名称:gdb,代码行数:34,代码来源:remote-sim.c

示例10: __do_user_fault

/*
 * 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);
}
开发者ID:SimonKagstrom,项目名称:mci500h-linux-2.4.27,代码行数:38,代码来源:fault-common.c

示例11: dump_backtrace_entry

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 */
}
开发者ID:Duiesel,项目名称:ZTE_Blade_L5,代码行数:7,代码来源:traps.c

示例12: __die

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;
}
开发者ID:MISL-EBU-System-SW,项目名称:mainline-public,代码行数:29,代码来源:traps.c

示例13: dump_backtrace_entry

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));
}
开发者ID:Goshin,项目名称:android_kernel_mediatek,代码行数:7,代码来源:traps.c

示例14: dump_cdp_packet

/// 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");
	}
}
开发者ID:JJediny,项目名称:assimilation-official,代码行数:31,代码来源:cdp.c

示例15: gdbsim_store_register

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));
	}
    }
}
开发者ID:DonCN,项目名称:haiku,代码行数:31,代码来源:remote-sim.c


注:本文中的dump_mem函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。