diff options
author | Pedro Alves <palves@redhat.com> | 2015-03-07 17:30:46 +0000 |
---|---|---|
committer | Pedro Alves <palves@redhat.com> | 2015-03-07 17:30:46 +0000 |
commit | 366c75fc9183e46fe151aefb40f2d55a17815cb7 (patch) | |
tree | 46a0b48ae8dcf84e1317b870e87a66472f2b637d /gdb/common/agent.c | |
parent | 72df25b28d68fd0b903380ceb06c6b5866eab453 (diff) | |
download | gdb-366c75fc9183e46fe151aefb40f2d55a17815cb7.zip gdb-366c75fc9183e46fe151aefb40f2d55a17815cb7.tar.gz gdb-366c75fc9183e46fe151aefb40f2d55a17815cb7.tar.bz2 |
Fix struct sockaddr/sockaddr_in/sockaddr_un strict aliasing violations
Building gdbserver in C++ mode shows:
gdb/gdbserver/tracepoint.c: In function ‘void* gdb_agent_helper_thread(void*)’:
gdb/gdbserver/tracepoint.c:7190:47: error: cannot convert ‘sockaddr_un*’ to ‘sockaddr*’ for argument ‘2’ to ‘int accept(int, sockaddr*, socklen_t*)’
fd = accept (listen_fd, &sockaddr, &tmp);
A few places in the tree already have an explicit cast to struct
sockaddr *, but that's a strict aliasing violation. Instead of
propagating invalid code, fix this by using a union instead.
gdb/ChangeLog:
2015-03-07 Pedro Alves <palves@redhat.com>
* common/gdb_socket.h: New file.
* ser-tcp.c: Include gdb_socket.h. Don't include netinet/in.h nor
sys/socket.h.
(net_open): Use union gdb_sockaddr_u.
gdb/gdbserver/ChangeLog:
2015-03-07 Pedro Alves <palves@redhat.com>
* gdbreplay.c: No longer include <netinet/in.h>, <sys/socket.h>,
or <winsock2.h> here. Instead include "gdb_socket.h".
(remote_open): Use union gdb_sockaddr_u.
* remote-utils.c: No longer include <netinet/in.h>, <sys/socket.h>
or <winsock2.h> here. Instead include "gdb_socket.h".
(handle_accept_event, remote_prepare): Use union gdb_sockaddr_u.
* tracepoint.c: Include "gdb_socket.h" instead of <sys/socket.h>
or <sys/un.h>.
(init_named_socket, gdb_agent_helper_thread): Use union
gdb_sockaddr_u.
Diffstat (limited to 'gdb/common/agent.c')
0 files changed, 0 insertions, 0 deletions