本文整理汇总了C++中dump_mem函数的典型用法代码示例。如果您正苦于以下问题:C++ dump_mem函数的具体用法?C++ dump_mem怎么用?C++ dump_mem使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了dump_mem函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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
示例16: gdbsim_fetch_register
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;
}
}
}
开发者ID:DonCN,项目名称:haiku,代码行数:60,代码来源:remote-sim.c
示例17: show_process_stack
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;
}
开发者ID:SimonKagstrom,项目名称:mci500h-linux-2.4.27,代码行数:17,代码来源:panic_handler.c
示例18: test_rts
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");
}
开发者ID:tararc,项目名称:talc,代码行数:45,代码来源:test_tempo.c
示例19: S9x_dumpcheat
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");
}
开发者ID:Taelis,项目名称:CATSFC,代码行数:11,代码来源:cheats3.cpp
示例20: stepcallback
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;
}
开发者ID:esainane,项目名称:dbnz,代码行数:12,代码来源:inspect.c
注:本文中的dump_mem函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论