aboutsummaryrefslogtreecommitdiff
path: root/gdb/gdbserver
diff options
context:
space:
mode:
authorDoug Evans <dje@google.com>2012-08-08 19:48:19 +0000
committerDoug Evans <dje@google.com>2012-08-08 19:48:19 +0000
commite6712ff1b5f9f440889f298b326a12325d919680 (patch)
tree19a392fd5da376b4950d15664c0485b497a90744 /gdb/gdbserver
parentab854e54510727ba4db85875159f796e652e0b54 (diff)
downloadgdb-e6712ff1b5f9f440889f298b326a12325d919680.zip
gdb-e6712ff1b5f9f440889f298b326a12325d919680.tar.gz
gdb-e6712ff1b5f9f440889f298b326a12325d919680.tar.bz2
* gdb_string.h: Moved to ...
* common/gdb_string.h: ... here. * common/vec.h: Remove #ifndef GDBSERVER conditional inclusion of gdb_string.h and gdb_assert.h. gdbserver/ * configure.ac: Add check for strstr. * config.in: Regenerate. * configure: Regenerate. * linux-thread-db.c: #include "gdb_vecs.h". (try_thread_db_load_from_pdir_1): New arg "subdir". All callers updated. (try_thread_db_load_from_pdir): New arg "subdir". All callers updated. (thread_db_load_search): Use a vector to iterate over path elements. Handle text appearing after "$pdir". gdbserver/ * Makefile.in (SFILES): Add gdb_vecs.c. (OBS): Add gdb_vecs.o. (gdb_vecs_h, host_defs_h): New variables. (thread-db.o): Add $(gdb_vecs_h) dependency. (gdb_vecs.o): New rule. * thread-db.c: #include "gdb_vecs.h". (thread_db_load_search): Use a vector to iterate over path elements. Handle text appearing after "$pdir".
Diffstat (limited to 'gdb/gdbserver')
-rw-r--r--gdb/gdbserver/ChangeLog15
-rw-r--r--gdb/gdbserver/Makefile.in11
-rw-r--r--gdb/gdbserver/config.in4
-rwxr-xr-xgdb/gdbserver/configure10
-rw-r--r--gdb/gdbserver/configure.ac2
-rw-r--r--gdb/gdbserver/thread-db.c34
6 files changed, 52 insertions, 24 deletions
diff --git a/gdb/gdbserver/ChangeLog b/gdb/gdbserver/ChangeLog
index d446361..5707850 100644
--- a/gdb/gdbserver/ChangeLog
+++ b/gdb/gdbserver/ChangeLog
@@ -1,3 +1,18 @@
+2012-08-08 Doug Evans <dje@google.com>
+
+ * Makefile.in (SFILES): Add gdb_vecs.c.
+ (OBS): Add gdb_vecs.o.
+ (gdb_vecs_h, host_defs_h): New variables.
+ (thread-db.o): Add $(gdb_vecs_h) dependency.
+ (gdb_vecs.o): New rule.
+ * thread-db.c: #include "gdb_vecs.h".
+ (thread_db_load_search): Use a vector to iterate over path elements.
+ Handle text appearing after "$pdir".
+
+ * configure.ac: Add check for strstr.
+ * config.in: Regenerate.
+ * configure: Regenerate.
+
2012-08-02 Ulrich Weigand <ulrich.weigand@linaro.org>
* hostio.c (handle_pread): If pread fails, fall back to attempting
diff --git a/gdb/gdbserver/Makefile.in b/gdb/gdbserver/Makefile.in
index 446ea04..f62799e 100644
--- a/gdb/gdbserver/Makefile.in
+++ b/gdb/gdbserver/Makefile.in
@@ -140,7 +140,7 @@ SFILES= $(srcdir)/gdbreplay.c $(srcdir)/inferiors.c $(srcdir)/dll.c \
$(srcdir)/win32-arm-low.c $(srcdir)/win32-i386-low.c \
$(srcdir)/win32-low.c $(srcdir)/wincecompat.c \
$(srcdir)/hostio.c $(srcdir)/hostio-errno.c \
- $(srcdir)/common/vec.c \
+ $(srcdir)/common/vec.c $(srcdir)/common/gdb_vecs.c \
$(srcdir)/common/common-utils.c $(srcdir)/common/xml-utils.c \
$(srcdir)/common/linux-osdata.c $(srcdir)/common/ptid.c \
$(srcdir)/common/buffer.c
@@ -153,7 +153,7 @@ SOURCES = $(SFILES)
TAGFILES = $(SOURCES) ${HFILES} ${ALLPARAM} ${POSSLIBS}
OBS = agent.o ax.o inferiors.o regcache.o remote-utils.o server.o signals.o target.o \
- utils.o version.o vec.o \
+ utils.o version.o vec.o gdb_vecs.o \
mem-break.o hostio.o event-loop.o tracepoint.o \
xml-utils.o common-utils.o ptid.o buffer.o format.o \
dll.o \
@@ -414,6 +414,8 @@ ax_h = $(srcdir)/ax.h
agent_h = $(srcdir)/../common/agent.h
linux_osdata_h = $(srcdir)/../common/linux-osdata.h
vec_h = $(srcdir)/../common/vec.h
+gdb_vecs_h = $(srcdir)/../common/gdb_vecs.h
+host_defs_h = $(srcdir)/../common/host-defs.h
# Since everything must include server.h, we make that depend on
# generated files.
server_h = $(srcdir)/server.h $(regcache_h) $(srcdir)/target.h \
@@ -485,7 +487,7 @@ remote-utils.o: remote-utils.c terminal.h $(server_h) $(gdbthread_h)
server.o: server.c $(server_h) $(agent_h) $(gdbthread_h)
target.o: target.c $(server_h)
thread-db.o: thread-db.c $(server_h) $(linux_low_h) $(gdb_proc_service_h) \
- $(gdb_thread_db_h)
+ $(gdb_thread_db_h) $(gdb_vecs_h)
tracepoint.o: tracepoint.c $(server_h) $(ax_h) $(agent_h) $(gdbthread_h)
utils.o: utils.c $(server_h)
gdbreplay.o: gdbreplay.c config.h
@@ -506,6 +508,9 @@ common-utils.o: ../common/common-utils.c $(server_h)
vec.o: ../common/vec.c $(vec_h)
$(CC) -c $(CPPFLAGS) $(INTERNAL_CFLAGS) $< -DGDBSERVER
+gdb_vecs.o: ../common/gdb_vecs.c $(vec_h) $(gdb_vecs_h) $(host_defs_h)
+ $(CC) -c $(CPPFLAGS) $(INTERNAL_CFLAGS) $< -DGDBSERVER
+
xml-utils.o: ../common/xml-utils.c $(server_h)
$(CC) -c $(CPPFLAGS) $(INTERNAL_CFLAGS) $< -DGDBSERVER
diff --git a/gdb/gdbserver/config.in b/gdb/gdbserver/config.in
index 26742ac..bacf005 100644
--- a/gdb/gdbserver/config.in
+++ b/gdb/gdbserver/config.in
@@ -30,6 +30,10 @@
don't. */
#undef HAVE_DECL_STRERROR
+/* Define to 1 if you have the declaration of `strstr', and to 0 if you don't.
+ */
+#undef HAVE_DECL_STRSTR
+
/* Define to 1 if you have the declaration of `vasprintf', and to 0 if you
don't. */
#undef HAVE_DECL_VASPRINTF
diff --git a/gdb/gdbserver/configure b/gdb/gdbserver/configure
index 63e25c2..69953c2 100755
--- a/gdb/gdbserver/configure
+++ b/gdb/gdbserver/configure
@@ -4688,6 +4688,16 @@ fi
cat >>confdefs.h <<_ACEOF
#define HAVE_DECL_STRERROR $ac_have_decl
_ACEOF
+ac_fn_c_check_decl "$LINENO" "strstr" "ac_cv_have_decl_strstr" "$ac_includes_default"
+if test "x$ac_cv_have_decl_strstr" = x""yes; then :
+ ac_have_decl=1
+else
+ ac_have_decl=0
+fi
+
+cat >>confdefs.h <<_ACEOF
+#define HAVE_DECL_STRSTR $ac_have_decl
+_ACEOF
ac_fn_c_check_decl "$LINENO" "perror" "ac_cv_have_decl_perror" "$ac_includes_default"
if test "x$ac_cv_have_decl_perror" = x""yes; then :
ac_have_decl=1
diff --git a/gdb/gdbserver/configure.ac b/gdb/gdbserver/configure.ac
index 7013a21..dc3c3cd 100644
--- a/gdb/gdbserver/configure.ac
+++ b/gdb/gdbserver/configure.ac
@@ -174,7 +174,7 @@ AC_TRY_LINK([
[AC_MSG_RESULT(no)])
fi
-AC_CHECK_DECLS([strerror, perror, vasprintf, vsnprintf])
+AC_CHECK_DECLS([strerror, strstr, perror, vasprintf, vsnprintf])
AC_CHECK_TYPES(socklen_t, [], [],
[#include <sys/types.h>
diff --git a/gdb/gdbserver/thread-db.c b/gdb/gdbserver/thread-db.c
index 795f926..4a59df6 100644
--- a/gdb/gdbserver/thread-db.c
+++ b/gdb/gdbserver/thread-db.c
@@ -28,6 +28,7 @@ static int thread_db_use_events;
#include "gdb_proc_service.h"
#include "gdb_thread_db.h"
+#include "gdb_vecs.h"
#ifndef USE_LIBTHREAD_DB_DIRECTLY
#include <dlfcn.h>
@@ -741,39 +742,31 @@ try_thread_db_load_from_dir (const char *dir, size_t dir_len)
static int
thread_db_load_search (void)
{
- const char *search_path;
- int rc = 0;
+ VEC (char_ptr) *dir_vec;
+ char *this_dir;
+ int i, rc = 0;
if (libthread_db_search_path == NULL)
libthread_db_search_path = xstrdup (LIBTHREAD_DB_SEARCH_PATH);
- search_path = libthread_db_search_path;
- while (*search_path)
+ dir_vec = dirnames_to_char_ptr_vec (libthread_db_search_path);
+
+ for (i = 0; VEC_iterate (char_ptr, dir_vec, i, this_dir); ++i)
{
- const char *end = strchr (search_path, ':');
- const char *this_dir = search_path;
+ const int pdir_len = sizeof ("$pdir") - 1;
size_t this_dir_len;
- if (end)
- {
- this_dir_len = end - search_path;
- search_path += this_dir_len + 1;
- }
- else
- {
- this_dir_len = strlen (this_dir);
- search_path += this_dir_len;
- }
+ this_dir_len = strlen (this_dir);
- if (this_dir_len == sizeof ("$pdir") - 1
- && strncmp (this_dir, "$pdir", this_dir_len) == 0)
+ if (strncmp (this_dir, "$pdir", pdir_len) == 0
+ && (this_dir[pdir_len] == '\0'
+ || this_dir[pdir_len] == '/'))
{
/* We don't maintain a list of loaded libraries so we don't know
where libpthread lives. We *could* fetch the info, but we don't
do that yet. Ignore it. */
}
- else if (this_dir_len == sizeof ("$sdir") - 1
- && strncmp (this_dir, "$sdir", this_dir_len) == 0)
+ else if (strcmp (this_dir, "$sdir") == 0)
{
if (try_thread_db_load_from_sdir ())
{
@@ -791,6 +784,7 @@ thread_db_load_search (void)
}
}
+ free_char_ptr_vec (dir_vec);
if (debug_threads)
fprintf (stderr, "thread_db_load_search returning %d\n", rc);
return rc;