Fix build-id-core-loads internal error (BZ 837870).

This commit is contained in:
Jan Kratochvil 2012-07-06 16:01:10 +02:00
parent c501c4bdb1
commit 5387893eab
3 changed files with 80 additions and 36 deletions

View File

@ -1,7 +1,7 @@
Index: gdb-7.4.50.20120703/gdb/corelow.c
===================================================================
--- gdb-7.4.50.20120703.orig/gdb/corelow.c 2012-07-03 17:30:07.000000000 +0200
+++ gdb-7.4.50.20120703/gdb/corelow.c 2012-07-03 17:33:27.882513714 +0200
--- gdb-7.4.50.20120703.orig/gdb/corelow.c 2012-07-06 15:04:04.378487860 +0200
+++ gdb-7.4.50.20120703/gdb/corelow.c 2012-07-06 15:38:41.272908113 +0200
@@ -47,6 +47,9 @@
#include "progspace.h"
#include "objfiles.h"
@ -65,20 +65,22 @@ Index: gdb-7.4.50.20120703/gdb/corelow.c
/* This routine opens and sets up the core file bfd. */
static void
@@ -378,6 +427,12 @@ core_open (char *filename, int from_tty)
push_target (&core_ops);
discard_cleanups (old_chain);
@@ -420,6 +469,14 @@ core_open (char *filename, int from_tty)
switch_to_thread (thread->ptid);
}
+ /* Find the build_id identifiers. If it gets executed after
+ POST_CREATE_INFERIOR we would clash with asking to discard the already
+ loaded VDSO symbols. */
+ loaded VDSO symbols. If it gets executed before bfd_map_over_sections
+ INFERIOR_PTID is still not set and libthread_db initialization crashes on
+ PID == 0 in ps_pglobal_lookup. */
+ if (build_id_core_loads != 0)
+ build_id_locate_exec (from_tty);
+
/* Do this before acknowledging the inferior, so if
post_create_inferior throws (can happen easilly if you're loading
a core file with the wrong exec), we aren't left with threads
@@ -941,4 +996,11 @@ _initialize_corelow (void)
post_create_inferior (&core_ops, from_tty);
/* Now go through the target stack looking for threads since there
@@ -941,4 +998,11 @@ _initialize_corelow (void)
init_core_ops ();
add_target (&core_ops);
@ -92,8 +94,8 @@ Index: gdb-7.4.50.20120703/gdb/corelow.c
}
Index: gdb-7.4.50.20120703/gdb/doc/gdb.texinfo
===================================================================
--- gdb-7.4.50.20120703.orig/gdb/doc/gdb.texinfo 2012-07-03 17:31:40.000000000 +0200
+++ gdb-7.4.50.20120703/gdb/doc/gdb.texinfo 2012-07-03 17:33:14.630529528 +0200
--- gdb-7.4.50.20120703.orig/gdb/doc/gdb.texinfo 2012-07-06 15:04:04.378487860 +0200
+++ gdb-7.4.50.20120703/gdb/doc/gdb.texinfo 2012-07-06 15:04:26.069463330 +0200
@@ -16530,6 +16530,27 @@ information files.
@end table
@ -124,8 +126,8 @@ Index: gdb-7.4.50.20120703/gdb/doc/gdb.texinfo
A debug link is a special section of the executable file named
Index: gdb-7.4.50.20120703/gdb/solib-svr4.c
===================================================================
--- gdb-7.4.50.20120703.orig/gdb/solib-svr4.c 2012-06-05 17:44:03.000000000 +0200
+++ gdb-7.4.50.20120703/gdb/solib-svr4.c 2012-07-03 17:33:14.631529527 +0200
--- gdb-7.4.50.20120703.orig/gdb/solib-svr4.c 2012-07-06 15:04:04.378487860 +0200
+++ gdb-7.4.50.20120703/gdb/solib-svr4.c 2012-07-06 15:38:41.433907928 +0200
@@ -1227,9 +1227,52 @@ svr4_read_so_list (CORE_ADDR lm, struct
continue;
}
@ -184,8 +186,8 @@ Index: gdb-7.4.50.20120703/gdb/solib-svr4.c
/* If this entry has no name, or its name matches the name
Index: gdb-7.4.50.20120703/gdb/elfread.c
===================================================================
--- gdb-7.4.50.20120703.orig/gdb/elfread.c 2012-07-03 17:30:07.000000000 +0200
+++ gdb-7.4.50.20120703/gdb/elfread.c 2012-07-03 17:34:04.778468965 +0200
--- gdb-7.4.50.20120703.orig/gdb/elfread.c 2012-07-06 15:04:04.378487860 +0200
+++ gdb-7.4.50.20120703/gdb/elfread.c 2012-07-06 15:38:41.272908113 +0200
@@ -45,6 +45,11 @@
#include "regcache.h"
#include "bcache.h"
@ -962,8 +964,8 @@ Index: gdb-7.4.50.20120703/gdb/elfread.c
}
Index: gdb-7.4.50.20120703/gdb/symfile.h
===================================================================
--- gdb-7.4.50.20120703.orig/gdb/symfile.h 2012-05-25 00:14:35.000000000 +0200
+++ gdb-7.4.50.20120703/gdb/symfile.h 2012-07-03 17:33:14.632529526 +0200
--- gdb-7.4.50.20120703.orig/gdb/symfile.h 2012-07-06 15:04:04.378487860 +0200
+++ gdb-7.4.50.20120703/gdb/symfile.h 2012-07-06 15:38:41.272908113 +0200
@@ -615,6 +615,13 @@ void free_symfile_segment_data (struct s
extern struct cleanup *increment_reading_symtab (void);
@ -980,8 +982,8 @@ Index: gdb-7.4.50.20120703/gdb/symfile.h
/* Names for a dwarf2 debugging section. The field NORMAL is the normal
Index: gdb-7.4.50.20120703/gdb/testsuite/lib/gdb.exp
===================================================================
--- gdb-7.4.50.20120703.orig/gdb/testsuite/lib/gdb.exp 2012-07-03 17:30:09.000000000 +0200
+++ gdb-7.4.50.20120703/gdb/testsuite/lib/gdb.exp 2012-07-03 17:33:14.633529524 +0200
--- gdb-7.4.50.20120703.orig/gdb/testsuite/lib/gdb.exp 2012-07-06 15:04:04.378487860 +0200
+++ gdb-7.4.50.20120703/gdb/testsuite/lib/gdb.exp 2012-07-06 15:38:41.272908113 +0200
@@ -1388,6 +1388,16 @@ proc default_gdb_start { } {
warning "Couldn't set the width to 0."
}
@ -1001,8 +1003,8 @@ Index: gdb-7.4.50.20120703/gdb/testsuite/lib/gdb.exp
Index: gdb-7.4.50.20120703/gdb/testsuite/lib/mi-support.exp
===================================================================
--- gdb-7.4.50.20120703.orig/gdb/testsuite/lib/mi-support.exp 2012-04-14 14:18:44.000000000 +0200
+++ gdb-7.4.50.20120703/gdb/testsuite/lib/mi-support.exp 2012-07-03 17:33:14.633529524 +0200
--- gdb-7.4.50.20120703.orig/gdb/testsuite/lib/mi-support.exp 2012-07-06 15:04:04.378487860 +0200
+++ gdb-7.4.50.20120703/gdb/testsuite/lib/mi-support.exp 2012-07-06 15:38:41.272908113 +0200
@@ -213,6 +213,16 @@ proc default_mi_gdb_start { args } {
warning "Couldn't set the width to 0."
}
@ -1022,8 +1024,8 @@ Index: gdb-7.4.50.20120703/gdb/testsuite/lib/mi-support.exp
if { $separate_inferior_pty } {
Index: gdb-7.4.50.20120703/gdb/objfiles.h
===================================================================
--- gdb-7.4.50.20120703.orig/gdb/objfiles.h 2012-07-03 17:30:07.000000000 +0200
+++ gdb-7.4.50.20120703/gdb/objfiles.h 2012-07-03 17:33:14.633529524 +0200
--- gdb-7.4.50.20120703.orig/gdb/objfiles.h 2012-07-06 15:04:04.378487860 +0200
+++ gdb-7.4.50.20120703/gdb/objfiles.h 2012-07-06 15:04:26.073463324 +0200
@@ -432,6 +432,10 @@ struct objfile
#define OBJF_MAINLINE (1 << 5)
@ -1035,3 +1037,41 @@ Index: gdb-7.4.50.20120703/gdb/objfiles.h
/* The object file that contains the runtime common minimal symbols
for SunOS4. Note that this objfile has no associated BFD. */
Index: gdb-7.4.50.20120703/gdb/testsuite/gdb.base/corefile.exp
===================================================================
--- gdb-7.4.50.20120703.orig/gdb/testsuite/gdb.base/corefile.exp 2012-06-21 22:46:21.000000000 +0200
+++ gdb-7.4.50.20120703/gdb/testsuite/gdb.base/corefile.exp 2012-07-06 15:39:41.601838633 +0200
@@ -256,3 +256,33 @@ if ![is_remote target] {
gdb_exit
}
+
+
+# Test auto-loading of binary files through build-id from the core file.
+set buildid [build_id_debug_filename_get $binfile]
+set wholetest "binfile found by build-id"
+if {$buildid == ""} {
+ untested "$wholetest (binary has no build-id)"
+} else {
+ gdb_exit
+ gdb_start
+
+ regsub {\.debug$} $buildid {} buildid
+ set debugdir ${objdir}/${subdir}/${testfile}-debugdir
+ file delete -force -- $debugdir
+ file mkdir $debugdir/[file dirname $buildid]
+ file copy $binfile $debugdir/$buildid
+
+ set test "show debug-file-directory"
+ gdb_test_multiple $test $test {
+ -re "The directory where separate debug symbols are searched for is \"(.*)\"\\.\r\n$gdb_prompt $" {
+ set debugdir_orig $expect_out(1,string)
+ pass $test
+ }
+ }
+ gdb_test_no_output "set debug-file-directory $debugdir:$debugdir_orig" "set debug-file-directory"
+ gdb_test "show build-id-core-loads" {Whether CORE-FILE loads the build-id associated files automatically is on\.}
+ gdb_test "core-file $corefile" "\r\nProgram terminated with .*" "core-file without executable"
+ gdb_test "info files" "Local exec file:\r\n\[ \t\]*`[string_to_regexp $debugdir/$buildid]', file type .*"
+ pass $wholetest
+}

View File

@ -5,8 +5,8 @@ Subject: [patch] Fix GNU/Linux core open: Can't read pathname for load map: Inp
Index: gdb-7.4.50.20120703/gdb/solib-svr4.c
===================================================================
--- gdb-7.4.50.20120703.orig/gdb/solib-svr4.c 2012-07-03 17:34:18.000000000 +0200
+++ gdb-7.4.50.20120703/gdb/solib-svr4.c 2012-07-03 17:34:35.614432174 +0200
--- gdb-7.4.50.20120703.orig/gdb/solib-svr4.c 2012-07-06 15:39:57.000000000 +0200
+++ gdb-7.4.50.20120703/gdb/solib-svr4.c 2012-07-06 15:40:01.124816148 +0200
@@ -1221,8 +1221,17 @@ svr4_read_so_list (CORE_ADDR lm, struct
SO_NAME_MAX_PATH_SIZE - 1, &errcode);
if (errcode != 0)
@ -29,8 +29,8 @@ Index: gdb-7.4.50.20120703/gdb/solib-svr4.c
}
Index: gdb-7.4.50.20120703/gdb/solib.c
===================================================================
--- gdb-7.4.50.20120703.orig/gdb/solib.c 2012-07-03 17:30:07.000000000 +0200
+++ gdb-7.4.50.20120703/gdb/solib.c 2012-07-03 17:34:35.616432172 +0200
--- gdb-7.4.50.20120703.orig/gdb/solib.c 2012-07-06 15:38:39.000000000 +0200
+++ gdb-7.4.50.20120703/gdb/solib.c 2012-07-06 15:40:01.125816147 +0200
@@ -672,7 +672,7 @@ solib_used (const struct so_list *const
processes we've just attached to, so that's okay. */
@ -64,13 +64,14 @@ Index: gdb-7.4.50.20120703/gdb/solib.c
Index: gdb-7.4.50.20120703/gdb/testsuite/gdb.base/corefile.exp
===================================================================
--- gdb-7.4.50.20120703.orig/gdb/testsuite/gdb.base/corefile.exp 2012-06-21 22:46:21.000000000 +0200
+++ gdb-7.4.50.20120703/gdb/testsuite/gdb.base/corefile.exp 2012-07-03 17:34:35.617432171 +0200
@@ -256,3 +256,18 @@ if ![is_remote target] {
gdb_exit
--- gdb-7.4.50.20120703.orig/gdb/testsuite/gdb.base/corefile.exp 2012-07-06 15:39:41.000000000 +0200
+++ gdb-7.4.50.20120703/gdb/testsuite/gdb.base/corefile.exp 2012-07-06 15:40:10.322805539 +0200
@@ -286,3 +286,19 @@ if {$buildid == ""} {
gdb_test "info files" "Local exec file:\r\n\[ \t\]*`[string_to_regexp $debugdir/$buildid]', file type .*"
pass $wholetest
}
+
+
+# Test Linux specific vDSO warning:
+# warning: Can't read pathname for load map: Input/output error.
+
@ -87,8 +88,8 @@ Index: gdb-7.4.50.20120703/gdb/testsuite/gdb.base/corefile.exp
+}
Index: gdb-7.4.50.20120703/gdb/testsuite/gdb.base/solib-symbol.exp
===================================================================
--- gdb-7.4.50.20120703.orig/gdb/testsuite/gdb.base/solib-symbol.exp 2012-06-21 22:46:22.000000000 +0200
+++ gdb-7.4.50.20120703/gdb/testsuite/gdb.base/solib-symbol.exp 2012-07-03 17:36:06.520322820 +0200
--- gdb-7.4.50.20120703.orig/gdb/testsuite/gdb.base/solib-symbol.exp 2012-07-06 15:38:39.000000000 +0200
+++ gdb-7.4.50.20120703/gdb/testsuite/gdb.base/solib-symbol.exp 2012-07-06 15:40:01.127816145 +0200
@@ -27,7 +27,8 @@ set lib_flags [list debug ldflags=-Wl,-B
# Binary file.
set testfile "solib-symbol-main"

View File

@ -35,7 +35,7 @@ Version: 7.4.50.%{snap}
# 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.
Release: 9%{?dist}
Release: 10%{?dist}
License: GPLv3+ and GPLv3+ with exceptions and GPLv2+ and GPLv2+ with exceptions and GPL+ and LGPLv2+ and BSD and Public Domain
Group: Development/Debuggers
@ -1352,6 +1352,9 @@ fi
%endif # 0%{!?el5:1} || "%{_target_cpu}" == "noarch"
%changelog
* Fri Jul 6 2012 Jan Kratochvil <jan.kratochvil@redhat.com> - 7.4.50.20120703-10.fc18
- Fix build-id-core-loads internal error (BZ 837870).
* Thu Jul 5 2012 Jan Kratochvil <jan.kratochvil@redhat.com> - 7.4.50.20120703-9.fc18
- Implement MiniDebugInfo F-18 Feature consumer (Alexander Larsson, BZ 834068).