comparison gdb_remote.c @ 804:59e664fa2da8

Fix a search/replace bug from the old Win32 GDB remote debugging work and replace some more print+exit combos with fatal_error
author Michael Pavone <pavone@retrodev.com>
date Sun, 26 Jul 2015 17:21:49 -0700
parents 236a184bf6f0
children 22e87b739ad6
comparison
equal deleted inserted replaced
803:236a184bf6f0 804:59e664fa2da8
169 } 169 }
170 if (address >= 0xA00000 && address < 0xA04000) { 170 if (address >= 0xA00000 && address < 0xA04000) {
171 z80_ram[address & 0x1FFF] = value; 171 z80_ram[address & 0x1FFF] = value;
172 genesis_context * gen = context->system; 172 genesis_context * gen = context->system;
173 #ifndef NO_Z80 173 #ifndef NO_Z80
174 z80_handle_code_GDB_WRITE(address & 0x1FFF, gen->z80); 174 z80_handle_code_write(address & 0x1FFF, gen->z80);
175 #endif 175 #endif
176 return; 176 return;
177 } else { 177 } else {
178 return; 178 return;
179 } 179 }
498 while(!cont) 498 while(!cont)
499 { 499 {
500 if (!curbuf) { 500 if (!curbuf) {
501 int numread = GDB_READ(GDB_IN_FD, buf, bufsize); 501 int numread = GDB_READ(GDB_IN_FD, buf, bufsize);
502 if (numread < 0) { 502 if (numread < 0) {
503 fputs("Failed to read on GDB input file descriptor\n", stderr); 503 fatal_error("Failed to read on GDB input file descriptor\n");
504 exit(1);
505 } 504 }
506 dfprintf(stderr, "read %d bytes\n", numread); 505 dfprintf(stderr, "read %d bytes\n", numread);
507 curbuf = buf; 506 curbuf = buf;
508 end = buf + numread; 507 end = buf + numread;
509 } else if (partial) { 508 } else if (partial) {
576 request.ai_flags = AI_PASSIVE; 575 request.ai_flags = AI_PASSIVE;
577 getaddrinfo(NULL, "1234", &request, &result); 576 getaddrinfo(NULL, "1234", &request, &result);
578 577
579 int listen_sock = socket(result->ai_family, result->ai_socktype, result->ai_protocol); 578 int listen_sock = socket(result->ai_family, result->ai_socktype, result->ai_protocol);
580 if (listen_sock < 0) { 579 if (listen_sock < 0) {
581 fputs("Failed to open GDB remote debugging socket", stderr); 580 fatal_error("Failed to open GDB remote debugging socket");
582 exit(1);
583 } 581 }
584 if (bind(listen_sock, result->ai_addr, result->ai_addrlen) < 0) { 582 if (bind(listen_sock, result->ai_addr, result->ai_addrlen) < 0) {
585 fputs("Failed to bind GDB remote debugging socket", stderr); 583 fatal_error("Failed to bind GDB remote debugging socket");
586 exit(1);
587 } 584 }
588 if (listen(listen_sock, 1) < 0) { 585 if (listen(listen_sock, 1) < 0) {
589 fputs("Failed to listen on GDB remote debugging socket", stderr); 586 fatal_error("Failed to listen on GDB remote debugging socket");
590 exit(1);
591 } 587 }
592 gdb_sock = accept(listen_sock, NULL, NULL); 588 gdb_sock = accept(listen_sock, NULL, NULL);
593 if (gdb_sock < 0) { 589 if (gdb_sock < 0) {
594 fputs("accpet returned an error while listening on GDB remote debugging socket", stderr); 590 fatal_error("accept returned an error while listening on GDB remote debugging socket");
595 exit(1);
596 } 591 }
597 closesocket(listen_sock); 592 closesocket(listen_sock);
598 #endif 593 #endif
599 } 594 }