components/gdb/patches/001-fix-proc-name-size.patch
author April Chin <april.chin@oracle.com>
Wed, 19 Apr 2017 14:37:55 -0700
changeset 7939 a0c0b8aac8d4
parent 6420 components/gdb/patches/gdb.procfs.c.patch@65948e9e205b
permissions -rw-r--r--
25137614 gdb is not able to debug PIE executables on sparc

#
# Fix the size of the pathname for /proc files.
# In Solaris, PID_MAX is 999999 (6 digit pid).
# In Solaris, lwpid_t is an unsigned int, so theoretically the lwp id
# could be 10 digits.
# Patch will be submitted upstream.
#

--- gdb-7.12.1-orig/gdb/procfs.c	2017-01-21 05:48:42.000000000 -0800
+++ gdb-7.12.1/gdb/procfs.c	2017-04-19 10:28:43.395097240 -0700
@@ -341,7 +341,7 @@ typedef siginfo_t gdb_siginfo_t;
 #  define AS_PROC_NAME_FMT     "/proc/%d/as"
 #  define MAP_PROC_NAME_FMT    "/proc/%d/map"
 #  define STATUS_PROC_NAME_FMT "/proc/%d/status"
-#  define MAX_PROC_NAME_SIZE sizeof("/proc/99999/lwp/8096/lstatus")
+#  define MAX_PROC_NAME_SIZE sizeof("/proc/0123456789/lwp/0123456789/lwpstatus")
 # endif
 /* the name of the proc status struct depends on the implementation */
 typedef pstatus_t   gdb_prstatus_t;
@@ -712,7 +712,7 @@ create_procinfo (int pid, int tid)
   else
     {
 #ifdef NEW_PROC_API
-      sprintf (pi->pathname, "/proc/%05d/lwp/%d", pid, tid);
+      sprintf (pi->pathname, "/proc/%d/lwp/%d", pid, tid);
 #else
       sprintf (pi->pathname, MAIN_PROC_NAME_FMT, pid);
 #endif