Commit 9f349498af2194915f37f99b67f709ff27458dd2
Committed by
Anthony Liguori
1 parent
0fe6a7f2
slirp: Cleanup and basic reanimation of debug code
Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>
Showing
7 changed files
with
14 additions
and
26 deletions
Makefile
@@ -190,7 +190,7 @@ ifdef CONFIG_SLIRP | @@ -190,7 +190,7 @@ ifdef CONFIG_SLIRP | ||
190 | CPPFLAGS+=-I$(SRC_PATH)/slirp | 190 | CPPFLAGS+=-I$(SRC_PATH)/slirp |
191 | SLIRP_OBJS=cksum.o if.o ip_icmp.o ip_input.o ip_output.o \ | 191 | SLIRP_OBJS=cksum.o if.o ip_icmp.o ip_input.o ip_output.o \ |
192 | slirp.o mbuf.o misc.o sbuf.o socket.o tcp_input.o tcp_output.o \ | 192 | slirp.o mbuf.o misc.o sbuf.o socket.o tcp_input.o tcp_output.o \ |
193 | -tcp_subr.o tcp_timer.o udp.o bootp.o debug.o tftp.o | 193 | +tcp_subr.o tcp_timer.o udp.o bootp.o tftp.o |
194 | OBJS+=$(addprefix slirp/, $(SLIRP_OBJS)) | 194 | OBJS+=$(addprefix slirp/, $(SLIRP_OBJS)) |
195 | endif | 195 | endif |
196 | 196 |
slirp/bootp.c
@@ -42,7 +42,7 @@ static const uint8_t rfc1533_cookie[] = { RFC1533_COOKIE }; | @@ -42,7 +42,7 @@ static const uint8_t rfc1533_cookie[] = { RFC1533_COOKIE }; | ||
42 | 42 | ||
43 | #ifdef DEBUG | 43 | #ifdef DEBUG |
44 | #define dprintf(fmt, ...) \ | 44 | #define dprintf(fmt, ...) \ |
45 | -if (slirp_debug & DBG_CALL) { fprintf(dfd, fmt, ## __VA_ARGS__); fflush(dfd); } | 45 | +do if (slirp_debug & DBG_CALL) { fprintf(dfd, fmt, ## __VA_ARGS__); fflush(dfd); } while (0) |
46 | #else | 46 | #else |
47 | #define dprintf(fmt, ...) | 47 | #define dprintf(fmt, ...) |
48 | #endif | 48 | #endif |
slirp/debug.c deleted
100644 → 0
slirp/debug.h
@@ -5,25 +5,24 @@ | @@ -5,25 +5,24 @@ | ||
5 | * terms and conditions of the copyright. | 5 | * terms and conditions of the copyright. |
6 | */ | 6 | */ |
7 | 7 | ||
8 | -#define PRN_STDERR 1 | ||
9 | -#define PRN_SPRINTF 2 | 8 | +//#define DEBUG 1 |
10 | 9 | ||
11 | -extern FILE *dfd; | ||
12 | -extern int slirp_debug; | 10 | +#ifdef DEBUG |
13 | 11 | ||
14 | #define DBG_CALL 0x1 | 12 | #define DBG_CALL 0x1 |
15 | #define DBG_MISC 0x2 | 13 | #define DBG_MISC 0x2 |
16 | #define DBG_ERROR 0x4 | 14 | #define DBG_ERROR 0x4 |
17 | -#define DEBUG_DEFAULT DBG_CALL|DBG_MISC|DBG_ERROR | ||
18 | 15 | ||
19 | -#ifdef DEBUG | 16 | +#define dfd stderr |
17 | + | ||
18 | +extern int slirp_debug; | ||
19 | + | ||
20 | #define DEBUG_CALL(x) if (slirp_debug & DBG_CALL) { fprintf(dfd, "%s...\n", x); fflush(dfd); } | 20 | #define DEBUG_CALL(x) if (slirp_debug & DBG_CALL) { fprintf(dfd, "%s...\n", x); fflush(dfd); } |
21 | #define DEBUG_ARG(x, y) if (slirp_debug & DBG_CALL) { fputc(' ', dfd); fprintf(dfd, x, y); fputc('\n', dfd); fflush(dfd); } | 21 | #define DEBUG_ARG(x, y) if (slirp_debug & DBG_CALL) { fputc(' ', dfd); fprintf(dfd, x, y); fputc('\n', dfd); fflush(dfd); } |
22 | #define DEBUG_ARGS(x) if (slirp_debug & DBG_CALL) { fprintf x ; fflush(dfd); } | 22 | #define DEBUG_ARGS(x) if (slirp_debug & DBG_CALL) { fprintf x ; fflush(dfd); } |
23 | #define DEBUG_MISC(x) if (slirp_debug & DBG_MISC) { fprintf x ; fflush(dfd); } | 23 | #define DEBUG_MISC(x) if (slirp_debug & DBG_MISC) { fprintf x ; fflush(dfd); } |
24 | #define DEBUG_ERROR(x) if (slirp_debug & DBG_ERROR) {fprintf x ; fflush(dfd); } | 24 | #define DEBUG_ERROR(x) if (slirp_debug & DBG_ERROR) {fprintf x ; fflush(dfd); } |
25 | 25 | ||
26 | - | ||
27 | #else | 26 | #else |
28 | 27 | ||
29 | #define DEBUG_CALL(x) | 28 | #define DEBUG_CALL(x) |
@@ -33,5 +32,3 @@ extern int slirp_debug; | @@ -33,5 +32,3 @@ extern int slirp_debug; | ||
33 | #define DEBUG_ERROR(x) | 32 | #define DEBUG_ERROR(x) |
34 | 33 | ||
35 | #endif | 34 | #endif |
36 | - | ||
37 | -void debug_init _P((char *, int)); |
slirp/misc.c
slirp/slirp.h
slirp/socket.c
@@ -584,7 +584,8 @@ tcp_listen(u_int32_t haddr, u_int hport, u_int32_t laddr, u_int lport, int flags | @@ -584,7 +584,8 @@ tcp_listen(u_int32_t haddr, u_int hport, u_int32_t laddr, u_int lport, int flags | ||
584 | socklen_t addrlen = sizeof(addr); | 584 | socklen_t addrlen = sizeof(addr); |
585 | 585 | ||
586 | DEBUG_CALL("tcp_listen"); | 586 | DEBUG_CALL("tcp_listen"); |
587 | - DEBUG_ARG("port = %d", port); | 587 | + DEBUG_ARG("haddr = %x", haddr); |
588 | + DEBUG_ARG("hport = %d", hport); | ||
588 | DEBUG_ARG("laddr = %x", laddr); | 589 | DEBUG_ARG("laddr = %x", laddr); |
589 | DEBUG_ARG("lport = %d", lport); | 590 | DEBUG_ARG("lport = %d", lport); |
590 | DEBUG_ARG("flags = %x", flags); | 591 | DEBUG_ARG("flags = %x", flags); |