Accepting request 24778 from devel:gcc

Copy from devel:gcc/gdb based on submit request 24778 from user rguenther

OBS-URL: https://build.opensuse.org/request/show/24778
OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/gdb?expand=0&rev=69
This commit is contained in:
OBS User autobuild 2009-11-23 12:19:03 +00:00 committed by Git OBS Bridge
parent 01c38154ce
commit 5f501f69ca
13 changed files with 924 additions and 390 deletions

View File

@ -705,7 +705,7 @@ Index: gdb-6.8.91.20090925/gdb/solib-svr4.c
SO_NAME_MAX_PATH_SIZE - 1, &errcode); SO_NAME_MAX_PATH_SIZE - 1, &errcode);
if (errcode != 0) if (errcode != 0)
@@ -1101,63 +1336,76 @@ svr4_current_sos (void) @@ -1101,63 +1336,76 @@ svr4_current_sos (void)
safe_strerror (errcode)); }
else else
{ {
- struct build_id *build_id; - struct build_id *build_id;

View File

@ -1,82 +0,0 @@
2005-04-02 Andrew Cagney <cagney@gnu.org>
* symfile.c (separate_debug_file_exists): When the CRCs mismatch
print a warning.
(find_separate_debug_file): Pass in the objfile's name.
Index: gdb-6.8.50.20081128/gdb/symfile.c
===================================================================
--- gdb-6.8.50.20081128.orig/gdb/symfile.c 2008-10-03 18:36:10.000000000 +0200
+++ gdb-6.8.50.20081128/gdb/symfile.c 2008-12-01 16:34:36.000000000 +0100
@@ -1296,7 +1296,8 @@ get_debug_link_info (struct objfile *obj
}
static int
-separate_debug_file_exists (const char *name, unsigned long crc)
+separate_debug_file_exists (const char *name, unsigned long crc,
+ const char *parent_name)
{
unsigned long file_crc = 0;
bfd *abfd;
@@ -1316,7 +1317,15 @@ separate_debug_file_exists (const char *
bfd_close (abfd);
- return crc == file_crc;
+ if (crc != file_crc)
+ {
+ warning (_("the debug information found in \"%s\""
+ " does not match \"%s\" (CRC mismatch).\n"),
+ name, parent_name);
+ return 0;
+ }
+
+ return 1;
}
char *debug_file_directory = NULL;
@@ -1368,6 +1377,8 @@ find_separate_debug_file (struct objfile
basename = get_debug_link_info (objfile, &crc32);
if (basename == NULL)
+ /* There's no separate debug info, hence there's no way we could
+ load it => no warning. */
return NULL;
dir = xstrdup (objfile->name);
@@ -1395,7 +1406,7 @@ find_separate_debug_file (struct objfile
strcpy (debugfile, dir);
strcat (debugfile, basename);
- if (separate_debug_file_exists (debugfile, crc32))
+ if (separate_debug_file_exists (debugfile, crc32, objfile->name))
{
xfree (basename);
xfree (dir);
@@ -1408,7 +1419,7 @@ find_separate_debug_file (struct objfile
strcat (debugfile, "/");
strcat (debugfile, basename);
- if (separate_debug_file_exists (debugfile, crc32))
+ if (separate_debug_file_exists (debugfile, crc32, objfile->name))
{
xfree (basename);
xfree (dir);
@@ -1421,7 +1432,7 @@ find_separate_debug_file (struct objfile
strcat (debugfile, dir);
strcat (debugfile, basename);
- if (separate_debug_file_exists (debugfile, crc32))
+ if (separate_debug_file_exists (debugfile, crc32, objfile->name))
{
xfree (basename);
xfree (dir);
@@ -1440,7 +1451,7 @@ find_separate_debug_file (struct objfile
strcat (debugfile, "/");
strcat (debugfile, basename);
- if (separate_debug_file_exists (debugfile, crc32))
+ if (separate_debug_file_exists (debugfile, crc32, objfile->name))
{
xfree (canon_name);
xfree (basename);

View File

@ -1,55 +0,0 @@
Index: gdb-6.8/gdb/testsuite/gdb.base/sepdebug.exp
===================================================================
--- gdb-6.8.orig/gdb/testsuite/gdb.base/sepdebug.exp 2008-02-26 09:14:11.000000000 +0100
+++ gdb-6.8/gdb/testsuite/gdb.base/sepdebug.exp 2008-07-14 10:26:19.000000000 +0200
@@ -981,3 +981,40 @@ if ![string compare $build_id_debug_file
# Spare debug files may confuse testsuite runs in the future.
remote_exec build "rm -f ${objdir}/${subdir}/${build_id_debug_filename}"
}
+
+
+# Compile up a second, different, object file. Copy its debug info
+# over the top of the new debug info. Note that somewhere in the
+# above the "set debug-file-directory" variable is set to
+# ${objdir}/${subdir} so need to move things there.
+
+set existing_binfile $binfile
+set testfile "sepdebug2"
+set srcfile ${testfile}.c
+set binfile ${objdir}/${subdir}/${testfile}
+set corrupt_debug_file [separate_debug_filename $binfile]
+if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug additional_flags=-w}] != "" } {
+ return -1
+}
+if [gdb_gnu_strip_debug $binfile] {
+ # check that you have a recent version of strip and objcopy installed
+ unsupported "cannot produce separate debug info files"
+ return -1
+}
+remote_exec build "cp $corrupt_debug_file ${existing_binfile}.debug"
+
+gdb_exit
+gdb_start
+gdb_reinitialize_dir $srcdir/$subdir
+gdb_load ${binfile}
+
+set test "A corrupt debug file gets a warning"
+gdb_test_multiple "file $existing_binfile" "$test" {
+ -re "warning:.*mismatch.*" {
+ pass "$test"
+ }
+ -re ".y or n. " {
+ send_gdb "y\n"
+ exp_continue
+ }
+}
Index: gdb-6.8/gdb/testsuite/gdb.base/sepdebug2.c
===================================================================
--- /dev/null 1970-01-01 00:00:00.000000000 +0000
+++ gdb-6.8/gdb/testsuite/gdb.base/sepdebug2.c 2008-07-14 10:26:19.000000000 +0200
@@ -0,0 +1,5 @@
+int
+main (int argc, char *argv[], char *envp[])
+{
+ return 0;
+}

View File

@ -1,7 +1,7 @@
Index: gdb-6.8.91.20090925/gdb/corelow.c Index: gdb-7.0/gdb/corelow.c
=================================================================== ===================================================================
--- gdb-6.8.91.20090925.orig/gdb/corelow.c 2009-07-31 17:25:21.000000000 +0200 --- gdb-7.0.orig/gdb/corelow.c 2009-07-31 17:25:21.000000000 +0200
+++ gdb-6.8.91.20090925/gdb/corelow.c 2009-09-25 09:39:09.000000000 +0200 +++ gdb-7.0/gdb/corelow.c 2009-10-23 00:17:29.000000000 +0200
@@ -45,6 +45,10 @@ @@ -45,6 +45,10 @@
#include "exceptions.h" #include "exceptions.h"
#include "solib.h" #include "solib.h"
@ -91,11 +91,11 @@ Index: gdb-6.8.91.20090925/gdb/corelow.c
+ NULL, NULL, NULL, + NULL, NULL, NULL,
+ &setlist, &showlist); + &setlist, &showlist);
} }
Index: gdb-6.8.91.20090925/gdb/doc/gdb.texinfo Index: gdb-7.0/gdb/doc/gdb.texinfo
=================================================================== ===================================================================
--- gdb-6.8.91.20090925.orig/gdb/doc/gdb.texinfo 2009-09-25 09:29:58.000000000 +0200 --- gdb-7.0.orig/gdb/doc/gdb.texinfo 2009-10-23 00:12:39.000000000 +0200
+++ gdb-6.8.91.20090925/gdb/doc/gdb.texinfo 2009-09-25 09:29:58.000000000 +0200 +++ gdb-7.0/gdb/doc/gdb.texinfo 2009-10-23 00:17:29.000000000 +0200
@@ -13895,6 +13895,27 @@ information files. @@ -13896,6 +13896,27 @@ information files.
@end table @end table
@ -123,10 +123,10 @@ Index: gdb-6.8.91.20090925/gdb/doc/gdb.texinfo
@cindex @code{.gnu_debuglink} sections @cindex @code{.gnu_debuglink} sections
@cindex debug link sections @cindex debug link sections
A debug link is a special section of the executable file named A debug link is a special section of the executable file named
Index: gdb-6.8.91.20090925/gdb/solib-svr4.c Index: gdb-7.0/gdb/solib-svr4.c
=================================================================== ===================================================================
--- gdb-6.8.91.20090925.orig/gdb/solib-svr4.c 2009-09-25 09:29:57.000000000 +0200 --- gdb-7.0.orig/gdb/solib-svr4.c 2009-10-23 00:12:38.000000000 +0200
+++ gdb-6.8.91.20090925/gdb/solib-svr4.c 2009-09-25 09:43:14.000000000 +0200 +++ gdb-7.0/gdb/solib-svr4.c 2009-10-23 00:17:29.000000000 +0200
@@ -1101,9 +1101,49 @@ svr4_current_sos (void) @@ -1101,9 +1101,49 @@ svr4_current_sos (void)
safe_strerror (errcode)); safe_strerror (errcode));
else else
@ -180,10 +180,10 @@ Index: gdb-6.8.91.20090925/gdb/solib-svr4.c
} }
xfree (buffer); xfree (buffer);
Index: gdb-6.8.91.20090925/gdb/symfile.c Index: gdb-7.0/gdb/symfile.c
=================================================================== ===================================================================
--- gdb-6.8.91.20090925.orig/gdb/symfile.c 2009-09-25 09:29:57.000000000 +0200 --- gdb-7.0.orig/gdb/symfile.c 2009-10-23 00:12:38.000000000 +0200
+++ gdb-6.8.91.20090925/gdb/symfile.c 2009-09-25 09:29:58.000000000 +0200 +++ gdb-7.0/gdb/symfile.c 2009-10-23 00:43:28.000000000 +0200
@@ -56,6 +56,7 @@ @@ -56,6 +56,7 @@
#include "elf-bfd.h" #include "elf-bfd.h"
#include "solib.h" #include "solib.h"
@ -618,7 +618,7 @@ Index: gdb-6.8.91.20090925/gdb/symfile.c
if (found == NULL) if (found == NULL)
warning (_("File \"%s\" has no build-id, file skipped"), filename); warning (_("File \"%s\" has no build-id, file skipped"), filename);
@@ -1234,8 +1626,9 @@ build_id_verify (const char *filename, s @@ -1234,14 +1626,16 @@ build_id_verify (const char *filename, s
return retval; return retval;
} }
@ -628,48 +628,77 @@ Index: gdb-6.8.91.20090925/gdb/symfile.c
+build_id_to_filename (struct build_id *build_id, char **link_return, +build_id_to_filename (struct build_id *build_id, char **link_return,
+ int add_debug_suffix) + int add_debug_suffix)
{ {
char *link, *s, *retval = NULL; char *link, *debugdir, *retval = NULL;
gdb_byte *data = build_id->data; + char *link_all = NULL;
@@ -1243,7 +1636,9 @@ build_id_to_debug_filename (struct build
/* DEBUG_FILE_DIRECTORY/.build-id/ab/cdef */ /* DEBUG_FILE_DIRECTORY/.build-id/ab/cdef */
link = xmalloc (strlen (debug_file_directory) + (sizeof "/.build-id/" - 1) + 1 - link = alloca (strlen (debug_file_directory) + (sizeof "/.build-id/" - 1) + 1
- + 2 * size + (sizeof ".debug" - 1) + 1); - + 2 * build_id->size + (sizeof ".debug" - 1) + 1);
+ + 2 * size + link = xmalloc (strlen (debug_file_directory) + (sizeof "/.build-id/" - 1) + 1
+ + (add_debug_suffix ? sizeof ".debug" - 1 : 0) + + 2 * build_id->size + (sizeof ".debug" - 1) + 1);
+ + 1);
s = link + sprintf (link, "%s/.build-id/", debug_file_directory);
if (size > 0)
{
@@ -1254,12 +1649,14 @@ build_id_to_debug_filename (struct build
*s++ = '/';
while (size-- > 0)
s += sprintf (s, "%02x", (unsigned) *data++);
- strcpy (s, ".debug");
+ if (add_debug_suffix)
+ strcpy (s, ".debug");
+ else
+ *s = 0;
/* lrealpath() is expensive even for the usually non-existent files. */ /* Keep backward compatibility so that DEBUG_FILE_DIRECTORY being "" will
if (access (link, F_OK) == 0) cause "/.build-id/..." lookups. */
retval = lrealpath (link); @@ -1272,7 +1666,10 @@ build_id_to_debug_filename (struct build
- xfree (link); *s++ = '/';
while (size-- > 0)
s += sprintf (s, "%02x", (unsigned) *data++);
- strcpy (s, ".debug");
+ if (add_debug_suffix)
+ strcpy (s, ".debug");
+ else
+ *s = 0;
if (retval != NULL && !build_id_verify (retval, build_id)) /* lrealpath() is expensive even for the usually non-existent files. */
{ if (access (link, F_OK) == 0)
@@ -1267,9 +1664,150 @@ build_id_to_debug_filename (struct build @@ -1285,15 +1682,185 @@ build_id_to_debug_filename (struct build
retval = NULL; }
if (retval != NULL)
- break;
+ {
+ /* LINK_ALL is not used below in this non-NULL RETVAL case. */
+ break;
+ }
+
+ if (link_all == NULL)
+ link_all = xstrdup (link);
+ else
+ {
+ size_t len_orig = strlen (link_all);
+
+ link_all = xrealloc (link_all, len_orig + 1 + strlen (link) + 1);
+
+ /* Use whitespace instead of DIRNAME_SEPARATOR to be compatible with
+ its possible use as an argument for installation command. */
+ link_all[len_orig] = ' ';
+
+ strcpy (&link_all[len_orig + 1], link);
+ }
debugdir = debugdir_end;
} }
while (*debugdir != 0);
+ if (link_return != NULL) + if (link_return != NULL)
+ *link_return = link; + {
+ else + if (retval != NULL)
+ xfree (link); + {
+ *link_return = link;
+ link = NULL;
+ }
+ else
+ {
+ *link_return = link_all;
+ link_all = NULL;
+ }
+ }
+ xfree (link);
+ xfree (link_all);
+
+ return retval;
+}
+ +
return retval;
}
+/* This MISSING_FILEPAIR_HASH tracker is used only for the duplicite messages +/* This MISSING_FILEPAIR_HASH tracker is used only for the duplicite messages
+ Try to install the hash file ... + Try to install the hash file ...
+ avoidance. */ + avoidance. */
@ -692,9 +721,9 @@ Index: gdb-6.8.91.20090925/gdb/symfile.c
+ +
+ retval = obstack_alloc (&missing_filepair_obstack, size); + retval = obstack_alloc (&missing_filepair_obstack, size);
+ memset (retval, 0, size); + memset (retval, 0, size);
+ return retval; return retval;
+} }
+
+static hashval_t +static hashval_t
+missing_filepair_hash_func (const struct missing_filepair *elem) +missing_filepair_hash_func (const struct missing_filepair *elem)
+{ +{
@ -809,20 +838,7 @@ Index: gdb-6.8.91.20090925/gdb/symfile.c
static char * static char *
get_debug_link_info (struct objfile *objfile, unsigned long *crc32_out) get_debug_link_info (struct objfile *objfile, unsigned long *crc32_out)
{ {
@@ -1352,32 +1890,36 @@ static char * @@ -1384,13 +1951,14 @@ find_separate_debug_file (struct objfile
find_separate_debug_file (struct objfile *objfile)
{
asection *sect;
- char *basename;
- char *dir;
- char *debugfile;
+ char *basename = NULL;
+ char *dir = NULL;
+ char *debugfile = NULL;
char *name_copy;
- char *canon_name;
+ char *canon_name = NULL;
bfd_size_type debuglink_size;
unsigned long crc32; unsigned long crc32;
int i; int i;
struct build_id *build_id; struct build_id *build_id;
@ -839,123 +855,34 @@ Index: gdb-6.8.91.20090925/gdb/symfile.c
xfree (build_id); xfree (build_id);
/* Prevent looping on a stripped .debug file. */ /* Prevent looping on a stripped .debug file. */
if (build_id_name != NULL && strcmp (build_id_name, objfile->name) == 0) if (build_id_name != NULL && strcmp (build_id_name, objfile->name) == 0)
{ @@ -1400,7 +1968,10 @@ find_separate_debug_file (struct objfile
- warning (_("\"%s\": separate debug info file has no debug info"),
+ warning (_("\"%s\": The separate debug info file has no debug info"),
build_id_name);
xfree (build_id_name); xfree (build_id_name);
} }
else if (build_id_name != NULL) else if (build_id_name != NULL)
- return build_id_name; - return build_id_name;
+ { + {
+ xfree (build_id_filename); + xfree (build_id_filename);
+ return build_id_name; + return build_id_name;
+ } + }
} }
basename = get_debug_link_info (objfile, &crc32); basename = get_debug_link_info (objfile, &crc32);
@@ -1385,7 +1927,7 @@ find_separate_debug_file (struct objfile @@ -1501,8 +2072,10 @@ find_separate_debug_file (struct objfile
if (basename == NULL)
/* There's no separate debug info, hence there's no way we could
load it => no warning. */
- return NULL;
+ goto cleanup_return_debugfile;
dir = xstrdup (objfile->name);
@@ -1407,24 +1949,19 @@ find_separate_debug_file (struct objfile
if (canon_name && strlen (canon_name) > i)
i = strlen (canon_name);
- debugfile = alloca (strlen (debug_file_directory) + 1
- + i
- + strlen (DEBUG_SUBDIRECTORY)
- + strlen ("/")
- + strlen (basename)
- + 1);
+ debugfile = xmalloc (strlen (debug_file_directory) + 1
+ + i
+ + strlen (DEBUG_SUBDIRECTORY)
+ + strlen ("/")
+ + strlen (basename)
+ + 1);
/* First try in the same directory as the original file. */
strcpy (debugfile, dir);
strcat (debugfile, basename);
if (separate_debug_file_exists (debugfile, crc32, objfile->name))
- {
- xfree (basename);
- xfree (dir);
- xfree (canon_name);
- return xstrdup (debugfile);
- }
+ goto cleanup_return_debugfile;
/* Then try in the subdirectory named DEBUG_SUBDIRECTORY. */
strcpy (debugfile, dir);
@@ -1433,12 +1970,7 @@ find_separate_debug_file (struct objfile
strcat (debugfile, basename);
if (separate_debug_file_exists (debugfile, crc32, objfile->name))
- {
- xfree (basename);
- xfree (dir);
- xfree (canon_name);
- return xstrdup (debugfile);
- }
+ goto cleanup_return_debugfile;
/* Then try in the global debugfile directory. */
strcpy (debugfile, debug_file_directory);
@@ -1447,12 +1979,7 @@ find_separate_debug_file (struct objfile
strcat (debugfile, basename);
if (separate_debug_file_exists (debugfile, crc32, objfile->name))
- {
- xfree (basename);
- xfree (dir);
- xfree (canon_name);
- return xstrdup (debugfile);
- }
+ goto cleanup_return_debugfile;
/* If the file is in the sysroot, try using its base path in the
global debugfile directory. */
@@ -1466,20 +1993,18 @@ find_separate_debug_file (struct objfile
strcat (debugfile, basename);
if (separate_debug_file_exists (debugfile, crc32, objfile->name))
- {
- xfree (canon_name);
- xfree (basename);
- xfree (dir);
- return xstrdup (debugfile);
- }
+ goto cleanup_return_debugfile;
}
- if (canon_name) xfree (debugfile);
- xfree (canon_name); debugfile = NULL;
+ debugfile = NULL;
+ debug_print_missing (objfile->name, build_id_filename); + debug_print_missing (objfile->name, build_id_filename);
+cleanup_return_debugfile: cleanup_return_debugfile:
+ xfree (build_id_filename); + xfree (build_id_filename);
+ xfree (canon_name); xfree (canon_name);
xfree (basename); xfree (basename);
xfree (dir); xfree (dir);
- return NULL; @@ -4256,4 +4829,16 @@ each global debug-file-directory compone
+ return debugfile;
}
@@ -4229,4 +4754,16 @@ the global debug-file directory prepende
NULL, NULL,
show_debug_file_directory, show_debug_file_directory,
&setlist, &showlist); &setlist, &showlist);
+ +
+ add_setshow_zinteger_cmd ("build-id-verbose", no_class, &build_id_verbose, + add_setshow_zinteger_cmd ("build-id-verbose", no_class, &build_id_verbose,
+ _("\ + _("\
+ Set debugging level of the build-id locator."), _("\ + Set debugging level of the build-id locator."), _("\
@ -965,13 +892,13 @@ Index: gdb-6.8.91.20090925/gdb/symfile.c
+ NULL, + NULL,
+ show_build_id_verbose, + show_build_id_verbose,
+ &setlist, &showlist); + &setlist, &showlist);
+ +
+ observer_attach_executable_changed (debug_print_executable_changed); + observer_attach_executable_changed (debug_print_executable_changed);
} }
Index: gdb-6.8.91.20090925/gdb/symfile.h Index: gdb-7.0/gdb/symfile.h
=================================================================== ===================================================================
--- gdb-6.8.91.20090925.orig/gdb/symfile.h 2009-09-25 09:29:57.000000000 +0200 --- gdb-7.0.orig/gdb/symfile.h 2009-10-23 00:12:38.000000000 +0200
+++ gdb-6.8.91.20090925/gdb/symfile.h 2009-09-25 09:29:58.000000000 +0200 +++ gdb-7.0/gdb/symfile.h 2009-10-23 00:17:29.000000000 +0200
@@ -381,6 +381,13 @@ extern int symfile_map_offsets_to_segmen @@ -381,6 +381,13 @@ extern int symfile_map_offsets_to_segmen
struct symfile_segment_data *get_symfile_segment_data (bfd *abfd); struct symfile_segment_data *get_symfile_segment_data (bfd *abfd);
void free_symfile_segment_data (struct symfile_segment_data *data); void free_symfile_segment_data (struct symfile_segment_data *data);
@ -986,10 +913,10 @@ Index: gdb-6.8.91.20090925/gdb/symfile.h
/* From dwarf2read.c */ /* From dwarf2read.c */
extern int dwarf2_has_info (struct objfile *); extern int dwarf2_has_info (struct objfile *);
Index: gdb-6.8.91.20090925/gdb/testsuite/lib/gdb.exp Index: gdb-7.0/gdb/testsuite/lib/gdb.exp
=================================================================== ===================================================================
--- gdb-6.8.91.20090925.orig/gdb/testsuite/lib/gdb.exp 2009-09-25 09:29:57.000000000 +0200 --- gdb-7.0.orig/gdb/testsuite/lib/gdb.exp 2009-10-23 00:12:38.000000000 +0200
+++ gdb-6.8.91.20090925/gdb/testsuite/lib/gdb.exp 2009-09-25 09:29:58.000000000 +0200 +++ gdb-7.0/gdb/testsuite/lib/gdb.exp 2009-10-23 00:17:29.000000000 +0200
@@ -1248,6 +1248,16 @@ proc default_gdb_start { } { @@ -1248,6 +1248,16 @@ proc default_gdb_start { } {
warning "Couldn't set the width to 0." warning "Couldn't set the width to 0."
} }
@ -1007,10 +934,10 @@ Index: gdb-6.8.91.20090925/gdb/testsuite/lib/gdb.exp
return 0; return 0;
} }
Index: gdb-6.8.91.20090925/gdb/testsuite/lib/mi-support.exp Index: gdb-7.0/gdb/testsuite/lib/mi-support.exp
=================================================================== ===================================================================
--- gdb-6.8.91.20090925.orig/gdb/testsuite/lib/mi-support.exp 2009-09-15 20:51:26.000000000 +0200 --- gdb-7.0.orig/gdb/testsuite/lib/mi-support.exp 2009-09-15 20:51:26.000000000 +0200
+++ gdb-6.8.91.20090925/gdb/testsuite/lib/mi-support.exp 2009-09-25 09:29:58.000000000 +0200 +++ gdb-7.0/gdb/testsuite/lib/mi-support.exp 2009-10-23 00:17:29.000000000 +0200
@@ -221,6 +221,16 @@ proc default_mi_gdb_start { args } { @@ -221,6 +221,16 @@ proc default_mi_gdb_start { args } {
} }
} }
@ -1028,10 +955,10 @@ Index: gdb-6.8.91.20090925/gdb/testsuite/lib/mi-support.exp
detect_async detect_async
Index: gdb-6.8.91.20090925/gdb/objfiles.h Index: gdb-7.0/gdb/objfiles.h
=================================================================== ===================================================================
--- gdb-6.8.91.20090925.orig/gdb/objfiles.h 2009-09-25 09:29:57.000000000 +0200 --- gdb-7.0.orig/gdb/objfiles.h 2009-10-23 00:12:38.000000000 +0200
+++ gdb-6.8.91.20090925/gdb/objfiles.h 2009-09-25 09:38:27.000000000 +0200 +++ gdb-7.0/gdb/objfiles.h 2009-10-23 00:17:29.000000000 +0200
@@ -428,6 +428,10 @@ struct objfile @@ -428,6 +428,10 @@ struct objfile
#define OBJF_MAIN (1 << 7) #define OBJF_MAIN (1 << 7)

View File

@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:f5c2383b52371f01e8d580deab466155094a12b8284d0133ece44ed7faf926b9
size 18453837

3
gdb-7.0.tar.bz2 Normal file
View File

@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:c750c695c8029da60688fc6584207fd1ea741a6b9e79e4ad03715bfbc2113ecd
size 17604459

View File

@ -2,7 +2,7 @@ http://sourceware.org/gdb/wiki/ProjectArcher
http://sourceware.org/gdb/wiki/ArcherBranchManagement http://sourceware.org/gdb/wiki/ArcherBranchManagement
GIT snapshot: GIT snapshot:
commit 7cb860f03e2437c97239334ebe240d06f45723e0 commit ce4ead356654b951a49ca78d81ebfff95e758bf5
branch `archer' - the merge of branches: branch `archer' - the merge of branches:
archer-tromey-call-frame-cfa archer-tromey-call-frame-cfa
@ -19,12 +19,12 @@ archer-pmuldoon-next-over-throw
diff --git a/gdb/Makefile.in b/gdb/Makefile.in diff --git a/gdb/Makefile.in b/gdb/Makefile.in
index f5e1dde..73ee55c 100644 index 7d53205..319fac4 100644
--- a/gdb/Makefile.in --- a/gdb/Makefile.in
+++ b/gdb/Makefile.in +++ b/gdb/Makefile.in
@@ -169,6 +169,10 @@ TARGET_SYSTEM_ROOT_DEFINE = @TARGET_SYSTEM_ROOT_DEFINE@ @@ -169,6 +169,10 @@ TARGET_SYSTEM_ROOT_DEFINE = @TARGET_SYSTEM_ROOT_DEFINE@
# Did the user give us a --with-gdb-datadir option? # Did the user give us a --with-gdb-datadir option?
GDB_DATADIR_PATH = @GDB_DATADIR_PATH@ GDB_DATADIR = @GDB_DATADIR@
+# The argument to --with-pythondir. If not given, this is +# The argument to --with-pythondir. If not given, this is
+# GDB_DATADIR_PATH/python. +# GDB_DATADIR_PATH/python.
@ -194,10 +194,10 @@ index f5e1dde..73ee55c 100644
# Dependency tracking. Most of this is conditional on GNU Make being # Dependency tracking. Most of this is conditional on GNU Make being
# found by configure; if GNU Make is not found, we fall back to a # found by configure; if GNU Make is not found, we fall back to a
diff --git a/gdb/NEWS b/gdb/NEWS diff --git a/gdb/NEWS b/gdb/NEWS
index 4fc6dcd..6744b23 100644 index 8d32c34..f7ea21b 100644
--- a/gdb/NEWS --- a/gdb/NEWS
+++ b/gdb/NEWS +++ b/gdb/NEWS
@@ -462,6 +462,13 @@ x86/x86_64 Darwin i[34567]86-*-darwin* @@ -476,6 +476,13 @@ x86/x86_64 Darwin i[34567]86-*-darwin*
x86_64 MinGW x86_64-*-mingw* x86_64 MinGW x86_64-*-mingw*
@ -290,7 +290,7 @@ index 9b5d2c6..61676a9 100644
ada_dump_subexp_body, ada_dump_subexp_body,
ada_evaluate_subexp ada_evaluate_subexp
diff --git a/gdb/amd64-linux-nat.c b/gdb/amd64-linux-nat.c diff --git a/gdb/amd64-linux-nat.c b/gdb/amd64-linux-nat.c
index 7d8461c..a6d35d7 100644 index 7d8461c..fc4b3e0 100644
--- a/gdb/amd64-linux-nat.c --- a/gdb/amd64-linux-nat.c
+++ b/gdb/amd64-linux-nat.c +++ b/gdb/amd64-linux-nat.c
@@ -270,6 +270,8 @@ amd64_linux_dr_get (ptid_t ptid, int regnum) @@ -270,6 +270,8 @@ amd64_linux_dr_get (ptid_t ptid, int regnum)
@ -340,7 +340,7 @@ index 7d8461c..a6d35d7 100644
return amd64_linux_dr_get (inferior_ptid, DR_STATUS); return amd64_linux_dr_get (inferior_ptid, DR_STATUS);
} }
+/* Unset VALUE bits in DR_STATUS in all LWPs of LWP_LIST. */ +/* Unset MASK bits in DR_STATUS in all LWPs of LWP_LIST. */
+ +
+static void +static void
+amd64_linux_dr_unset_status (unsigned long mask) +amd64_linux_dr_unset_status (unsigned long mask)
@ -2900,7 +2900,7 @@ index 0000000..49ac420
+#define TARGET_REGION_SIZE_OK_FOR_HW_WATCHPOINT(SIZE) 1 +#define TARGET_REGION_SIZE_OK_FOR_HW_WATCHPOINT(SIZE) 1
+ +
diff --git a/gdb/configure b/gdb/configure diff --git a/gdb/configure b/gdb/configure
index 99acc2f..a2ea1ae 100755 index 46e7bfe..ea667f0 100755
--- a/gdb/configure --- a/gdb/configure
+++ b/gdb/configure +++ b/gdb/configure
@@ -676,6 +676,8 @@ REPORT_BUGS_TO @@ -676,6 +676,8 @@ REPORT_BUGS_TO
@ -3015,7 +3015,7 @@ index 99acc2f..a2ea1ae 100755
# Flags needed to compile Python code (taken from python-config --cflags). # Flags needed to compile Python code (taken from python-config --cflags).
diff --git a/gdb/configure.ac b/gdb/configure.ac diff --git a/gdb/configure.ac b/gdb/configure.ac
index b31d9b7..a1969bc 100644 index 0e42182..e7f97cf 100644
--- a/gdb/configure.ac --- a/gdb/configure.ac
+++ b/gdb/configure.ac +++ b/gdb/configure.ac
@@ -107,6 +107,51 @@ AS_HELP_STRING([--with-relocated-sources=PATH], [automatically relocate this pat @@ -107,6 +107,51 @@ AS_HELP_STRING([--with-relocated-sources=PATH], [automatically relocate this pat
@ -3832,7 +3832,7 @@ index 7cb016d..bb9e35a 100644
default_symfile_offsets, /* sym_offsets: parse user's offsets to default_symfile_offsets, /* sym_offsets: parse user's offsets to
internal form */ internal form */
diff --git a/gdb/doc/gdb.texinfo b/gdb/doc/gdb.texinfo diff --git a/gdb/doc/gdb.texinfo b/gdb/doc/gdb.texinfo
index f16b6e2..fe328c7 100644 index 1f98fa5..9e24482 100644
--- a/gdb/doc/gdb.texinfo --- a/gdb/doc/gdb.texinfo
+++ b/gdb/doc/gdb.texinfo +++ b/gdb/doc/gdb.texinfo
@@ -959,8 +959,10 @@ Connect to process ID @var{number}, as with the @code{attach} command. @@ -959,8 +959,10 @@ Connect to process ID @var{number}, as with the @code{attach} command.
@ -3865,7 +3865,7 @@ index f16b6e2..fe328c7 100644
@c resolve the situation of these eventually @c resolve the situation of these eventually
@item -tui @item -tui
@cindex @code{--tui} @cindex @code{--tui}
@@ -18650,7 +18662,7 @@ command: @@ -18660,7 +18672,7 @@ command:
@table @code @table @code
@kindex source @kindex source
@cindex execute commands from a file @cindex execute commands from a file
@ -3874,7 +3874,7 @@ index f16b6e2..fe328c7 100644
Execute the command file @var{filename}. Execute the command file @var{filename}.
@end table @end table
@@ -18667,6 +18679,11 @@ If @code{-v}, for verbose mode, is given then @value{GDBN} displays @@ -18677,6 +18689,11 @@ If @code{-v}, for verbose mode, is given then @value{GDBN} displays
each command as it is executed. The option must be given before each command as it is executed. The option must be given before
@var{filename}, and is interpreted as part of the filename anywhere else. @var{filename}, and is interpreted as part of the filename anywhere else.
@ -3886,7 +3886,7 @@ index f16b6e2..fe328c7 100644
Commands that would ask for confirmation if used interactively proceed Commands that would ask for confirmation if used interactively proceed
without asking when used in a command file. Many @value{GDBN} commands that without asking when used in a command file. Many @value{GDBN} commands that
normally print messages to say what they are doing omit the messages normally print messages to say what they are doing omit the messages
@@ -18928,8 +18945,6 @@ containing @code{end}. For example: @@ -18938,8 +18955,6 @@ containing @code{end}. For example:
@smallexample @smallexample
(@value{GDBP}) python (@value{GDBP}) python
@ -3895,7 +3895,7 @@ index f16b6e2..fe328c7 100644
>print 23 >print 23
>end >end
23 23
@@ -18942,6 +18957,14 @@ in a Python script. This can be controlled using @code{maint set @@ -18952,6 +18967,14 @@ in a Python script. This can be controlled using @code{maint set
python print-stack}: if @code{on}, the default, then Python stack python print-stack}: if @code{on}, the default, then Python stack
printing is enabled; if @code{off}, then Python stack printing is printing is enabled; if @code{off}, then Python stack printing is
disabled. disabled.
@ -3910,7 +3910,7 @@ index f16b6e2..fe328c7 100644
@end table @end table
@node Python API @node Python API
@@ -18949,6 +18972,14 @@ disabled. @@ -18959,6 +18982,14 @@ disabled.
@cindex python api @cindex python api
@cindex programming in python @cindex programming in python
@ -3925,7 +3925,7 @@ index f16b6e2..fe328c7 100644
@cindex python stdout @cindex python stdout
@cindex python pagination @cindex python pagination
At startup, @value{GDBN} overrides Python's @code{sys.stdout} and At startup, @value{GDBN} overrides Python's @code{sys.stdout} and
@@ -18961,13 +18992,17 @@ situation, a Python @code{KeyboardInterrupt} exception is thrown. @@ -18971,13 +19002,17 @@ situation, a Python @code{KeyboardInterrupt} exception is thrown.
* Basic Python:: Basic Python Functions. * Basic Python:: Basic Python Functions.
* Exception Handling:: * Exception Handling::
* Auto-loading:: Automatically loading Python code. * Auto-loading:: Automatically loading Python code.
@ -3944,7 +3944,7 @@ index f16b6e2..fe328c7 100644
* Frames In Python:: Acessing inferior stack frames from Python. * Frames In Python:: Acessing inferior stack frames from Python.
@end menu @end menu
@@ -18994,6 +19029,12 @@ command as having originated from the user invoking it interactively. @@ -19004,6 +19039,12 @@ command as having originated from the user invoking it interactively.
It must be a boolean value. If omitted, it defaults to @code{False}. It must be a boolean value. If omitted, it defaults to @code{False}.
@end defun @end defun
@ -3957,7 +3957,7 @@ index f16b6e2..fe328c7 100644
@findex gdb.parameter @findex gdb.parameter
@defun parameter parameter @defun parameter parameter
Return the value of a @value{GDBN} parameter. @var{parameter} is a Return the value of a @value{GDBN} parameter. @var{parameter} is a
@@ -19010,6 +19051,7 @@ a Python value of the appropriate type, and returned. @@ -19020,6 +19061,7 @@ a Python value of the appropriate type, and returned.
@defun history number @defun history number
Return a value from @value{GDBN}'s value history (@pxref{Value Return a value from @value{GDBN}'s value history (@pxref{Value
History}). @var{number} indicates which history element to return. History}). @var{number} indicates which history element to return.
@ -3965,7 +3965,7 @@ index f16b6e2..fe328c7 100644
If @var{number} is negative, then @value{GDBN} will take its absolute value If @var{number} is negative, then @value{GDBN} will take its absolute value
and count backward from the last element (i.e., the most recent element) to and count backward from the last element (i.e., the most recent element) to
find the value to return. If @var{number} is zero, then @value{GDBN} will find the value to return. If @var{number} is zero, then @value{GDBN} will
@@ -19021,6 +19063,28 @@ If no exception is raised, the return value is always an instance of @@ -19031,6 +19073,28 @@ If no exception is raised, the return value is always an instance of
@code{gdb.Value} (@pxref{Values From Inferior}). @code{gdb.Value} (@pxref{Values From Inferior}).
@end defun @end defun
@ -3994,7 +3994,7 @@ index f16b6e2..fe328c7 100644
@findex gdb.write @findex gdb.write
@defun write string @defun write string
Print a string to @value{GDBN}'s paginated standard output stream. Print a string to @value{GDBN}'s paginated standard output stream.
@@ -19035,6 +19099,11 @@ Flush @value{GDBN}'s paginated standard output stream. Flushing @@ -19045,6 +19109,11 @@ Flush @value{GDBN}'s paginated standard output stream. Flushing
function. function.
@end defun @end defun
@ -4006,7 +4006,7 @@ index f16b6e2..fe328c7 100644
@node Exception Handling @node Exception Handling
@subsubsection Exception Handling @subsubsection Exception Handling
@cindex python exceptions @cindex python exceptions
@@ -19171,6 +19240,13 @@ The type of this @code{gdb.Value}. The value of this attribute is a @@ -19181,6 +19250,13 @@ The type of this @code{gdb.Value}. The value of this attribute is a
The following methods are provided: The following methods are provided:
@table @code @table @code
@ -4020,7 +4020,7 @@ index f16b6e2..fe328c7 100644
@defmethod Value dereference @defmethod Value dereference
For pointer data types, this method returns a new @code{gdb.Value} object For pointer data types, this method returns a new @code{gdb.Value} object
whose contents is the object pointed to by the pointer. For example, if whose contents is the object pointed to by the pointer. For example, if
@@ -19242,6 +19318,9 @@ module: @@ -19252,6 +19328,9 @@ module:
This function looks up a type by name. @var{name} is the name of the This function looks up a type by name. @var{name} is the name of the
type to look up. It must be a string. type to look up. It must be a string.
@ -4030,7 +4030,7 @@ index f16b6e2..fe328c7 100644
Ordinarily, this function will return an instance of @code{gdb.Type}. Ordinarily, this function will return an instance of @code{gdb.Type}.
If the named type cannot be found, it will throw an exception. If the named type cannot be found, it will throw an exception.
@end defun @end defun
@@ -19294,6 +19373,12 @@ This is @code{True} if the field is artificial, usually meaning that @@ -19304,6 +19383,12 @@ This is @code{True} if the field is artificial, usually meaning that
it was provided by the compiler and not the user. This attribute is it was provided by the compiler and not the user. This attribute is
always provided, and is @code{False} if the field is not artificial. always provided, and is @code{False} if the field is not artificial.
@ -4043,7 +4043,7 @@ index f16b6e2..fe328c7 100644
@item bitsize @item bitsize
If the field is packed, or is a bitfield, then this will have a If the field is packed, or is a bitfield, then this will have a
non-zero value, which is the size of the field in bits. Otherwise, non-zero value, which is the size of the field in bits. Otherwise,
@@ -19346,7 +19431,7 @@ If the type does not have a target, this method will throw an @@ -19356,7 +19441,7 @@ If the type does not have a target, this method will throw an
exception. exception.
@end defmethod @end defmethod
@ -4052,7 +4052,7 @@ index f16b6e2..fe328c7 100644
If this @code{gdb.Type} is an instantiation of a template, this will If this @code{gdb.Type} is an instantiation of a template, this will
return a new @code{gdb.Type} which represents the type of the return a new @code{gdb.Type} which represents the type of the
@var{n}th template argument. @var{n}th template argument.
@@ -19354,7 +19439,8 @@ return a new @code{gdb.Type} which represents the type of the @@ -19364,7 +19449,8 @@ return a new @code{gdb.Type} which represents the type of the
If this @code{gdb.Type} is not a template type, this will throw an If this @code{gdb.Type} is not a template type, this will throw an
exception. Ordinarily, only C@t{++} code will have template types. exception. Ordinarily, only C@t{++} code will have template types.
@ -4062,7 +4062,7 @@ index f16b6e2..fe328c7 100644
@end defmethod @end defmethod
@end table @end table
@@ -19708,6 +19794,121 @@ import gdb.libstdcxx.v6 @@ -19718,6 +19804,121 @@ import gdb.libstdcxx.v6
gdb.libstdcxx.v6.register_printers (gdb.current_objfile ()) gdb.libstdcxx.v6.register_printers (gdb.current_objfile ())
@end smallexample @end smallexample
@ -4184,7 +4184,7 @@ index f16b6e2..fe328c7 100644
@node Commands In Python @node Commands In Python
@subsubsection Commands In Python @subsubsection Commands In Python
@@ -19960,6 +20161,135 @@ registration of the command with @value{GDBN}. Depending on how the @@ -19970,6 +20171,135 @@ registration of the command with @value{GDBN}. Depending on how the
Python code is read into @value{GDBN}, you may need to import the Python code is read into @value{GDBN}, you may need to import the
@code{gdb} module explicitly. @code{gdb} module explicitly.
@ -4320,7 +4320,7 @@ index f16b6e2..fe328c7 100644
@node Functions In Python @node Functions In Python
@subsubsection Writing new convenience functions @subsubsection Writing new convenience functions
@@ -20064,6 +20394,82 @@ which is used to format the value. @xref{Pretty Printing}, for more @@ -20074,6 +20404,82 @@ which is used to format the value. @xref{Pretty Printing}, for more
information. information.
@end defivar @end defivar
@ -4403,7 +4403,7 @@ index f16b6e2..fe328c7 100644
@node Frames In Python @node Frames In Python
@subsubsection Acessing inferior stack frames from Python. @subsubsection Acessing inferior stack frames from Python.
@@ -20128,6 +20534,14 @@ function to a string. @@ -20138,6 +20544,14 @@ function to a string.
Returns the frame's resume address. Returns the frame's resume address.
@end defmethod @end defmethod
@ -4418,7 +4418,7 @@ index f16b6e2..fe328c7 100644
@defmethod Frame older @defmethod Frame older
Return the frame that called this frame. Return the frame that called this frame.
@end defmethod @end defmethod
@@ -20136,10 +20550,18 @@ Return the frame that called this frame. @@ -20146,10 +20560,18 @@ Return the frame that called this frame.
Return the frame called by this frame. Return the frame called by this frame.
@end defmethod @end defmethod
@ -10995,7 +10995,7 @@ index 0f9d44e..c910e88 100644
/* We didn't find it; print the raw data. */ /* We didn't find it; print the raw data. */
if (vbit) if (vbit)
diff --git a/gdb/i386-linux-nat.c b/gdb/i386-linux-nat.c diff --git a/gdb/i386-linux-nat.c b/gdb/i386-linux-nat.c
index fe848ff..170e6cd 100644 index fe848ff..905dcc3 100644
--- a/gdb/i386-linux-nat.c --- a/gdb/i386-linux-nat.c
+++ b/gdb/i386-linux-nat.c +++ b/gdb/i386-linux-nat.c
@@ -586,6 +586,8 @@ i386_linux_store_inferior_registers (struct target_ops *ops, @@ -586,6 +586,8 @@ i386_linux_store_inferior_registers (struct target_ops *ops,
@ -11054,7 +11054,7 @@ index fe848ff..170e6cd 100644
return i386_linux_dr_get (inferior_ptid, DR_STATUS); return i386_linux_dr_get (inferior_ptid, DR_STATUS);
} }
+/* Unset VALUE bits in DR_STATUS in all LWPs of LWP_LIST. */ +/* Unset MASK bits in DR_STATUS in all LWPs of LWP_LIST. */
+ +
+static void +static void
+i386_linux_dr_unset_status (unsigned long mask) +i386_linux_dr_unset_status (unsigned long mask)
@ -11100,7 +11100,7 @@ index fe848ff..170e6cd 100644
/* Override the default ptrace resume method. */ /* Override the default ptrace resume method. */
diff --git a/gdb/i386-nat.c b/gdb/i386-nat.c diff --git a/gdb/i386-nat.c b/gdb/i386-nat.c
index ab1bd8a..ee330b8 100644 index 325b4df..631ccd6 100644
--- a/gdb/i386-nat.c --- a/gdb/i386-nat.c
+++ b/gdb/i386-nat.c +++ b/gdb/i386-nat.c
@@ -137,8 +137,11 @@ struct i386_dr_low_type i386_dr_low; @@ -137,8 +137,11 @@ struct i386_dr_low_type i386_dr_low;
@ -11157,7 +11157,7 @@ index ab1bd8a..ee330b8 100644
/* Return non-zero if we can watch a memory region that starts at /* Return non-zero if we can watch a memory region that starts at
address ADDR and whose length is LEN bytes. */ address ADDR and whose length is LEN bytes. */
@@ -575,28 +598,7 @@ static int @@ -578,28 +601,7 @@ static int
i386_stopped_by_watchpoint (void) i386_stopped_by_watchpoint (void)
{ {
CORE_ADDR addr = 0; CORE_ADDR addr = 0;
@ -11187,7 +11187,7 @@ index ab1bd8a..ee330b8 100644
} }
/* Insert a hardware-assisted breakpoint at BP_TGT->placed_address. /* Insert a hardware-assisted breakpoint at BP_TGT->placed_address.
@@ -690,6 +692,7 @@ i386_use_watchpoints (struct target_ops *t) @@ -693,6 +695,7 @@ i386_use_watchpoints (struct target_ops *t)
t->to_stopped_data_address = i386_stopped_data_address; t->to_stopped_data_address = i386_stopped_data_address;
t->to_insert_watchpoint = i386_insert_watchpoint; t->to_insert_watchpoint = i386_insert_watchpoint;
t->to_remove_watchpoint = i386_remove_watchpoint; t->to_remove_watchpoint = i386_remove_watchpoint;
@ -11236,6 +11236,39 @@ index f49b9f6..cd31958 100644
int debug_register_length; int debug_register_length;
}; };
diff --git a/gdb/infcall.c b/gdb/infcall.c
index c9d98cf..277399a 100644
--- a/gdb/infcall.c
+++ b/gdb/infcall.c
@@ -441,6 +441,7 @@ call_function_by_hand (struct value *function, int nargs, struct value **args)
struct gdbarch *gdbarch;
struct breakpoint *terminate_bp = NULL;
struct minimal_symbol *tm;
+ struct cleanup *terminate_bp_cleanup = NULL;
ptid_t call_thread_ptid;
struct gdb_exception e;
const char *name;
@@ -772,7 +773,7 @@ call_function_by_hand (struct value *function, int nargs, struct value **args)
/* Register a clean-up for unwind_on_terminating_exception_breakpoint. */
if (terminate_bp)
- make_cleanup_delete_breakpoint (terminate_bp);
+ terminate_bp_cleanup = make_cleanup_delete_breakpoint (terminate_bp);
/* - SNIP - SNIP - SNIP - SNIP - SNIP - SNIP - SNIP - SNIP - SNIP -
If you're looking to implement asynchronous dummy-frames, then
@@ -987,6 +988,11 @@ When the function is done executing, GDB will silently stop."),
internal_error (__FILE__, __LINE__, _("... should not be here"));
}
+ /* If we get here and the std::terminate() breakpoint has been set,
+ it has to be cleaned manually. */
+ if (terminate_bp)
+ do_cleanups (terminate_bp_cleanup);
+
/* If we get here the called FUNCTION ran to completion,
and the dummy frame has already been popped. */
diff --git a/gdb/infcmd.c b/gdb/infcmd.c diff --git a/gdb/infcmd.c b/gdb/infcmd.c
index 9e98290..fab1892 100644 index 9e98290..fab1892 100644
--- a/gdb/infcmd.c --- a/gdb/infcmd.c
@ -11349,7 +11382,7 @@ index f1b5d17..31add7d 100644
extern void notice_new_inferior (ptid_t, int, int); extern void notice_new_inferior (ptid_t, int, int);
diff --git a/gdb/infrun.c b/gdb/infrun.c diff --git a/gdb/infrun.c b/gdb/infrun.c
index 1a83a25..2ee2164 100644 index ff7c6b9..9d29b15 100644
--- a/gdb/infrun.c --- a/gdb/infrun.c
+++ b/gdb/infrun.c +++ b/gdb/infrun.c
@@ -45,6 +45,8 @@ @@ -45,6 +45,8 @@
@ -11392,7 +11425,26 @@ index 1a83a25..2ee2164 100644
/* This causes the eventpoints and symbol table to be reset. /* This causes the eventpoints and symbol table to be reset.
Must do this now, before trying to determine whether to Must do this now, before trying to determine whether to
stop. */ stop. */
@@ -3468,23 +3480,33 @@ process_event_stop_test: @@ -2845,6 +2857,9 @@ targets should add new threads to the thread list themselves in non-stop mode.")
{
struct regcache *regcache = get_thread_regcache (ecs->ptid);
struct gdbarch *gdbarch = get_regcache_arch (regcache);
+ struct cleanup *old_chain = save_inferior_ptid ();
+
+ inferior_ptid = ecs->ptid;
fprintf_unfiltered (gdb_stdlog, "infrun: stop_pc = %s\n",
paddress (gdbarch, stop_pc));
@@ -2861,6 +2876,8 @@ targets should add new threads to the thread list themselves in non-stop mode.")
fprintf_unfiltered (gdb_stdlog,
"infrun: (no data address available)\n");
}
+
+ do_cleanups (old_chain);
}
if (stepping_past_singlestep_breakpoint)
@@ -3468,23 +3485,33 @@ process_event_stop_test:
ecs->event_thread->stepping_over_breakpoint = 1; ecs->event_thread->stepping_over_breakpoint = 1;
@ -11438,7 +11490,7 @@ index 1a83a25..2ee2164 100644
keep_going (ecs); keep_going (ecs);
return; return;
@@ -3496,6 +3518,53 @@ infrun: BPSTAT_WHAT_SET_LONGJMP_RESUME (!gdbarch_get_longjmp_target)\n"); @@ -3496,6 +3523,53 @@ infrun: BPSTAT_WHAT_SET_LONGJMP_RESUME (!gdbarch_get_longjmp_target)\n");
gdb_assert (ecs->event_thread->step_resume_breakpoint != NULL); gdb_assert (ecs->event_thread->step_resume_breakpoint != NULL);
delete_step_resume_breakpoint (ecs->event_thread); delete_step_resume_breakpoint (ecs->event_thread);
@ -11492,7 +11544,7 @@ index 1a83a25..2ee2164 100644
ecs->event_thread->stop_step = 1; ecs->event_thread->stop_step = 1;
print_stop_reason (END_STEPPING_RANGE, 0); print_stop_reason (END_STEPPING_RANGE, 0);
stop_stepping (ecs); stop_stepping (ecs);
@@ -4500,6 +4569,96 @@ insert_longjmp_resume_breakpoint (struct gdbarch *gdbarch, CORE_ADDR pc) @@ -4500,6 +4574,96 @@ insert_longjmp_resume_breakpoint (struct gdbarch *gdbarch, CORE_ADDR pc)
set_momentary_breakpoint_at_pc (gdbarch, pc, bp_longjmp_resume); set_momentary_breakpoint_at_pc (gdbarch, pc, bp_longjmp_resume);
} }
@ -11589,7 +11641,7 @@ index 1a83a25..2ee2164 100644
static void static void
stop_stepping (struct execution_control_state *ecs) stop_stepping (struct execution_control_state *ecs)
{ {
@@ -4568,6 +4727,8 @@ keep_going (struct execution_control_state *ecs) @@ -4568,6 +4732,8 @@ keep_going (struct execution_control_state *ecs)
} }
if (e.reason < 0) if (e.reason < 0)
{ {
@ -18014,7 +18066,7 @@ index 49c0437..84a476e 100644
+ return 1; + return 1;
+} +}
diff --git a/gdb/python/py-value.c b/gdb/python/py-value.c diff --git a/gdb/python/py-value.c b/gdb/python/py-value.c
index 58bcee3..b2e7b7d 100644 index 0146593..b82fcb6 100644
--- a/gdb/python/py-value.c --- a/gdb/python/py-value.c
+++ b/gdb/python/py-value.c +++ b/gdb/python/py-value.c
@@ -25,6 +25,7 @@ @@ -25,6 +25,7 @@
@ -20070,7 +20122,7 @@ index e5d14fd..37fab72 100644
current_target.to_stopped_data_address = debug_to_stopped_data_address; current_target.to_stopped_data_address = debug_to_stopped_data_address;
current_target.to_watchpoint_addr_within_range = debug_to_watchpoint_addr_within_range; current_target.to_watchpoint_addr_within_range = debug_to_watchpoint_addr_within_range;
diff --git a/gdb/target.h b/gdb/target.h diff --git a/gdb/target.h b/gdb/target.h
index b1cb852..adff946 100644 index b1cb852..3c06eba 100644
--- a/gdb/target.h --- a/gdb/target.h
+++ b/gdb/target.h +++ b/gdb/target.h
@@ -395,6 +395,7 @@ struct target_ops @@ -395,6 +395,7 @@ struct target_ops
@ -20081,7 +20133,16 @@ index b1cb852..adff946 100644
int (*to_stopped_by_watchpoint) (void); int (*to_stopped_by_watchpoint) (void);
int to_have_steppable_watchpoint; int to_have_steppable_watchpoint;
int to_have_continuable_watchpoint; int to_have_continuable_watchpoint;
@@ -1166,6 +1167,15 @@ extern char *normal_pid_to_str (ptid_t ptid); @@ -1124,7 +1125,7 @@ extern char *normal_pid_to_str (ptid_t ptid);
/* Hardware watchpoint interfaces. */
/* Returns non-zero if we were stopped by a hardware watchpoint (memory read or
- write). */
+ write). Only the INFERIOR_PTID task is being queried. */
#define target_stopped_by_watchpoint \
(*current_target.to_stopped_by_watchpoint)
@@ -1166,14 +1167,26 @@ extern char *normal_pid_to_str (ptid_t ptid);
#define target_remove_watchpoint(addr, len, type) \ #define target_remove_watchpoint(addr, len, type) \
(*current_target.to_remove_watchpoint) (addr, len, type) (*current_target.to_remove_watchpoint) (addr, len, type)
@ -20097,7 +20158,20 @@ index b1cb852..adff946 100644
#define target_insert_hw_breakpoint(gdbarch, bp_tgt) \ #define target_insert_hw_breakpoint(gdbarch, bp_tgt) \
(*current_target.to_insert_hw_breakpoint) (gdbarch, bp_tgt) (*current_target.to_insert_hw_breakpoint) (gdbarch, bp_tgt)
@@ -1203,6 +1213,20 @@ extern int target_search_memory (CORE_ADDR start_addr, #define target_remove_hw_breakpoint(gdbarch, bp_tgt) \
(*current_target.to_remove_hw_breakpoint) (gdbarch, bp_tgt)
-#define target_stopped_data_address(target, x) \
- (*target.to_stopped_data_address) (target, x)
+/* Return non-zero if target knows the data address which triggered this
+ target_stopped_by_watchpoint, in such case place it to *ADDR_P. Only the
+ INFERIOR_PTID task is being queried. */
+#define target_stopped_data_address(target, addr_p) \
+ (*target.to_stopped_data_address) (target, addr_p)
#define target_watchpoint_addr_within_range(target, addr, start, length) \
(*target.to_watchpoint_addr_within_range) (target, addr, start, length)
@@ -1203,6 +1216,20 @@ extern int target_search_memory (CORE_ADDR start_addr,
ULONGEST pattern_len, ULONGEST pattern_len,
CORE_ADDR *found_addrp); CORE_ADDR *found_addrp);
@ -20118,7 +20192,7 @@ index b1cb852..adff946 100644
/* Command logging facility. */ /* Command logging facility. */
#define target_log_command(p) \ #define target_log_command(p) \
@@ -1322,6 +1346,14 @@ extern struct target_ops *find_target_beneath (struct target_ops *); @@ -1322,6 +1349,14 @@ extern struct target_ops *find_target_beneath (struct target_ops *);
extern char *target_get_osdata (const char *type); extern char *target_get_osdata (const char *type);
@ -27292,10 +27366,10 @@ index 0000000..14f42d6
+} +}
diff --git a/gdb/testsuite/gdb.threads/watchthreads-reorder.exp b/gdb/testsuite/gdb.threads/watchthreads-reorder.exp diff --git a/gdb/testsuite/gdb.threads/watchthreads-reorder.exp b/gdb/testsuite/gdb.threads/watchthreads-reorder.exp
new file mode 100644 new file mode 100644
index 0000000..8f65364 index 0000000..5ad1a4e
--- /dev/null --- /dev/null
+++ b/gdb/testsuite/gdb.threads/watchthreads-reorder.exp +++ b/gdb/testsuite/gdb.threads/watchthreads-reorder.exp
@@ -0,0 +1,101 @@ @@ -0,0 +1,105 @@
+# This testcase is part of GDB, the GNU debugger. +# This testcase is part of GDB, the GNU debugger.
+ +
+# Copyright 2009 Free Software Foundation, Inc. +# Copyright 2009 Free Software Foundation, Inc.
@ -27393,6 +27467,10 @@ index 0000000..8f65364
+ "Hardware read watchpoint \[0-9\]+: thread\[12\]_rwatch\r\n\r\nValue = 0\r\n0x\[0-9a-f\]+ in thread\[12\]_func .*" \ + "Hardware read watchpoint \[0-9\]+: thread\[12\]_rwatch\r\n\r\nValue = 0\r\n0x\[0-9a-f\]+ in thread\[12\]_func .*" \
+ "continue b" + "continue b"
+ +
+ # While the debug output itself is not checked in this testcase one bug was
+ # found in the DEBUG_INFRUN code path.
+ gdb_test "set debug infrun 1"
+
+ gdb_continue_to_breakpoint "break-at-exit" ".*break-at-exit.*" + gdb_continue_to_breakpoint "break-at-exit" ".*break-at-exit.*"
+ +
+ set pf_prefix $prefix_test + set pf_prefix $prefix_test
@ -27803,7 +27881,7 @@ index a9c875d..12f6f07 100644
} }
diff --git a/gdb/valops.c b/gdb/valops.c diff --git a/gdb/valops.c b/gdb/valops.c
index b64cb21..b7d31cc 100644 index 012ea6a..9b4d2a8 100644
--- a/gdb/valops.c --- a/gdb/valops.c
+++ b/gdb/valops.c +++ b/gdb/valops.c
@@ -38,6 +38,7 @@ @@ -38,6 +38,7 @@
@ -27917,7 +27995,7 @@ index b64cb21..b7d31cc 100644
} }
} }
else if (VALUE_LVAL (val) == lval_register) else if (VALUE_LVAL (val) == lval_register)
@@ -1070,7 +1133,18 @@ address_of_variable (struct symbol *var, struct block *b) @@ -1072,7 +1135,18 @@ address_of_variable (struct symbol *var, struct block *b)
if ((VALUE_LVAL (val) == lval_memory && value_lazy (val)) if ((VALUE_LVAL (val) == lval_memory && value_lazy (val))
|| TYPE_CODE (type) == TYPE_CODE_FUNC) || TYPE_CODE (type) == TYPE_CODE_FUNC)
{ {
@ -27937,7 +28015,7 @@ index b64cb21..b7d31cc 100644
return value_from_pointer (lookup_pointer_type (type), addr); return value_from_pointer (lookup_pointer_type (type), addr);
} }
@@ -1176,6 +1250,7 @@ struct value * @@ -1178,6 +1252,7 @@ struct value *
value_coerce_array (struct value *arg1) value_coerce_array (struct value *arg1)
{ {
struct type *type = check_typedef (value_type (arg1)); struct type *type = check_typedef (value_type (arg1));
@ -27945,7 +28023,7 @@ index b64cb21..b7d31cc 100644
/* If the user tries to do something requiring a pointer with an /* If the user tries to do something requiring a pointer with an
array that has not yet been pushed to the target, then this would array that has not yet been pushed to the target, then this would
@@ -1185,8 +1260,12 @@ value_coerce_array (struct value *arg1) @@ -1187,8 +1262,12 @@ value_coerce_array (struct value *arg1)
if (VALUE_LVAL (arg1) != lval_memory) if (VALUE_LVAL (arg1) != lval_memory)
error (_("Attempt to take address of value not located in memory.")); error (_("Attempt to take address of value not located in memory."));
@ -27959,7 +28037,7 @@ index b64cb21..b7d31cc 100644
} }
/* Given a value which is a function, return a value which is a pointer /* Given a value which is a function, return a value which is a pointer
@@ -2069,12 +2148,25 @@ find_overload_match (struct type **arg_types, int nargs, @@ -2071,12 +2150,25 @@ find_overload_match (struct type **arg_types, int nargs,
if (method) if (method)
{ {
gdb_assert (obj); gdb_assert (obj);
@ -27990,7 +28068,7 @@ index b64cb21..b7d31cc 100644
fns_ptr = value_find_oload_method_list (&temp, name, fns_ptr = value_find_oload_method_list (&temp, name,
0, &num_fns, 0, &num_fns,
@@ -2094,16 +2186,29 @@ find_overload_match (struct type **arg_types, int nargs, @@ -2096,16 +2188,29 @@ find_overload_match (struct type **arg_types, int nargs,
} }
else else
{ {
@ -28028,7 +28106,7 @@ index b64cb21..b7d31cc 100644
if (func_name == NULL) if (func_name == NULL)
{ {
*symp = fsym; *symp = fsym;
@@ -2534,8 +2639,8 @@ check_field (struct type *type, const char *name) @@ -2536,8 +2641,8 @@ check_field (struct type *type, const char *name)
the comment before value_struct_elt_for_reference. */ the comment before value_struct_elt_for_reference. */
struct value * struct value *
@ -28039,7 +28117,7 @@ index b64cb21..b7d31cc 100644
enum noside noside) enum noside noside)
{ {
switch (TYPE_CODE (curtype)) switch (TYPE_CODE (curtype))
@@ -2543,7 +2648,7 @@ value_aggregate_elt (struct type *curtype, @@ -2545,7 +2650,7 @@ value_aggregate_elt (struct type *curtype,
case TYPE_CODE_STRUCT: case TYPE_CODE_STRUCT:
case TYPE_CODE_UNION: case TYPE_CODE_UNION:
return value_struct_elt_for_reference (curtype, 0, curtype, return value_struct_elt_for_reference (curtype, 0, curtype,
@ -28048,7 +28126,7 @@ index b64cb21..b7d31cc 100644
want_address, noside); want_address, noside);
case TYPE_CODE_NAMESPACE: case TYPE_CODE_NAMESPACE:
return value_namespace_elt (curtype, name, return value_namespace_elt (curtype, name,
@@ -2554,6 +2659,56 @@ value_aggregate_elt (struct type *curtype, @@ -2556,6 +2661,56 @@ value_aggregate_elt (struct type *curtype,
} }
} }
@ -28105,7 +28183,7 @@ index b64cb21..b7d31cc 100644
/* C++: Given an aggregate type CURTYPE, and a member name NAME, /* C++: Given an aggregate type CURTYPE, and a member name NAME,
return the address of this member as a "pointer to member" type. return the address of this member as a "pointer to member" type.
If INTYPE is non-null, then it will be the type of the member we If INTYPE is non-null, then it will be the type of the member we
@@ -2631,23 +2786,46 @@ value_struct_elt_for_reference (struct type *domain, int offset, @@ -2633,23 +2788,46 @@ value_struct_elt_for_reference (struct type *domain, int offset,
} }
if (t_field_name && strcmp (t_field_name, name) == 0) if (t_field_name && strcmp (t_field_name, name) == 0)
{ {
@ -28162,7 +28240,7 @@ index b64cb21..b7d31cc 100644
if (TYPE_FN_FIELD_STATIC_P (f, j)) if (TYPE_FN_FIELD_STATIC_P (f, j))
{ {
@@ -2761,7 +2939,7 @@ value_maybe_namespace_elt (const struct type *curtype, @@ -2763,7 +2941,7 @@ value_maybe_namespace_elt (const struct type *curtype,
struct symbol *sym; struct symbol *sym;
struct value *result; struct value *result;
@ -28171,7 +28249,7 @@ index b64cb21..b7d31cc 100644
get_selected_block (0), get_selected_block (0),
VAR_DOMAIN); VAR_DOMAIN);
@@ -2905,7 +3083,7 @@ value_of_local (const char *name, int complain) @@ -2907,7 +3085,7 @@ value_of_local (const char *name, int complain)
/* Calling lookup_block_symbol is necessary to get the LOC_REGISTER /* Calling lookup_block_symbol is necessary to get the LOC_REGISTER
symbol instead of the LOC_ARG one (if both exist). */ symbol instead of the LOC_ARG one (if both exist). */
@ -28180,7 +28258,7 @@ index b64cb21..b7d31cc 100644
if (sym == NULL) if (sym == NULL)
{ {
if (complain) if (complain)
@@ -2959,8 +3137,6 @@ value_slice (struct value *array, int lowbound, int length) @@ -2961,8 +3139,6 @@ value_slice (struct value *array, int lowbound, int length)
|| lowbound + length - 1 > upperbound) || lowbound + length - 1 > upperbound)
error (_("slice out of range")); error (_("slice out of range"));

View File

@ -0,0 +1,137 @@
http://sourceware.org/ml/gdb-patches/2009-10/msg00509.html
Subject: [patch 2/3] find_separate_debug_file cleanup
Hi,
current code was:
* difficult to maintain as a new variable required xfree on many places
* was causing memory corruptions due to silently misapplied 3rd party patches
as the close code fragments unfortunately match patch context
Thanks,
Jan
gdb/
2009-10-21 Jan Kratochvil <jan.kratochvil@redhat.com>
* symfile.c (find_separate_debug_file): Initialize dir, debugfile and
canon_name to NULL. Change alloca to xmalloc, newly call xfree for it.
New label cleanup_return_debugfile, jump to it from the failure paths.
--- a/gdb/symfile.c
+++ b/gdb/symfile.c
@@ -1333,11 +1333,10 @@ static char *
find_separate_debug_file (struct objfile *objfile)
{
asection *sect;
- char *basename;
- char *dir;
- char *debugfile;
- char *name_copy;
- char *canon_name;
+ char *basename, *name_copy;
+ char *dir = NULL;
+ char *debugfile = NULL;
+ char *canon_name = NULL;
bfd_size_type debuglink_size;
unsigned long crc32;
int i;
@@ -1366,7 +1365,7 @@ find_separate_debug_file (struct objfile *objfile)
if (basename == NULL)
/* There's no separate debug info, hence there's no way we could
load it => no warning. */
- return NULL;
+ goto cleanup_return_debugfile;
dir = xstrdup (objfile->name);
@@ -1388,24 +1387,19 @@ find_separate_debug_file (struct objfile *objfile)
if (canon_name && strlen (canon_name) > i)
i = strlen (canon_name);
- debugfile = alloca (strlen (debug_file_directory) + 1
- + i
- + strlen (DEBUG_SUBDIRECTORY)
- + strlen ("/")
- + strlen (basename)
- + 1);
+ debugfile = xmalloc (strlen (debug_file_directory) + 1
+ + i
+ + strlen (DEBUG_SUBDIRECTORY)
+ + strlen ("/")
+ + strlen (basename)
+ + 1);
/* First try in the same directory as the original file. */
strcpy (debugfile, dir);
strcat (debugfile, basename);
if (separate_debug_file_exists (debugfile, crc32, objfile->name))
- {
- xfree (basename);
- xfree (dir);
- xfree (canon_name);
- return xstrdup (debugfile);
- }
+ goto cleanup_return_debugfile;
/* Then try in the subdirectory named DEBUG_SUBDIRECTORY. */
strcpy (debugfile, dir);
@@ -1414,12 +1408,7 @@ find_separate_debug_file (struct objfile *objfile)
strcat (debugfile, basename);
if (separate_debug_file_exists (debugfile, crc32, objfile->name))
- {
- xfree (basename);
- xfree (dir);
- xfree (canon_name);
- return xstrdup (debugfile);
- }
+ goto cleanup_return_debugfile;
/* Then try in the global debugfile directory. */
strcpy (debugfile, debug_file_directory);
@@ -1428,12 +1417,7 @@ find_separate_debug_file (struct objfile *objfile)
strcat (debugfile, basename);
if (separate_debug_file_exists (debugfile, crc32, objfile->name))
- {
- xfree (basename);
- xfree (dir);
- xfree (canon_name);
- return xstrdup (debugfile);
- }
+ goto cleanup_return_debugfile;
/* If the file is in the sysroot, try using its base path in the
global debugfile directory. */
@@ -1447,20 +1431,17 @@ find_separate_debug_file (struct objfile *objfile)
strcat (debugfile, basename);
if (separate_debug_file_exists (debugfile, crc32, objfile->name))
- {
- xfree (canon_name);
- xfree (basename);
- xfree (dir);
- return xstrdup (debugfile);
- }
+ goto cleanup_return_debugfile;
}
- if (canon_name)
- xfree (canon_name);
+ xfree (debugfile);
+ debugfile = NULL;
+cleanup_return_debugfile:
+ xfree (canon_name);
xfree (basename);
xfree (dir);
- return NULL;
+ return debugfile;
}

View File

@ -0,0 +1,271 @@
http://sourceware.org/ml/gdb-patches/2009-10/msg00508.html
Subject: [patch 3/3] debug-file-directory with multiple components
Hi,
for various reasons `debug-file-directory' would be sometimes useful to have
multiple components such as `solib-search-path' has.
I found it useful myself during various separate debuginfo tests/scripts.
It was requested for the ABRT bugreporting project at the preceding mail of:
https://fedorahosted.org/pipermail/crash-catcher/2009-October/000054.html
It should be a backward compatible extension as DIRNAME_SEPARATOR should never
be a valid part of a single DEBUG_FILE_DIRECTORY component.
Thanks,
Jan
gdb/doc/
2009-10-22 Jan Kratochvil <jan.kratochvil@redhat.com>
* gdb.texinfo (set debug-file-directory, show debug-file-directory)
(Auto-loading): Use plural and note one can use multiple components now.
gdb/
2009-10-22 Jan Kratochvil <jan.kratochvil@redhat.com>
* symfile.c (build_id_to_debug_filename): New variable debugdir. Move
variables size, s and data into a new inner block. Change xmalloc for
alloca, use direct BUILDID->SIZE there now. Loop for the
DEBUG_FILE_DIRECTORY components.
(find_separate_debug_file): New variable debugdir and debugdir_end.
Loop for the DEBUG_FILE_DIRECTORY components.
(_initialize_symfile): For "debug-file-directory" use plural and note
one can use multiple components now.
gdb/testsuite/
2009-10-22 Jan Kratochvil <jan.kratochvil@redhat.com>
* gdb.base/sepdebug.exp: New test_different_dir call for multiple-dirs.
--- a/gdb/doc/gdb.texinfo
+++ b/gdb/doc/gdb.texinfo
@@ -14066,13 +14066,14 @@ name @value{GDBN} is currently using.
@table @code
@kindex set debug-file-directory
-@item set debug-file-directory @var{directory}
-Set the directory which @value{GDBN} searches for separate debugging
-information files to @var{directory}.
+@item set debug-file-directory @var{directories}
+Set the directories which @value{GDBN} searches for separate debugging
+information files to @var{directory}. Multiple directory components can be set
+concatenating them by a directory separator.
@kindex show debug-file-directory
@item show debug-file-directory
-Show the directory @value{GDBN} searches for separate debugging
+Show the directories @value{GDBN} searches for separate debugging
information files.
@end table
@@ -19336,8 +19337,8 @@ readable, @value{GDBN} will evaluate it as a Python script.
If this file does not exist, and if the parameter
@code{debug-file-directory} is set (@pxref{Separate Debug Files}),
-then @value{GDBN} will use the file named
-@file{@var{debug-file-directory}/@var{real-name}}, where
+then @value{GDBN} will use for its each separated directory component
+@code{component} the file named @file{@code{component}/@var{real-name}}, where
@var{real-name} is the object file's real name, as described above.
Finally, if this file does not exist, then @value{GDBN} will look for
--- a/gdb/symfile.c
+++ b/gdb/symfile.c
@@ -1218,35 +1218,59 @@ build_id_verify (const char *filename, struct build_id *check)
static char *
build_id_to_debug_filename (struct build_id *build_id)
{
- char *link, *s, *retval = NULL;
- gdb_byte *data = build_id->data;
- size_t size = build_id->size;
+ char *link, *debugdir, *retval = NULL;
/* DEBUG_FILE_DIRECTORY/.build-id/ab/cdef */
- link = xmalloc (strlen (debug_file_directory) + (sizeof "/.build-id/" - 1) + 1
- + 2 * size + (sizeof ".debug" - 1) + 1);
- s = link + sprintf (link, "%s/.build-id/", debug_file_directory);
- if (size > 0)
- {
- size--;
- s += sprintf (s, "%02x", (unsigned) *data++);
- }
- if (size > 0)
- *s++ = '/';
- while (size-- > 0)
- s += sprintf (s, "%02x", (unsigned) *data++);
- strcpy (s, ".debug");
-
- /* lrealpath() is expensive even for the usually non-existent files. */
- if (access (link, F_OK) == 0)
- retval = lrealpath (link);
- xfree (link);
-
- if (retval != NULL && !build_id_verify (retval, build_id))
+ link = alloca (strlen (debug_file_directory) + (sizeof "/.build-id/" - 1) + 1
+ + 2 * build_id->size + (sizeof ".debug" - 1) + 1);
+
+ /* Keep backward compatibility so that DEBUG_FILE_DIRECTORY being "" will
+ cause "/.build-id/..." lookups. */
+
+ debugdir = debug_file_directory;
+ do
{
- xfree (retval);
- retval = NULL;
+ char *s, *debugdir_end;
+ gdb_byte *data = build_id->data;
+ size_t size = build_id->size;
+
+ while (*debugdir == DIRNAME_SEPARATOR)
+ debugdir++;
+
+ debugdir_end = strchr (debugdir, DIRNAME_SEPARATOR);
+ if (debugdir_end == NULL)
+ debugdir_end = &debugdir[strlen (debugdir)];
+
+ memcpy (link, debugdir, debugdir_end - debugdir);
+ s = &link[debugdir_end - debugdir];
+ s += sprintf (s, "/.build-id/");
+ if (size > 0)
+ {
+ size--;
+ s += sprintf (s, "%02x", (unsigned) *data++);
+ }
+ if (size > 0)
+ *s++ = '/';
+ while (size-- > 0)
+ s += sprintf (s, "%02x", (unsigned) *data++);
+ strcpy (s, ".debug");
+
+ /* lrealpath() is expensive even for the usually non-existent files. */
+ if (access (link, F_OK) == 0)
+ retval = lrealpath (link);
+
+ if (retval != NULL && !build_id_verify (retval, build_id))
+ {
+ xfree (retval);
+ retval = NULL;
+ }
+
+ if (retval != NULL)
+ break;
+
+ debugdir = debugdir_end;
}
+ while (*debugdir != 0);
return retval;
}
@@ -1333,7 +1357,7 @@ static char *
find_separate_debug_file (struct objfile *objfile)
{
asection *sect;
- char *basename, *name_copy;
+ char *basename, *name_copy, *debugdir;
char *dir = NULL;
char *debugfile = NULL;
char *canon_name = NULL;
@@ -1410,29 +1434,51 @@ find_separate_debug_file (struct objfile *objfile)
if (separate_debug_file_exists (debugfile, crc32, objfile->name))
goto cleanup_return_debugfile;
- /* Then try in the global debugfile directory. */
- strcpy (debugfile, debug_file_directory);
- strcat (debugfile, "/");
- strcat (debugfile, dir);
- strcat (debugfile, basename);
-
- if (separate_debug_file_exists (debugfile, crc32, objfile->name))
- goto cleanup_return_debugfile;
+ /* Then try in the global debugfile directories.
+
+ Keep backward compatibility so that DEBUG_FILE_DIRECTORY being "" will
+ cause "/..." lookups. */
- /* If the file is in the sysroot, try using its base path in the
- global debugfile directory. */
- if (canon_name
- && strncmp (canon_name, gdb_sysroot, strlen (gdb_sysroot)) == 0
- && IS_DIR_SEPARATOR (canon_name[strlen (gdb_sysroot)]))
+ debugdir = debug_file_directory;
+ do
{
- strcpy (debugfile, debug_file_directory);
- strcat (debugfile, canon_name + strlen (gdb_sysroot));
+ char *debugdir_end;
+
+ while (*debugdir == DIRNAME_SEPARATOR)
+ debugdir++;
+
+ debugdir_end = strchr (debugdir, DIRNAME_SEPARATOR);
+ if (debugdir_end == NULL)
+ debugdir_end = &debugdir[strlen (debugdir)];
+
+ memcpy (debugfile, debugdir, debugdir_end - debugdir);
+ debugfile[debugdir_end - debugdir] = 0;
strcat (debugfile, "/");
+ strcat (debugfile, dir);
strcat (debugfile, basename);
if (separate_debug_file_exists (debugfile, crc32, objfile->name))
goto cleanup_return_debugfile;
+
+ /* If the file is in the sysroot, try using its base path in the
+ global debugfile directory. */
+ if (canon_name
+ && strncmp (canon_name, gdb_sysroot, strlen (gdb_sysroot)) == 0
+ && IS_DIR_SEPARATOR (canon_name[strlen (gdb_sysroot)]))
+ {
+ memcpy (debugfile, debugdir, debugdir_end - debugdir);
+ debugfile[debugdir_end - debugdir] = 0;
+ strcat (debugfile, canon_name + strlen (gdb_sysroot));
+ strcat (debugfile, "/");
+ strcat (debugfile, basename);
+
+ if (separate_debug_file_exists (debugfile, crc32, objfile->name))
+ goto cleanup_return_debugfile;
+ }
+
+ debugdir = debugdir_end;
}
+ while (*debugdir != 0);
xfree (debugfile);
debugfile = NULL;
@@ -4173,12 +4219,12 @@ Usage: set extension-language .foo bar"),
add_setshow_optional_filename_cmd ("debug-file-directory", class_support,
&debug_file_directory, _("\
-Set the directory where separate debug symbols are searched for."), _("\
-Show the directory where separate debug symbols are searched for."), _("\
+Set the directories where separate debug symbols are searched for."), _("\
+Show the directories where separate debug symbols are searched for."), _("\
Separate debug symbols are first searched for in the same\n\
directory as the binary, then in the `" DEBUG_SUBDIRECTORY "' subdirectory,\n\
and lastly at the path of the directory of the binary with\n\
-the global debug-file directory prepended."),
+each global debug-file-directory component prepended."),
NULL,
show_debug_file_directory,
&setlist, &showlist);
--- a/gdb/testsuite/gdb.base/sepdebug.exp
+++ b/gdb/testsuite/gdb.base/sepdebug.exp
@@ -995,6 +995,12 @@ if ![string compare $build_id_debug_filename ""] then {
test_different_dir build-id "${objdir}/${subdir}" $xfail
+ # Test also multiple directories can be specified. Without the build-id
+ # reference GDB would find the separate debug info just at the same
+ # location as the executable file.
+
+ test_different_dir multiple-dirs "/doesnotexist:${objdir}/${subdir}" $xfail
+
# Spare debug files may confuse testsuite runs in the future.
remote_exec build "rm -f ${objdir}/${subdir}/${build_id_debug_filename}"
}

View File

@ -0,0 +1,151 @@
http://sourceware.org/ml/gdb-patches/2009-10/msg00507.html
Subject: [patch 1/3] print the .debug file name having CRC mismatch
Hi,
this patch is left as is from Andrew Cagney.
Thanks,
Jan
gdb/
2005-04-02 Andrew Cagney <cagney@gnu.org>
* symfile.c (separate_debug_file_exists): When the CRCs mismatch
print a warning.
(find_separate_debug_file): Pass in the objfile's name.
gdb/testsuite/
2009-10-21 Jan Kratochvil <jan.kratochvil@redhat.com>
* gdb.base/sepdebug.exp (CRC mismatch is reported): New test.
* gdb.base/sepdebug2.c: New file.
--- a/gdb/symfile.c
+++ b/gdb/symfile.c
@@ -1283,7 +1283,8 @@ get_debug_link_info (struct objfile *objfile, unsigned long *crc32_out)
}
static int
-separate_debug_file_exists (const char *name, unsigned long crc)
+separate_debug_file_exists (const char *name, unsigned long crc,
+ const char *parent_name)
{
unsigned long file_crc = 0;
bfd *abfd;
@@ -1303,7 +1304,15 @@ separate_debug_file_exists (const char *name, unsigned long crc)
bfd_close (abfd);
- return crc == file_crc;
+ if (crc != file_crc)
+ {
+ warning (_("the debug information found in \"%s\""
+ " does not match \"%s\" (CRC mismatch).\n"),
+ name, parent_name);
+ return 0;
+ }
+
+ return 1;
}
char *debug_file_directory = NULL;
@@ -1355,6 +1364,8 @@ find_separate_debug_file (struct objfile *objfile)
basename = get_debug_link_info (objfile, &crc32);
if (basename == NULL)
+ /* There's no separate debug info, hence there's no way we could
+ load it => no warning. */
return NULL;
dir = xstrdup (objfile->name);
@@ -1388,7 +1399,7 @@ find_separate_debug_file (struct objfile *objfile)
strcpy (debugfile, dir);
strcat (debugfile, basename);
- if (separate_debug_file_exists (debugfile, crc32))
+ if (separate_debug_file_exists (debugfile, crc32, objfile->name))
{
xfree (basename);
xfree (dir);
@@ -1402,7 +1413,7 @@ find_separate_debug_file (struct objfile *objfile)
strcat (debugfile, "/");
strcat (debugfile, basename);
- if (separate_debug_file_exists (debugfile, crc32))
+ if (separate_debug_file_exists (debugfile, crc32, objfile->name))
{
xfree (basename);
xfree (dir);
@@ -1416,7 +1427,7 @@ find_separate_debug_file (struct objfile *objfile)
strcat (debugfile, dir);
strcat (debugfile, basename);
- if (separate_debug_file_exists (debugfile, crc32))
+ if (separate_debug_file_exists (debugfile, crc32, objfile->name))
{
xfree (basename);
xfree (dir);
@@ -1435,7 +1446,7 @@ find_separate_debug_file (struct objfile *objfile)
strcat (debugfile, "/");
strcat (debugfile, basename);
- if (separate_debug_file_exists (debugfile, crc32))
+ if (separate_debug_file_exists (debugfile, crc32, objfile->name))
{
xfree (canon_name);
xfree (basename);
--- a/gdb/testsuite/gdb.base/sepdebug.exp
+++ b/gdb/testsuite/gdb.base/sepdebug.exp
@@ -952,6 +952,23 @@ set debugfile "${objdir}/${subdir}/${testfile}.debug"
test_different_dir debuglink "${objdir}/${subdir}" 0
+# Test CRC mismatch is reported.
+
+if {[build_executable sepdebug.exp sepdebug2 sepdebug2.c debug] != -1
+ && ![gdb_gnu_strip_debug ${objdir}/${subdir}/sepdebug2]} {
+
+ remote_exec build "cp ${debugfile} ${objdir}/${subdir}/.debug/sepdebug2.debug"
+
+ gdb_exit
+ gdb_start
+ gdb_reinitialize_dir $srcdir/$subdir
+
+ set escapedobjdirsubdir [string_to_regexp ${objdir}/${subdir}]
+
+ gdb_test "file ${objdir}/${subdir}/sepdebug2" "warning: the debug information found in \"${escapedobjdirsubdir}/\\.debug/sepdebug2\\.debug\" does not match \"${escapedobjdirsubdir}/sepdebug2\" \\(CRC mismatch\\)\\..*\\(no debugging symbols found\\).*" "CRC mismatch is reported"
+}
+
+
# NT_GNU_BUILD_ID / .note.gnu.build-id test:
set build_id_debug_filename [build_id_debug_filename_get $binfile]
--- /dev/null
+++ b/gdb/testsuite/gdb.base/sepdebug2.c
@@ -0,0 +1,22 @@
+/* This testcase is part of GDB, the GNU debugger.
+
+ Copyright 2009 Free Software Foundation, Inc.
+
+ This program is free software; you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation; either version 3 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>. */
+
+int
+main (void)
+{
+ return 0;
+}

View File

@ -0,0 +1,82 @@
http://sourceware.org/ml/gdb-patches/2009-10/msg00142.html
Subject: [patch] Fix GNU/Linux core open: Can't read pathname for load map: Input/output error.
Hi,
GDB currently always prints on loading a core file:
warning: Can't read pathname for load map: Input/output error.
The patch is not nice but it was WONTFIXed on the glibc side in:
http://sourceware.org/ml/libc-alpha/2009-10/msg00001.html
The same message in GDB PR 8882 and glibc PR 387 was for ld-linux.so.2 l_name
but that one is now ignored thanks to IGNORE_FIRST_LINK_MAP_ENTRY.
This fix is intended for Linux system vDSO l_name which is a second entry in
the DSO list.
Regression tested on {x86_86,x86_64-m32,i686}-fedora11-linux-gnu.
Thanks,
Jan
gdb/
2009-10-06 Jan Kratochvil <jan.kratochvil@redhat.com>
Do not print false warning on reading core file with vDSO on GNU/Linux.
* solib-svr4.c (svr4_current_sos): Suppress the warning if
MASTER_SO_LIST is still NULL.
* solib.c (update_solib_list): New variable saved_so_list_head.
Conditionally restart the function.
[ Context backport. ]
--- a/gdb/solib-svr4.c
+++ b/gdb/solib-svr4.c
@@ -1097,8 +1097,18 @@ svr4_current_sos (void)
target_read_string (LM_NAME (new), &buffer,
SO_NAME_MAX_PATH_SIZE - 1, &errcode);
if (errcode != 0)
- warning (_("Can't read pathname for load map: %s."),
- safe_strerror (errcode));
+ {
+ /* During the first ever DSO list reading some strings may be
+ unreadable as residing in the ld.so readonly memory not being
+ present in a dumped core file. Delay the error check after
+ the first pass of DSO list scanning when ld.so should be
+ already mapped in and all the DSO list l_name memory gets
+ readable. */
+
+ if (master_so_list () != NULL)
+ warning (_("Can't read pathname for load map: %s."),
+ safe_strerror (errcode));
+ }
else
{
struct build_id *build_id;
--- a/gdb/solib.c
+++ b/gdb/solib.c
@@ -538,6 +538,7 @@ update_solib_list (int from_tty, struct target_ops *target)
struct target_so_ops *ops = solib_ops (target_gdbarch);
struct so_list *inferior = ops->current_sos();
struct so_list *gdb, **gdb_link;
+ struct so_list *saved_so_list_head = so_list_head;
/* We can reach here due to changing solib-search-path or the
sysroot, before having any inferior. */
@@ -668,6 +669,12 @@ update_solib_list (int from_tty, struct target_ops *target)
observer_notify_solib_loaded (i);
}
}
+
+ /* If this was the very first DSO list scan and we possibly read in ld.so
+ recheck all the formerly unreadable DSO names strings. */
+
+ if (saved_so_list_head == NULL && so_list_head != NULL)
+ update_solib_list (from_tty, target);
}

View File

@ -1,3 +1,19 @@
-------------------------------------------------------------------
Mon Oct 26 17:27:34 CET 2009 - rguenther@suse.de
- Merge from gdb-7.0-3.fc12.src.rpm.
-------------------------------------------------------------------
Thu Oct 22 17:03:30 CEST 2009 - rguenther@suse.de
- Merge from gdb-7.0-2.fc12.src.rpm. [fate#304116]
[bnc#488132] [bnc#498749]
-------------------------------------------------------------------
Mon Oct 19 12:48:43 CEST 2009 - rguenther@suse.de
- Recommend python-base.
------------------------------------------------------------------- -------------------------------------------------------------------
Mon Oct 12 10:22:38 CEST 2009 - rguenther@suse.de Mon Oct 12 10:22:38 CEST 2009 - rguenther@suse.de
@ -138,19 +154,20 @@ Mon Feb 16 11:40:00 CET 2009 - schwab@suse.de
- Update to head to trunk. - Update to head to trunk.
------------------------------------------------------------------- -------------------------------------------------------------------
Tue Feb 3 18:11:57 CET 2009 - schwab@suse.de Tue Feb 3 16:18:13 CET 2009 - schwab@suse.de
- Update to head to trunk. - Fix merge error.
------------------------------------------------------------------- -------------------------------------------------------------------
Thu Jan 22 17:12:42 CET 2009 - schwab@suse.de Thu Jan 22 17:17:14 CET 2009 - schwab@suse.de
- Update Cell combined debugger patch. - Add updates for Cell combined debugger.
------------------------------------------------------------------- -------------------------------------------------------------------
Fri Jan 16 16:02:56 CET 2009 - schwab@suse.de Tue Jan 20 15:45:56 CET 2009 - schwab@suse.de
- Update to head of trunk. - Do not call get_frame_arch for NULL frame pointers.
- Remove deprecated_safe_get_selected_frame call from read_var_value.
------------------------------------------------------------------- -------------------------------------------------------------------
Fri Jan 16 15:30:23 CET 2009 - bwalle@suse.de Fri Jan 16 15:30:23 CET 2009 - bwalle@suse.de

View File

@ -1,5 +1,5 @@
# #
# spec file for package gdb (Version 6.8.91.20090930) # spec file for package gdb (Version 7.0)
# #
# Copyright (c) 2009 SUSE LINUX Products GmbH, Nuernberg, Germany. # Copyright (c) 2009 SUSE LINUX Products GmbH, Nuernberg, Germany.
# #
@ -22,7 +22,7 @@ Name: gdb
# Set version to contents of gdb/version.in. # Set version to contents of gdb/version.in.
# NOTE: the FSF gdb versions are numbered N.M for official releases, like 6.3 # NOTE: the FSF gdb versions are numbered N.M for official releases, like 6.3
# and, since January 2005, X.Y.Z.date for daily snapshots, like 6.3.50.20050112 # (daily snapshot from mailine), or 6.3.0.20040112 (head of the release branch). # and, since January 2005, X.Y.Z.date for daily snapshots, like 6.3.50.20050112 # (daily snapshot from mailine), or 6.3.0.20040112 (head of the release branch).
Version: 6.8.91.20090930 Version: 7.0
Release: 1 Release: 1
# The release always contains a leading reserved number, start it at 1. # The release always contains a leading reserved number, start it at 1.
# `upstream' is not a part of `name' to stay fully rpm dependencies compatible for the testing. # `upstream' is not a part of `name' to stay fully rpm dependencies compatible for the testing.
@ -99,9 +99,6 @@ Patch142: gdb-6.3-terminal-fix-20050214.patch
Patch145: gdb-6.3-threaded-watchpoints2-20050225.patch Patch145: gdb-6.3-threaded-watchpoints2-20050225.patch
# Fix printing of inherited members # Fix printing of inherited members
Patch148: gdb-6.3-inheritance-20050324.patch Patch148: gdb-6.3-inheritance-20050324.patch
# Print a warning when the separate debug info's CRC doesn't match.
Patch150: gdb-6.3-test-sepcrc-20050402.patch
Patch151: gdb-6.3-sepcrc-20050402.patch
# Do not issue warning message about first page of storage for ia64 gcore # Do not issue warning message about first page of storage for ia64 gcore
Patch153: gdb-6.3-ia64-gcore-page0-20050421.patch Patch153: gdb-6.3-ia64-gcore-page0-20050421.patch
# Security errata for untrusted .gdbinit # Security errata for untrusted .gdbinit
@ -265,6 +262,12 @@ Patch375: gdb-readline-6.0.patch
Patch376: libstdc++-v3-python-common-prefix.patch Patch376: libstdc++-v3-python-common-prefix.patch
# New test for step-resume breakpoint placed in multiple threads at once. # New test for step-resume breakpoint placed in multiple threads at once.
Patch381: gdb-simultaneous-step-resume-breakpoint-test.patch Patch381: gdb-simultaneous-step-resume-breakpoint-test.patch
# Fix GNU/Linux core open: Can't read pathname for load map: Input/output error.
Patch382: gdb-core-open-vdso-warning.patch
# Support multiple directories for `set debug-file-directory' (BZ 528668).
Patch383: gdb-bz528668-symfile-sepcrc.patch
Patch384: gdb-bz528668-symfile-cleanup.patch
Patch385: gdb-bz528668-symfile-multi.patch
# Fix readline 5.1 warnings # Fix readline 5.1 warnings
Patch1000: readline-5.1-random.patch Patch1000: readline-5.1-random.patch
Patch1002: gdb-6.6-buildid-locate-rpm-suse.patch Patch1002: gdb-6.6-buildid-locate-rpm-suse.patch
@ -280,6 +283,9 @@ BuildRequires: readline-devel
#Requires: rpm-libs #Requires: rpm-libs
BuildRequires: rpm-devel BuildRequires: rpm-devel
%if 0%{!?_without_python:1} %if 0%{!?_without_python:1}
%if 0%{suse_version} > 1000
Recommends: python-base
%endif
BuildRequires: python-devel BuildRequires: python-devel
# Temporarily before it gets moved to libstdc++.rpm # Temporarily before it gets moved to libstdc++.rpm
BuildRequires: libstdc++ BuildRequires: libstdc++
@ -342,6 +348,9 @@ rm -f gdb/jv-exp.c gdb/m2-exp.c gdb/objc-exp.c gdb/p-exp.c
%if 0%{!?_with_upstream:1} %if 0%{!?_with_upstream:1}
#patch232 -p1 #patch232 -p1
%patch349 -p1 %patch349 -p1
%patch383 -p1
%patch384 -p1
%patch385 -p1
%patch1 -p1 %patch1 -p1
%patch3 -p1 %patch3 -p1
%patch104 -p1 %patch104 -p1
@ -361,8 +370,6 @@ rm -f gdb/jv-exp.c gdb/m2-exp.c gdb/objc-exp.c gdb/p-exp.c
%patch142 -p1 %patch142 -p1
%patch145 -p1 %patch145 -p1
%patch148 -p1 %patch148 -p1
%patch150 -p1
%patch151 -p1
%patch153 -p1 %patch153 -p1
%patch157 -p1 %patch157 -p1
%patch158 -p1 %patch158 -p1
@ -444,6 +451,7 @@ rm -f gdb/jv-exp.c gdb/m2-exp.c gdb/objc-exp.c gdb/p-exp.c
%patch375 -p1 %patch375 -p1
%patch376 -p1 %patch376 -p1
%patch381 -p1 %patch381 -p1
%patch382 -p1
%patch124 -p1 %patch124 -p1
%patch1000 %patch1000
%patch1002 -p1 %patch1002 -p1