Commit 6da16dc8 authored by Orgad Shaneh's avatar Orgad Shaneh Committed by Orgad Shaneh
Browse files

Upgrade to GDB 7.6.1



Change-Id: I9865d7d941719ddc228b6e4dea9abf0d702e3653
Reviewed-by: default avatarhjk <hjk121@nokiamail.com>
Reviewed-by: default avatarDavid Schulz <david.schulz@digia.com>
parent 05d4b44b
......@@ -5,7 +5,7 @@ staging=${broot}/staging
pyversion=2.7
expatversion=2.0.1
arch=`uname -sm | sed 's/ /-/g' | tr A-Z a-z`
version=7.5
version=7.6.1
targetdir=${broot}/qtcreator-gdb-${version}
gdbtargets=$(addprefix ${targetdir}/gdb-, ${targets})
packagename=qtcreator-gdb-${version}-${arch}.tar.gz
......@@ -67,7 +67,7 @@ ${staging}/gdb-${version}/configure: ${source}/gdb-${version}.tar.bz2 | makestag
tar xf ${source}/gdb-${version}.tar.bz2 && \
cd gdb-${version} && \
touch configure && \
patch -p2 < ${broot}/patches/pythonhome-7.4.patch && \
patch -p1 < ${broot}/patches/pythonhome.patch && \
patch -p2 < ${broot}/patches/gdb-ipv6.patch
${gdbtargets}: ${targetdir}/gdb-%: ${staging}/gdb-${version}/configure ${staging}/lib/libpython${pyversion}.a ${staging}/lib/libexpat.a | maketargetdir
......
......@@ -6,10 +6,10 @@ pyversion=2.7
pydir=${broot}/python
expatversion=2.0.1
iconvversion=1.14
version=7.5
version=7.6.1
targetdir=${broot}/qtcreator-gdb-${version}
gdbtargets=$(addprefix ${targetdir}/gdb-, ${targets})
packageparts=${targetdir}/lib ${targetdir}/lib ${targetdir}/libiconv-2.dll ${targetdir}/python27.dll ${targetdir}/libexpat-1.dll
packageparts=${targetdir}/lib ${targetdir}/data-directory ${targetdir}/libiconv-2.dll ${targetdir}/python27.dll ${targetdir}/libexpat-1.dll
arch=`uname -sm | sed 's/ /-/g' | tr A-Z a-z`
packagename=qtcreator-gdb-${version}-${arch}.tar.gz
......@@ -73,14 +73,15 @@ ${staging}/gdb-${version}/configure: ${source}/gdb-${version}.tar.bz2 | makestag
tar xf ${source}/gdb-${version}.tar.bz2 && \
cd gdb-${version} && \
touch configure && \
patch -p2 < ${broot}/patches/gdb-ipv6.patch
patch -p2 < ${broot}/patches/gdb-ipv6.patch && \
patch -p1 < ${broot}/patches/datadir.patch
${staging}/lib/libiconv.a: ${source}/libiconv-${iconvversion}.tar.gz | makestagingdir
cd ${staging} && \
echo "Extracting iconv..." && \
tar xf ${source}/libiconv-${iconvversion}.tar.gz && \
cd libiconv-${iconvversion} && \
./configure -prefix=${staging} --enable-static && \
./configure -prefix=${staging} --enable-static --build=i686-pc-mingw32 && \
${MAKE} && ${MAKE} install
${staging}/lib/libexpat.a: ${source}/expat-${expatversion}.tar.gz | makestagingdir
......@@ -88,7 +89,7 @@ ${staging}/lib/libexpat.a: ${source}/expat-${expatversion}.tar.gz | makestagingd
echo "Extracting expat..." && \
tar xf ${source}/expat-${expatversion}.tar.gz && \
cd expat-${expatversion} && \
./configure -prefix=${staging} --enable-static && \
./configure -prefix=${staging} --enable-static --build=i686-pc-mingw32 && \
${MAKE} && ${MAKE} install
${gdbtargets}: ${targetdir}/gdb-%: ${staging}/lib/libexpat.a ${staging}/lib/libiconv.a ${staging}/gdb-${version}/configure | maketargetdir ${broot}/python/python.exe
......@@ -97,7 +98,7 @@ ${gdbtargets}: ${targetdir}/gdb-%: ${staging}/lib/libexpat.a ${staging}/lib/libi
LDFLAGS="L${pydir} -lpthread -ldl -lutil -lpython27" && \
CFLAGS="-I${pydir}/include" && \
cd ${staging}/gdb-${version}-$* && \
${staging}/gdb-${version}/configure --target=$* --disable-nls --disable-werror \
${staging}/gdb-${version}/configure --target=$* --disable-nls --disable-werror --build=i686-pc-mingw32 \
--with-libiconv-prefix=${staging} \
--with-expat --with-libexpat-prefix=${staging} \
--with-separate-debug-dir="" \
......@@ -110,6 +111,8 @@ package: ${gdbtargets} ${broot}/python/python.exe
cp ${staging}/bin/libexpat* ${targetdir} && \
cp ${pydir}/python*.dll ${targetdir} && \
cp -r ${pydir}/lib ${targetdir} && \
mkdir -p ${targetdir}/data-directory && \
cp -r ${staging}/gdb-${version}-i686-pc-mingw32/gdb/data-directory/{python,syscalls} ${targetdir}/data-directory && \
mv ${targetdir} ${targetdir}-${arch} && \
echo "Packing..." && \
tar czf ${packagename} qtcreator-gdb-${version}-${arch} && \
......
......@@ -5,7 +5,7 @@ staging=${broot}/staging
pyversion=2.7
expatversion=2.0.1
arch=`uname -sm | sed 's/ /-/g' | tr A-Z a-z`
version=7.5
version=7.6.1
targetdir=${broot}/qtcreator-gdb-${version}
gdbtargets=$(addprefix ${targetdir}/gdb-, ${targets})
packagename=qtcreator-gdb-${version}-${arch}.tar.gz
......
Source: http://sourceware-org.1504.n7.nabble.com/PATCH-Try-to-initialize-data-directory-by-first-searching-for-quot-data-directory-quot-in-the-same-dy-td73462.html
orgads: Removed last dir separator before calling stat
diff --git a/gdb/main.c b/gdb/main.c
--- a/gdb/main.c
+++ b/gdb/main.c
@@ -98,17 +98,38 @@ static char *gdb_program_name;
static void print_gdb_help (struct ui_file *);
-/* Relocate a file or directory. PROGNAME is the name by which gdb
- was invoked (i.e., argv[0]). INITIAL is the default value for the
- file or directory. FLAG is true if the value is relocatable, false
- otherwise. Returns a newly allocated string; this may return NULL
- under the same conditions as make_relative_prefix. */
+/* Relocate a file or directory, checking if it exists. PROGNAME is the
+ name by which gdb was invoked (i.e., argv[0]). INITIAL is the default
+ value for the file or directory. ISDIR is true if INITIAL is a
+ directory. FLAG is true if the value is relocatable, false otherwise.
+ Returns a newly allocated string; this may return NULL under the same
+ conditions as make_relative_prefix, or if the relocated path does not
+ exist. */
static char *
-relocate_path (const char *progname, const char *initial, int flag)
+relocate_path (const char *progname, const char *initial, int isdir,
+ int flag)
{
if (flag)
- return make_relative_prefix (progname, BINDIR, initial);
+ {
+ char *path;
+ path = make_relative_prefix (progname, BINDIR, initial);
+ if (path)
+ {
+ struct stat s;
+
+ char *last = path + strlen(path) - 1;
+ if (IS_DIR_SEPARATOR(*last))
+ *last = '\0';
+
+ if (*path == 0 || stat (path, &s) != 0 || (!isdir != !S_ISDIR (s.st_mode)))
+ {
+ xfree (path);
+ path = NULL;
+ }
+ }
+ return path;
+ }
return xstrdup (initial);
}
@@ -123,19 +144,52 @@ relocate_gdb_directory (const char *init
{
char *dir;
- dir = relocate_path (gdb_program_name, initial, flag);
- if (dir)
+ dir = relocate_path (gdb_program_name, initial, 1, flag);
+ if (!dir)
+ dir = xstrdup (initial);
+
+ /* Canonicalize the directory. */
+ if (*dir)
{
- struct stat s;
+ char *canon_sysroot = lrealpath (dir);
- if (*dir == '\0' || stat (dir, &s) != 0 || !S_ISDIR (s.st_mode))
+ if (canon_sysroot)
{
xfree (dir);
- dir = NULL;
+ dir = canon_sysroot;
}
}
+
+ return dir;
+}
+
+/* Like relocate_gdb_path, but specifically for data-directory. */
+
+static char *
+relocate_gdb_data_directory (void)
+{
+ char *dir;
+
+ /* First try to find "data-directory" in the same directory as gdb.
+
+ Use relocate_path only to resolve the parent directory of
+ gdb_program_name (i.e., based on PATH if necessary); relocate_path
+ (gdb_program_name, BINDIR "/data-directory") cannot be used to resolve
+ data-directory as it returns a path relative to the _grandparent
+ directory_ of gdb_program_name (munging the parent directory). */
+
+ dir = relocate_path (gdb_program_name, BINDIR, 1, 1);
+ if (dir)
+ dir = reconcat (dir, dir, SLASH_STRING, "data-directory", NULL);
+
+ /* Then try to find GDB_DATADIR relocated relative to gdb. */
if (!dir)
- dir = xstrdup (initial);
+ dir = relocate_path (gdb_program_name, GDB_DATADIR, 1,
+ GDB_DATADIR_RELOCATABLE);
+
+ /* Otherwise use GDB_DATADIR as is. */
+ if (!dir)
+ dir = xstrdup (GDB_DATADIR);
/* Canonicalize the directory. */
if (*dir)
@@ -169,7 +223,7 @@ get_init_files (char **system_gdbinit,
if (!initialized)
{
- struct stat homebuf, cwdbuf, s;
+ struct stat homebuf, cwdbuf;
char *homedir;
if (SYSTEM_GDBINIT[0])
@@ -200,9 +254,10 @@ get_init_files (char **system_gdbinit,
{
relocated_sysgdbinit = relocate_path (gdb_program_name,
SYSTEM_GDBINIT,
+ 0,
SYSTEM_GDBINIT_RELOCATABLE);
}
- if (relocated_sysgdbinit && stat (relocated_sysgdbinit, &s) == 0)
+ if (relocated_sysgdbinit)
sysgdbinit = relocated_sysgdbinit;
else
xfree (relocated_sysgdbinit);
@@ -404,8 +459,7 @@ captured_main (void *data)
debug_file_directory = relocate_gdb_directory (DEBUGDIR,
DEBUGDIR_RELOCATABLE);
- gdb_datadir = relocate_gdb_directory (GDB_DATADIR,
- GDB_DATADIR_RELOCATABLE);
+ gdb_datadir = relocate_gdb_data_directory ();
#ifdef WITH_PYTHON_PATH
{
diff -Nru a/gdb-7.5.1/gdb/gdbserver/gdbreplay.c b/gdb-7.5.1/gdb/gdbserver/gdbreplay.c
--- a/gdb-7.5.1/gdb/gdbserver/gdbreplay.c 2012-08-22 13:05:02 -0700
+++ b/gdb-7.5.1/gdb/gdbserver/gdbreplay.c 2013-04-15 03:20:40 -0700
@@ -190,14 +190,41 @@
diff -Nru a/gdb-7.6.1/gdb/gdbserver/gdbreplay.c b/gdb-7.6.1/gdb/gdbserver/gdbreplay.c
--- a/gdb-7.6.1/gdb/gdbserver/gdbreplay.c 2012-08-22 13:05:02 -0700
+++ b/gdb-7.6.1/gdb/gdbserver/gdbreplay.c 2013-04-15 03:20:40 -0700
@@ -189,14 +189,41 @@ remote_close (void)
static void
remote_open (char *name)
{
......@@ -47,9 +47,9 @@ diff -Nru a/gdb-7.5.1/gdb/gdbserver/gdbreplay.c b/gdb-7.5.1/gdb/gdbserver/gdbrep
#ifdef USE_WIN32API
static int winsock_initialized;
#endif
diff -Nru a/gdb-7.5.1/gdb/gdbserver/remote-utils.c b/gdb-7.5.1/gdb/gdbserver/remote-utils.c
--- a/gdb-7.5.1/gdb/gdbserver/remote-utils.c 2012-04-28 23:28:30 -0700
+++ b/gdb-7.5.1/gdb/gdbserver/remote-utils.c 2013-04-16 06:25:07 -0700
diff -Nru a/gdb-7.6.1/gdb/gdbserver/remote-utils.c b/gdb-7.6.1/gdb/gdbserver/remote-utils.c
--- a/gdb-7.6.1/gdb/gdbserver/remote-utils.c 2012-04-28 23:28:30 -0700
+++ b/gdb-7.6.1/gdb/gdbserver/remote-utils.c 2013-04-16 06:25:07 -0700
@@ -16,6 +16,8 @@
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>. */
......@@ -76,8 +76,8 @@ diff -Nru a/gdb-7.5.1/gdb/gdbserver/remote-utils.c b/gdb-7.5.1/gdb/gdbserver/rem
@@ -109,7 +118,7 @@
static int remote_is_stdio = 0;
static gdb_fildes_t remote_desc = INVALID_DESCRIPTOR;
-static gdb_fildes_t listen_desc = INVALID_DESCRIPTOR;
gdb_fildes_t remote_desc = INVALID_DESCRIPTOR;
-gdb_fildes_t listen_desc = INVALID_DESCRIPTOR;
+gdb_fildes_t *listening_sockets = NULL;
/* FIXME headerize? */
......@@ -474,10 +474,10 @@ diff -Nru a/gdb-7.5.1/gdb/gdbserver/remote-utils.c b/gdb-7.5.1/gdb/gdbserver/rem
}
}
diff -Nru a/gdb-7.5.1/gdb/ser-tcp.c b/gdb-7.5.1/gdb/ser-tcp.c
--- a/gdb-7.5.1/gdb/ser-tcp.c 2012-01-04 00:17:10 -0800
+++ b/gdb-7.5.1/gdb/ser-tcp.c 2013-04-15 03:20:40 -0700
@@ -38,7 +38,9 @@
diff -Nru a/gdb-7.6.1/gdb/ser-tcp.c b/gdb-7.6.1/gdb/ser-tcp.c
--- a/gdb-7.6.1/gdb/ser-tcp.c 2012-01-04 00:17:10 -0800
+++ b/gdb-7.6.1/gdb/ser-tcp.c 2013-04-15 03:20:40 -0700
@@ -37,7 +37,9 @@
#include <sys/time.h>
#ifdef USE_WIN32API
......@@ -487,7 +487,7 @@ diff -Nru a/gdb-7.5.1/gdb/ser-tcp.c b/gdb-7.5.1/gdb/ser-tcp.c
#ifndef ETIMEDOUT
#define ETIMEDOUT WSAETIMEDOUT
#endif
@@ -50,6 +52,7 @@
@@ -49,6 +51,7 @@
#include <netdb.h>
#include <sys/socket.h>
#include <netinet/tcp.h>
......@@ -495,7 +495,7 @@ diff -Nru a/gdb-7.5.1/gdb/ser-tcp.c b/gdb-7.5.1/gdb/ser-tcp.c
#endif
#include <signal.h>
@@ -79,76 +82,49 @@
@@ -78,76 +81,49 @@ static unsigned int tcp_retry_limit = 15
#define POLL_INTERVAL 5
......@@ -609,7 +609,7 @@ diff -Nru a/gdb-7.5.1/gdb/ser-tcp.c b/gdb-7.5.1/gdb/ser-tcp.c
}
/* Open a tcp socket. */
@@ -156,18 +132,24 @@
@@ -155,18 +131,24 @@ wait_for_connect (struct serial *scb, in
int
net_open (struct serial *scb, const char *name)
{
......@@ -637,7 +637,7 @@ diff -Nru a/gdb-7.5.1/gdb/ser-tcp.c b/gdb-7.5.1/gdb/ser-tcp.c
use_udp = 0;
if (strncmp (name, "udp:", 4) == 0)
{
@@ -177,134 +159,286 @@
@@ -176,134 +158,286 @@ net_open (struct serial *scb, const char
else if (strncmp (name, "tcp:", 4) == 0)
name = name + 4;
......
*** source/gdb-7.4/gdb/python/python.c 2012-02-01 10:39:59.812953656 +0100
--- staging/gdb-7.4/gdb/python/python.c 2012-02-01 10:33:45.842953480 +0100
***************
*** 32,38 ****
#include "serial.h"
#include "readline/tilde.h"
#include "python.h"
!
#include <ctype.h>
/* Declared constants and enum for python stack printing. */
--- 32,38 ----
#include "serial.h"
#include "readline/tilde.h"
#include "python.h"
! #include <libgen.h>
#include <ctype.h>
/* Declared constants and enum for python stack printing. */
***************
*** 1273,1278 ****
--- 1273,1288 ----
SLASH_STRING, "python", NULL));
#endif
+
+ char readlinkbuffer[BUFSIZ];
+ int readlinks = readlink("/proc/self/exe", readlinkbuffer, BUFSIZ - 1);
+ readlinkbuffer[readlinks] = 0;
+ char *executeablepath = dirname(readlinkbuffer);
+ char *pythonhome = malloc(strlen(executeablepath) + strlen("/python/") + 2);
+ strcpy(pythonhome, executeablepath);
+ strcat(pythonhome, "/python/");
+ setenv("PYTHONHOME", pythonhome, 1);
+
Py_Initialize ();
PyEval_InitThreads ();
--- a/gdb/python/python.c 2013-03-28 18:46:53.000000000 +0200
+++ b/gdb/python/python.c 2013-10-27 05:28:35.761204091 +0200
@@ -1568,6 +1568,16 @@ message == an error message without a st
#endif
#endif
+
+ char readlinkbuffer[BUFSIZ];
+ int readlinks = readlink("/proc/self/exe", readlinkbuffer, BUFSIZ - 1);
+ readlinkbuffer[readlinks] = 0;
+ char *executeablepath = dirname(readlinkbuffer);
+ char *pythonhome = malloc(strlen(executeablepath) + strlen("/python/") + 2);
+ strcpy(pythonhome, executeablepath);
+ strcat(pythonhome, "/python/");
+ setenv("PYTHONHOME", pythonhome, 1);
+
Py_Initialize ();
PyEval_InitThreads ();
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment