// Send completed lines to GDB void gdbChangeCB(Widget w, XtPointer, XtPointer) { if (private_gdb_output) return; string input = current_line(); bool at_prompt = gdb_input_at_prompt; if (at_prompt) input.gsub("\\\n", ""); int newlines = input.freq('\n'); string *lines = new string[newlines + 1]; split(input, lines, newlines, '\n'); private_gdb_input = true; if (newlines == 0 || (gdb_input_at_prompt && input.contains('\\', -1))) { // No newline found - line is still incomplete set_history_from_line(input, true); } else { // Process entered lines clear_isearch(); promptPosition = XmTextGetLastPosition(w); for (int i = 0; i < newlines; i++) { string cmd = lines[i]; tty_out(cmd + "\n"); if (gdb_input_at_prompt) { if (cmd.matches(rxwhite) || cmd.empty()) { // Empty line: repeat last command cmd = last_command_from_history(); } else { // Add new command to history add_to_history(cmd); } } if (at_prompt) { // We're typing at the GDB prompt: place CMD in command queue gdb_command(cmd, w); } else { // Pass anything else right to GDB, clearing the command queue. clearCommandQueue(); gdb->send_user_ctrl_cmd(cmd + "\n"); } } } private_gdb_input = false; delete[] lines; }
/*f c_mmio_model::write */ void c_mmio_model::write( unsigned int address, unsigned int data, int bytes ) { FILE * fp; switch (address & 0xff) { case 0: data &= 0xff; fp = fopen ("out.log", "a"); fprintf (fp, "%c", data); fclose (fp); if ((data >= 32 && data < 127) || data == '\n') printf ("%c", (data & 0xff)); else printf ("%2.2x", data); return; case 4: debug_level = data; return; case 8: gdb_trap(5); return; case 0x0c: printf ("Setting Timer ISR address to %x\n", data); //private_data->gip->set_interrupt_vector (0, data); return; case 0x10: private_data->gip->set_flags( data, 0xf0000001); return; case 0x14: printf ("*** HISTORICAL\n"); gdb_trap(5); return; case 0x20: //private_data->gip->set_interrupt_vector (1, data); return; case 0x24: //private_data->gip->set_kernel_sp (data); return; case 0x28: tty_out ((char)data); return; case 0x30: ether_byte ((unsigned char)data); return; case 0x34: ether_send (); return; case 0x2c: //private_data->gip->set_interrupt_vector (2, data); printf ("Setting up ISR for serial RX\n"); return; case 0x100: private_data->gip->trace_restart(); return; case 0x104: private_data->gip->trace_all_stop(); return; } }