Skip to content

Commit d7e51e2

Browse files
committed
Fix bugs in popen mode
1 parent 11cb0ec commit d7e51e2

File tree

2 files changed

+10
-4
lines changed

2 files changed

+10
-4
lines changed

src/command.c

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,10 @@ size_t get_address(int pid, char *search)
7373
}
7474
close(fd);
7575
}
76+
else
77+
{
78+
warning_printf("%s open failed.\n", buf);
79+
}
7680
return result;
7781
}
7882

@@ -106,8 +110,6 @@ int command_handler()
106110
}
107111
clientPort = ntohs(client_addr.sin6_port);
108112

109-
debug_printf("Receive %s:%d from command_sock\n", ip_buf, clientPort);
110-
111113
command = buf[0];
112114
switch(command)
113115
{
@@ -121,6 +123,7 @@ int command_handler()
121123

122124
break;
123125
case COMMAND_GDBSERVER_ATTACH:
126+
debug_printf("Receive %s:%d from command_sock to COMMAND_GDBSERVER_ATTACH\n", ip_buf, clientPort);
124127
if(gdb_client_address.sin6_family)
125128
{
126129
if(arg_opt_p)
@@ -174,6 +177,7 @@ int command_handler()
174177

175178
break;
176179
case COMMAND_STRACE_ATTACH:
180+
debug_printf("Receive %s:%d from command_sock to COMMAND_STRACE_ATTACH\n", ip_buf, clientPort);
177181
if(arg_opt_p)
178182
{
179183
pid = arg_pid;
@@ -212,8 +216,9 @@ int command_handler()
212216

213217
break;
214218
case COMMAND_GET_ADDRESS:
219+
debug_printf("Receive %s:%d from command_sock to COMMAND_GET_ADDRESS\n", ip_buf, clientPort);
215220
addr = 0;
216-
if(arg_opt_p)
221+
if(arg_opt_o)
217222
{
218223
addr = get_address(popen_to_int(arg_popen), buf + 2);
219224
}
@@ -235,6 +240,7 @@ int command_handler()
235240
warning_printf("Receive COMMAND_GDB_LOGOUT from %s:%d\n", ip_buf, clientPort);
236241
break;
237242
case COMMAND_RUN_SERVICE:
243+
debug_printf("Receive %s:%d from command_sock to COMMAND_RUN_SERVICE\n", ip_buf, clientPort);
238244
start_service(0);
239245

240246
client_addr_size = sizeof(client_addr);

src/debug-server.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
#define COMMAND_PORT 9545
66
#define GDBSERVER_PORT 9549
77

8-
#define VERSION "1.3.2"
8+
#define VERSION "1.3.3"
99

1010
#define COMMAND_GDB_REGISTER 0x01
1111
#define COMMAND_GDBSERVER_ATTACH 0x02

0 commit comments

Comments
 (0)