gdb(4): Style
No functional change. I was surprised to find that no sys/ header already defines the -1 EOF convention anywhere, so defined one locally.
This commit is contained in:
parent
799176810a
commit
5df6fa4344
@ -31,6 +31,10 @@
|
|||||||
#ifndef _GDB_GDB_INT_H_
|
#ifndef _GDB_GDB_INT_H_
|
||||||
#define _GDB_GDB_INT_H_
|
#define _GDB_GDB_INT_H_
|
||||||
|
|
||||||
|
#ifndef EOF
|
||||||
|
#define EOF (-1)
|
||||||
|
#endif
|
||||||
|
|
||||||
extern struct gdb_dbgport *gdb_cur;
|
extern struct gdb_dbgport *gdb_cur;
|
||||||
|
|
||||||
extern int gdb_listening;
|
extern int gdb_listening;
|
||||||
@ -54,7 +58,7 @@ gdb_rx_char(void)
|
|||||||
c = *gdb_rxp++;
|
c = *gdb_rxp++;
|
||||||
gdb_rxsz--;
|
gdb_rxsz--;
|
||||||
} else
|
} else
|
||||||
c = -1;
|
c = EOF;
|
||||||
return (c);
|
return (c);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -653,7 +653,10 @@ gdb_trap(int type, int code)
|
|||||||
case 'H': { /* Set thread. */
|
case 'H': { /* Set thread. */
|
||||||
intmax_t tid;
|
intmax_t tid;
|
||||||
struct thread *thr;
|
struct thread *thr;
|
||||||
gdb_rx_char();
|
|
||||||
|
/* Ignore 'g' (general) or 'c' (continue) flag. */
|
||||||
|
(void) gdb_rx_char();
|
||||||
|
|
||||||
if (gdb_rx_varhex(&tid)) {
|
if (gdb_rx_varhex(&tid)) {
|
||||||
gdb_tx_err(EINVAL);
|
gdb_tx_err(EINVAL);
|
||||||
break;
|
break;
|
||||||
@ -768,7 +771,7 @@ gdb_trap(int type, int code)
|
|||||||
gdb_tx_err(ENOENT);
|
gdb_tx_err(ENOENT);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case -1:
|
case EOF:
|
||||||
/* Empty command. Treat as unknown command. */
|
/* Empty command. Treat as unknown command. */
|
||||||
/* FALLTHROUGH */
|
/* FALLTHROUGH */
|
||||||
default:
|
default:
|
||||||
|
@ -197,7 +197,7 @@ gdb_rx_varhex(uintmax_t *vp)
|
|||||||
v += C2N(c);
|
v += C2N(c);
|
||||||
c = gdb_rx_char();
|
c = gdb_rx_char();
|
||||||
} while (isxdigit(c));
|
} while (isxdigit(c));
|
||||||
if (c != -1) {
|
if (c != EOF) {
|
||||||
gdb_rxp--;
|
gdb_rxp--;
|
||||||
gdb_rxsz++;
|
gdb_rxsz++;
|
||||||
}
|
}
|
||||||
@ -343,13 +343,12 @@ gdb_rx_bindata(unsigned char *data, size_t datalen, size_t *amt)
|
|||||||
|
|
||||||
while (*amt < datalen) {
|
while (*amt < datalen) {
|
||||||
c = gdb_rx_char();
|
c = gdb_rx_char();
|
||||||
/* End of packet? */
|
if (c == EOF)
|
||||||
if (c == -1)
|
|
||||||
break;
|
break;
|
||||||
/* Escaped character up next */
|
/* Escaped character up next */
|
||||||
if (c == '}') {
|
if (c == '}') {
|
||||||
/* Truncated packet? Bail out */
|
/* Malformed packet. */
|
||||||
if ((c = gdb_rx_char()) == -1)
|
if ((c = gdb_rx_char()) == EOF)
|
||||||
return (1);
|
return (1);
|
||||||
c ^= 0x20;
|
c ^= 0x20;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user