summaryrefslogtreecommitdiff
path: root/gdb/gdbserver
diff options
context:
space:
mode:
authorPedro Alves <palves@redhat.com>2013-07-01 11:28:29 +0000
committerPedro Alves <palves@redhat.com>2013-07-01 11:28:29 +0000
commit212fe135e533bb0e9667e42d7e3cbba5a12e1c7c (patch)
treee685c47d503838682ace1dcaaecc3efa8d619116 /gdb/gdbserver
parent598d98c728f9024c1ef584f4c966d42b3b3e2dc2 (diff)
downloadgdb-212fe135e533bb0e9667e42d7e3cbba5a12e1c7c.tar.gz
Normalize on PATH_MAX instead of MAXPATHLEN throughout.
With the pathmax gnulib module in place, we can use PATH_MAX consistently throughout, instead of the current mixbag of PATH_MAX and MAXPATHLEN uses. It's no longer necessary to include sys/param.h (supposedly, I can't check all ports touched here) for MAXPATHLEN. Don't remove sys/param.h from GDB's configure.ac, as later tests in the file use HAVE_SYS_PARAM_H checks. Tested on x86_64 Fedora 17. Also cross-built for --host=i686-w64-mingw32, and --host=i586-pc-msdosdjgpp. gdb/ 2013-07-01 Pedro Alves <palves@redhat.com> * defs.h: Include "pathmax.h". * utils.c: Don't include sys/param.h. (gdb_realpath): Remove code that checks for MAXPATHLEN. * solib-ia64-hpux.c (ia64_hpux_handle_load_event): Use PATH_MAX instead of MAXPATHLEN. * solib-sunos.c: Don't include sys/param.h. * xcoffread.c: Don't include sys/param.h. * bsd-kvm.c: Don't include sys/param.h. * darwin-nat.c: Don't include sys/param.h. (darwin_pid_to_exec_file): Use PATH_MAX instead of MAXPATHLEN. * darwin-nat-info.c: Don't include sys/param.h. * fbsd-nat.c (fbsd_pid_to_exec_file): Use PATH_MAX instead of MAXPATHLEN. * i386obsd-nat.c: Don't include sys/param.h. * inf-child.c: Don't include sys/param.h. (inf_child_fileio_readlink): Use PATH_MAX instead of MAXPATHLEN. * linux-fork.c: Don't include sys/param.h. (fork_save_infrun_state): Use PATH_MAX instead of MAXPATHLEN. * linux-nat.c: Don't include sys/param.h. (linux_child_pid_to_exec_file, linux_proc_pending_signals) (linux_proc_pending_signals): Use PATH_MAX instead of MAXPATHLEN. * m68klinux-nat.c: Don't include sys/param.h. * nbsd-nat.c: Don't include sys/param.h. (nbsd_pid_to_exec_file): Use PATH_MAX instead of MAXPATHLEN. * ppc-linux-nat.c: Don't include sys/param.h. * rs6000-nat.c: Don't include sys/param.h. * spu-linux-nat.c. Don't include sys/param.h. * windows-nat.c: Don't include sys/param.h. * xtensa-linux-nat.c: Don't include sys/param.h. * config/i386/nm-fbsd.h: Don't include sys/param.h. gdb/gdbserver/ 2013-07-01 Pedro Alves <palves@redhat.com> * server.h: Include "pathmax.h". * linux-low.c: Don't include sys/param.h. (linux_pid_exe_is_elf_64_file): Use PATH_MAX instead of MAXPATHLEN. * win32-low.c: Don't include sys/param.h. (win32_create_inferior): Use PATH_MAX instead of MAXPATHLEN.
Diffstat (limited to 'gdb/gdbserver')
-rw-r--r--gdb/gdbserver/ChangeLog9
-rw-r--r--gdb/gdbserver/linux-low.c3
-rw-r--r--gdb/gdbserver/server.h3
-rw-r--r--gdb/gdbserver/win32-low.c6
4 files changed, 15 insertions, 6 deletions
diff --git a/gdb/gdbserver/ChangeLog b/gdb/gdbserver/ChangeLog
index 11ae9f3c2ed..4e7fe005859 100644
--- a/gdb/gdbserver/ChangeLog
+++ b/gdb/gdbserver/ChangeLog
@@ -1,5 +1,14 @@
2013-07-01 Pedro Alves <palves@redhat.com>
+ * server.h: Include "pathmax.h".
+ * linux-low.c: Don't include sys/param.h.
+ (linux_pid_exe_is_elf_64_file): Use PATH_MAX instead of
+ MAXPATHLEN.
+ * win32-low.c: Don't include sys/param.h.
+ (win32_create_inferior): Use PATH_MAX instead of MAXPATHLEN.
+
+2013-07-01 Pedro Alves <palves@redhat.com>
+
* event-loop.c: Don't check HAVE_UNISTD_H before including
<unistd.h>.
* gdbreplay.c: Likewise.
diff --git a/gdb/gdbserver/linux-low.c b/gdb/gdbserver/linux-low.c
index bb7298a4da3..47ea76d19fc 100644
--- a/gdb/gdbserver/linux-low.c
+++ b/gdb/gdbserver/linux-low.c
@@ -23,7 +23,6 @@
#include "gdb_wait.h"
#include <stdio.h>
-#include <sys/param.h>
#include <sys/ptrace.h>
#include "linux-ptrace.h"
#include "linux-procfs.h"
@@ -342,7 +341,7 @@ elf_64_file_p (const char *file, unsigned int *machine)
int
linux_pid_exe_is_elf_64_file (int pid, unsigned int *machine)
{
- char file[MAXPATHLEN];
+ char file[PATH_MAX];
sprintf (file, "/proc/%d/exe", pid);
return elf_64_file_p (file, machine);
diff --git a/gdb/gdbserver/server.h b/gdb/gdbserver/server.h
index c68c6515c08..1a1d9b26132 100644
--- a/gdb/gdbserver/server.h
+++ b/gdb/gdbserver/server.h
@@ -38,6 +38,9 @@
#endif
#include <setjmp.h>
+/* For gnulib's PATH_MAX. */
+#include "pathmax.h"
+
#ifdef HAVE_STRING_H
#include <string.h>
#endif
diff --git a/gdb/gdbserver/win32-low.c b/gdb/gdbserver/win32-low.c
index d1caa730960..30fd1e74e91 100644
--- a/gdb/gdbserver/win32-low.c
+++ b/gdb/gdbserver/win32-low.c
@@ -32,7 +32,6 @@
#include <imagehlp.h>
#include <tlhelp32.h>
#include <psapi.h>
-#include <sys/param.h>
#include <process.h>
#ifndef USE_WIN32API
@@ -515,7 +514,7 @@ static int
win32_create_inferior (char *program, char **program_args)
{
#ifndef USE_WIN32API
- char real_path[MAXPATHLEN];
+ char real_path[PATH_MAX];
char *orig_path, *new_path, *path_ptr;
#endif
BOOL ret;
@@ -546,8 +545,7 @@ win32_create_inferior (char *program, char **program_args)
cygwin_conv_path_list (CCP_POSIX_TO_WIN_A, path_ptr, new_path, size);
setenv ("PATH", new_path, 1);
}
- cygwin_conv_path (CCP_POSIX_TO_WIN_A, program, real_path,
- MAXPATHLEN);
+ cygwin_conv_path (CCP_POSIX_TO_WIN_A, program, real_path, PATH_MAX);
program = real_path;
#endif