void command() { // Parses a single comment Lexer lexer(env); lexer.input(); Token cmd = lexer.token(); if (cmd.value() == "break") { lexer.next(); Token bp = lexer.token(); std::stringstream ss(bp.value().substr(1)); intptr_t addr = 0; ss >> addr; breakpoint((mach_vm_address_t)addr); std::cerr << bp.value() << std::endl; } else if (cmd.value() == "run") {
extern "C" volatile void lprint_fatalNoMenu(const char* file, int line, lprint_format_t msg, ...) { Unused(file); Unused(line); bool saved = PrintVMMessages; PrintVMMessages = true; lprintf("\n\nSelf: fatal error: "); va_list ap; va_start(ap, msg); vlprintf(msg, ap); va_end(ap); lprintf("\n"); PrintVMMessages = saved; breakpoint(); OS::terminate(1); }
Data DebugSession::addBreakPoint(const Data& data) { Breakpoint breakpoint(data); Data replyData; if (_breakPoints.find(breakpoint) == _breakPoints.end()) { _breakPoints.insert(breakpoint); replyData.compound["status"] = Data("success", Data::VERBATIM); } else { replyData.compound["reason"] = Data("Breakpoint already exists", Data::VERBATIM); replyData.compound["status"] = Data("failure", Data::VERBATIM); } return replyData; }
void NullDevice::acquireChannel(ChannelBase *chan) { MutexGuard guard(_channelLock); if(!guard) breakpoint(); for(unsigned int i = 0; i < _numChannels; ++i) if(_channels[i] == chan) { _channels[i]->x_acquired = false; _channels[i] = NULL; break; } }
int main(int argc, char *argv[]) { pthread_t t; breakpoint(); var = 42; (void)var; pthread_create(&t, NULL, thread, NULL); pthread_join(t, NULL); atomic_puts("EXIT-SUCCESS"); return 0; }
void __init arch_init_irq(void) { int i; //extern irq_desc_t irq_desc[]; /* init CPU irqs */ mips_cpu_irq_init(); /* init sys irqs */ sys_irq_base = M36_SYS_IRQ_BASE; for (i=sys_irq_base; i < sys_irq_base + M36_NUM_SYS_IRQ; i++) irq_set_chip_and_handler(i, &sys_irq_controller,handle_percpu_irq); /* Default all ICU IRQs to off and enable IM bit(IP3) of CP0 status for sys IRQ */ #if 1 *((unsigned long *)(0xB8000038)) = 0; *((unsigned long *)(0xB800003C)) = 0; *((unsigned long *)(0xB80000EC)) = 0; write_c0_status(read_c0_status() | STATUSF_IP3); #else *M6303_MSYSINT1REG = 0; *M6303_MSYSINT2REG = 0; #endif #ifdef CONFIG_REMOTE_DEBUG printk("Setting debug traps - please connect the remote debugger.\n"); set_debug_traps(); // you may move this line to whereever you want breakpoint(); #endif if((*(unsigned short *)0xB8000002 == 0x3901) \ || (*(unsigned short *)0xB8000002 == 0x3701) \ || (*(unsigned short *)0xB8000002 == 0x3503)) { sys_rpc_addr = 0xB8040037; sys_rpc_mask = 0x0C; sys_rpc_irq1_mask = 0x08; sys_rpc_irq2_mask = 0x04; } else { sys_rpc_addr = 0xB8040036; sys_rpc_mask = 0xC0; sys_rpc_irq1_mask = 0x80; sys_rpc_irq2_mask = 0x40; } }
int main(int argc, char* argv[]) { int dummy, i; signal(SIGUSR1, handle_usr1); breakpoint(); /* NO SYSCALLS AFTER HERE! (Up to the assert.) */ for (i = 1; !caught_usr1 && i < (1 << 30); ++i) { dummy += (dummy + i) % 9735; } atomic_puts("EXIT-SUCCESS"); return 0; }
void __init init_IRQ(void) { #ifdef CONFIG_REMOTE_DEBUG extern void breakpoint(void); extern void set_debug_traps(void); printk("Wait for gdb client connection ...\n"); set_debug_traps(); breakpoint(); #endif /* Invoke board-specific irq setup */ irq_setup(); }
Data DebugSession::disableBreakPoint(const Data& data) { Breakpoint breakpoint(data); Data replyData; if (_breakPoints.find(breakpoint) != _breakPoints.end()) { _breakPoints.find(breakpoint)->enabled = false; replyData.compound["status"] = Data("success", Data::VERBATIM); } else { replyData.compound["reason"] = Data("No such breakpoint", Data::VERBATIM); replyData.compound["status"] = Data("failure", Data::VERBATIM); } return replyData; }
int main(int argc, char *argv[]) { size_t num_bytes = sysconf(_SC_PAGESIZE); int fd = open(argv[0], O_RDONLY); int* wpage; int* rpage; int i; test_assert(fd >= 0); breakpoint(); wpage = mmap(NULL, num_bytes, PROT_READ | PROT_WRITE, MAP_PRIVATE, fd, 0); breakpoint(); rpage = mmap(NULL, num_bytes, PROT_READ, MAP_PRIVATE, fd, 0); test_assert(wpage != (void*)-1 && rpage != (void*)-1 && rpage != wpage); breakpoint(); for (i = 0; i < num_bytes / sizeof(int); ++i) { int magic; test_assert(wpage[i] == rpage[i]); magic = rpage[i] * 31 + 3; wpage[i] = magic; test_assert(rpage[i] != magic && wpage[i] == magic); atomic_printf("%d:%d,", rpage[i], wpage[i]); } atomic_puts("EXIT-SUCCESS"); return 0; }
int main () { #ifdef usestubs set_debug_traps(); breakpoint(); #endif struct1.val = 1; struct2.val = 2; ptr1 = &struct1; ptr2 = &struct2; marker1 (); func1 (); for (count = 0; count < 4; count++) { ival1 = count; ival3 = count; ival4 = count; } ival1 = count; /* Outside loop */ ival2 = count; ival3 = count; ival4 = count; marker2 (); if (doread) { static char msg[] = "type stuff for buf now:"; write (1, msg, sizeof (msg) - 1); read (0, &buf[0], 5); } marker4 (); /* We have a watchpoint on ptr1->val. It should be triggered if ptr1's value changes. */ ptr1 = ptr2; /* This should not trigger the watchpoint. If it does, then we used the wrong value chain to re-insert the watchpoints or we are not evaluating the watchpoint expression correctly. */ struct1.val = 5; marker5 (); /* We have a watchpoint on ptr1->val. It should be triggered if ptr1's value changes. */ ptr1 = ptr2; /* This should not trigger the watchpoint. If it does, then we used the wrong value chain to re-insert the watchpoints or we are not evaluating the watchpoint expression correctly. */ struct1.val = 5; marker5 (); return 0; }
void assprint(const char *expr, const char *file, int line, const char *fmt, ...) { va_list ap; /* I like compiler like output */ hprintf("%s:%d: ASSERT(%s)\n", file, line, expr); va_start(ap, fmt); vhprintf(fmt, ap); va_end(ap); hputs("\n"); breakpoint(); }
void umain(int argc, char **argv) { int i; sleep(2); cprintf("starting count down: "); for (i = 5; i >= 0; i--) { cprintf("%d ", i); sleep(1); } cprintf("\n"); breakpoint(); }
int main (int argc, char **argv) { int i; #ifdef usestubs set_debug_traps(); breakpoint(); #endif for (i = 0; i < 100; i++) printf (">>> %d\n", i); /* euphonium */ return 0; }
NOINLINE_DECL void verifyFailed(const char* expr, const char* file, unsigned line) { assertionCount.condrollover(++assertionCount.regular); log() << "Assertion failure " << expr << ' ' << file << ' ' << dec << line << endl; logContext(); stringstream temp; temp << "assertion " << file << ":" << line; AssertionException e(temp.str(), 0); breakpoint(); #if defined(MONGO_CONFIG_DEBUG_BUILD) // this is so we notice in buildbot log() << "\n\n***aborting after verify() failure as this is a debug/test build\n\n" << endl; quickExit(EXIT_ABRUPT); #endif throw e; }
void debug_gdb (void) { #ifdef DEBUG_GDB static bool f = false; if (!f) { f = true; printf ("gdb set_debug_traps\n"); set_debug_traps (); printf ("gdb breakpoint\n"); breakpoint (); } #endif }
NOINLINE_DECL void verifyFailed(const char *msg, const char *file, unsigned line) { assertionCount.condrollover( ++assertionCount.regular ); log() << "Assertion failure " << msg << ' ' << file << ' ' << dec << line << endl; logContext(); stringstream temp; temp << "assertion " << file << ":" << line; AssertionException e(temp.str(),0); breakpoint(); #if defined(_DEBUG) || defined(_DURABLEDEFAULTON) || defined(_DURABLEDEFAULTOFF) // this is so we notice in buildbot log() << "\n\n***aborting after verify() failure as this is a debug/test build\n\n" << endl; abort(); #endif throw e; }
int main(int argc, char* argv[]) { test_assert(argc == 1 || (argc == 2 && !strcmp("self", argv[1]))); if (argc != 2) { atomic_printf("exec(%s, 'self') ...\n", argv[0]); breakpoint(); /* No syscalls in between here. */ execlp(argv[0], argv[0], "self", NULL); test_assert("Not reached" && 0); } atomic_puts("EXIT-SUCCESS"); return 0; }
void print_queue(unsigned int max) { kassert(max < MAX_PID); int i; for (i = 0; i < max; i++) { vga_printf("index %u\n", i); vga_printf("\tpd = %d\n", tasks[i].pd); vga_printf("\tquantum = %u\n", tasks[i].quantum); if (tasks[i].prev != NULL) { vga_printf("\tprev_pid = %d\n", tasks[i].prev->pd); } else { vga_printf("\tprev_pid = NULL\n"); } if (tasks[i].next != NULL) { vga_printf("\tnext_pid = %d\n", tasks[i].next->pd); } else { vga_printf("\tnext_pid = NULL\n"); } breakpoint(); } if (actual != NULL) { vga_printf("actual_pid = %d\t", actual->pd); } else { vga_printf("actual_pid = NULL\t"); } if (first != NULL) { vga_printf("first_pid = %d\t", first->pd); } else { vga_printf("first_pid = NULL\t"); } if (last != NULL) { vga_printf("last_pid = %d\n", last->pd); } else { vga_printf("last_pid = NULL\n"); } breakpoint(); }
Bool VG_(gdbserver_point) (PointKind kind, Bool insert, CORE_ADDR addr, int len) { Bool res; GS_Watch *g; Bool is_code = kind == software_breakpoint || kind == hardware_breakpoint; dlog(1, "%s %s at addr %p %s\n", (insert ? "insert" : "remove"), VG_(ppPointKind) (kind), C2v(addr), sym(addr, is_code)); if (is_code) { breakpoint (insert, addr); return True; } vg_assert (kind == access_watchpoint || kind == read_watchpoint || kind == write_watchpoint); if (tool_watchpoint == NULL) return False; res = (*tool_watchpoint) (kind, insert, addr, len); if (!res) return False; /* error or unsupported */ g = VG_(HT_lookup) (gs_watches, (UWord)addr); if (insert) { if (g == NULL) { g = VG_(arena_malloc)(VG_AR_CORE, "gdbserver_point watchpoint", sizeof(GS_Watch)); g->addr = addr; g->len = len; g->kind = kind; VG_(HT_add_node)(gs_watches, g); } else { g->kind = kind; } } else { vg_assert (g != NULL); VG_(HT_remove) (gs_watches, g->addr); VG_(arena_free) (VG_AR_CORE, g); } return True; }
int main(void) { __asm__ __volatile__( /* Push the constants in stack order so they look as * we expect in gdb. */ #if __i386__ "fldl st7\n\t" "fldl st6\n\t" "fldl st5\n\t" "fldl st4\n\t" "fldl st3\n\t" "fldl st2\n\t" "fldl st1\n\t" "fldl st0\n\t" "movss xmm0, %xmm0\n\t" "movss xmm1, %xmm1\n\t" "movss xmm2, %xmm2\n\t" "movss xmm3, %xmm3\n\t" "movss xmm4, %xmm4\n\t" "movss xmm5, %xmm5\n\t" "movss xmm6, %xmm6\n\t" "movss xmm7, %xmm7\n\t" #elif __x86_64__ "fldl st7(%rip)\n\t" "fldl st6(%rip)\n\t" "fldl st5(%rip)\n\t" "fldl st4(%rip)\n\t" "fldl st3(%rip)\n\t" "fldl st2(%rip)\n\t" "fldl st1(%rip)\n\t" "fldl st0(%rip)\n\t" "movss xmm0(%rip), %xmm0\n\t" "movss xmm1(%rip), %xmm1\n\t" "movss xmm2(%rip), %xmm2\n\t" "movss xmm3(%rip), %xmm3\n\t" "movss xmm4(%rip), %xmm4\n\t" "movss xmm5(%rip), %xmm5\n\t" "movss xmm6(%rip), %xmm6\n\t" "movss xmm7(%rip), %xmm7\n\t" #else #error unexpected architecture #endif ); breakpoint(); atomic_puts("EXIT-SUCCESS"); return 0; }
void asserted(const char *msg, const char *file, unsigned line) { assertionCount.condrollover( ++assertionCount.regular ); problem() << "Assertion failure " << msg << ' ' << file << ' ' << dec << line << endl; sayDbContext(); raiseError(0,msg && *msg ? msg : "assertion failure"); stringstream temp; temp << "assertion " << file << ":" << line; AssertionException e(temp.str(),0); breakpoint(); #if defined(_DEBUG) || defined(_DURABLEDEFAULTON) // this is so we notice in buildbot log() << "\n\n***aborting after assert() failure in a debug/test build\n\n" << endl; abort(); #endif throw e; }
CObjRep * RegionReplicated::RegionReplicatedRoot::createRep(VPNum vp) { if (regionState != RegionReplicated::NORMAL) { err_printf("FIXME - region rep create root in special state\n"); breakpoint(); while (1); } CObjRep *rep=(CObjRep *)new RegionReplicated; //err_printf("RegionReplicatedRoot::createRep()" // ": vp=%d New rep created rep=%p for ref=%p\n", // Scheduler::GetVP(), rep, _ref); return rep; }
static int backup_phase4_server(struct sdirs *sdirs, struct conf **cconfs) { int breaking=get_int(cconfs[OPT_BREAKPOINT]); if(breaking==4) return breakpoint(breaking, __func__); log_fzp_set(NULL, cconfs); // Phase4 will open logfp again (in case it is resuming). switch(get_protocol(cconfs)) { case PROTO_1: return backup_phase4_server_protocol1(sdirs, cconfs); default: return backup_phase4_server_protocol2(sdirs, cconfs); } }
FRAGMENT(Interpreter, Regs) { struct FakeFrame { js::InterpreterFrame frame; JS::Value slot0; JS::Value slot1; JS::Value slot2; } fakeFrame; uint8_t fakeOpcode = JSOP_IFEQ; js::InterpreterRegs regs; js::GDBTestInitInterpreterRegs(regs, &fakeFrame.frame, &fakeFrame.slot2, &fakeOpcode); breakpoint(); use(regs); }
int main(int argc, char *argv[]) { int i; for (i = SIGRTMIN; i <= SIGRTMAX; ++i) { breakpoint(); signal(i, handle_sigrt); raise(i); } atomic_printf("caught %d signals; expected %d\n", num_signals_caught, 1 + SIGRTMAX - SIGRTMIN); test_assert(1 + SIGRTMAX - SIGRTMIN == num_signals_caught); atomic_puts("EXIT-SUCCESS"); return 0; }
void NullDevice::retainChannel(ChannelBase *chan) { { MutexGuard guard(_channelLock); if(!guard) breakpoint(); for(unsigned int i = 0; i < _numChannels; ++i) if(_channels[i] == chan) { _channels[i] = NULL; break; } } chan->destroy(); }
NOINLINE_DECL void verifyFailed( int msgid ) { assertionCount.condrollover( ++assertionCount.regular ); problem() << "Assertion failure " << msgid << endl; sayDbContext(); raiseError(0,"assertion failure"); stringstream temp; temp << msgid; AssertionException e(temp.str(),0); breakpoint(); #if defined(_DEBUG) || defined(_DURABLEDEFAULTON) || defined(_DURABLEDEFAULTOFF) // this is so we notice in buildbot log() << "\n\n***aborting after verify() failure in a debug/test build\n\n" << endl; abort(); #endif throw e; }
int spin(void) { int i, dummy = 0; atomic_puts("spinning"); /* NO SYSCALLS AFTER HERE: the point of this test is to hit * hpc interrupts to exercise the nonvoluntary interrupt * scheduler. */ for (i = 1; i < NUM_ITERATIONS; ++i) { dummy += i % (1 << 20); dummy += i % (79 * (1 << 20)); if (i == NUM_ITERATIONS / 2) { breakpoint(); } } return dummy; }
void __init init_IRQ(void) { #ifdef CONFIG_KGDB extern void breakpoint(void); extern void set_debug_traps(void); printk("Wait for gdb client connection ...\n"); set_debug_traps(); breakpoint(); #endif /* set up default irq controller */ init_generic_irq(); /* invoke board-specific irq setup */ irq_setup(); }