Fix attach/core-load of {,un}prelinked i386 libs (bugreport by Michal Toman).
Fix threading internal error on corrupted memory (BZ 677654).
This commit is contained in:
parent
5bf2ffefc9
commit
89365c2014
155
gdb-core-thread-internalerr-1of3.patch
Normal file
155
gdb-core-thread-internalerr-1of3.patch
Normal file
@ -0,0 +1,155 @@
|
|||||||
|
http://sourceware.org/ml/gdb-patches/2011-02/msg00679.html
|
||||||
|
Subject: Re: [patch 1/3] Code cleanup: gdb.threads/gcore-thread.exp
|
||||||
|
|
||||||
|
On Thu, 24 Feb 2011 08:20:09 +0100, Joel Brobecker wrote:
|
||||||
|
> Just a thought: Do we really need to worry about restoring
|
||||||
|
> the timeout at the end of the testcase, given that this is
|
||||||
|
> automatically done at the start of each testcase (see gdb.exp:
|
||||||
|
> gdb_init)?
|
||||||
|
|
||||||
|
I see now:
|
||||||
|
Re: [RFA/testsuite] Reset the timeout duration at the start of each testcase.
|
||||||
|
http://sourceware.org/ml/gdb-patches/2010-02/msg00202.html
|
||||||
|
commit 501c57da40fd27c8036a5fc995f750b0559272ad
|
||||||
|
|
||||||
|
Patch updated.
|
||||||
|
|
||||||
|
|
||||||
|
Thanks,
|
||||||
|
Jan
|
||||||
|
|
||||||
|
|
||||||
|
gdb/testsuite/
|
||||||
|
2011-02-24 Jan Kratochvil <jan.kratochvil@redhat.com>
|
||||||
|
|
||||||
|
* gdb.threads/gcore-thread.exp ($testfile): Match it the .exp
|
||||||
|
filename.
|
||||||
|
($srcfile): Preserve the original value.
|
||||||
|
($testfile): Match it the .exp filename.
|
||||||
|
($corefile): New variable. Substitute it around.
|
||||||
|
Use clean_restart.
|
||||||
|
($prev_timeout): Remove.
|
||||||
|
(load_core): Move core loading into this proc.
|
||||||
|
Fix restore of $timeout if load_core fails.
|
||||||
|
|
||||||
|
Index: gdb-7.2/gdb/testsuite/gdb.threads/gcore-thread.exp
|
||||||
|
===================================================================
|
||||||
|
--- gdb-7.2.orig/gdb/testsuite/gdb.threads/gcore-thread.exp 2011-02-24 09:56:04.000000000 +0100
|
||||||
|
+++ gdb-7.2/gdb/testsuite/gdb.threads/gcore-thread.exp 2011-02-24 09:56:57.000000000 +0100
|
||||||
|
@@ -21,11 +21,11 @@ if $tracelevel then {
|
||||||
|
strace $tracelevel
|
||||||
|
}
|
||||||
|
|
||||||
|
-
|
||||||
|
# Single-threaded test case
|
||||||
|
-set testfile "pthreads"
|
||||||
|
-set srcfile ${testfile}.c
|
||||||
|
-set binfile ${objdir}/${subdir}/gcore-${testfile}
|
||||||
|
+set testfile "gcore-thread"
|
||||||
|
+set srcfile pthreads.c
|
||||||
|
+set binfile ${objdir}/${subdir}/${testfile}
|
||||||
|
+set corefile ${objdir}/${subdir}/${testfile}.test
|
||||||
|
|
||||||
|
if [istarget "*-*-linux"] then {
|
||||||
|
set target_cflags "-D_MIT_POSIX_THREADS"
|
||||||
|
@@ -41,10 +41,7 @@ if {[gdb_compile_pthreads "${srcdir}/${s
|
||||||
|
|
||||||
|
# Start with a fresh gdb.
|
||||||
|
|
||||||
|
-gdb_exit
|
||||||
|
-gdb_start
|
||||||
|
-gdb_reinitialize_dir $srcdir/$subdir
|
||||||
|
-gdb_load ${binfile}
|
||||||
|
+clean_restart ${testfile}
|
||||||
|
|
||||||
|
# regexp for "horizontal" text (i.e. doesn't include newline or
|
||||||
|
# carriage return)
|
||||||
|
@@ -66,7 +63,6 @@ proc pthread_self {name} {
|
||||||
|
return ""
|
||||||
|
}
|
||||||
|
|
||||||
|
-set prev_timeout $timeout
|
||||||
|
set timeout 30
|
||||||
|
|
||||||
|
gdb_test_multiple "help gcore" "help gcore" {
|
||||||
|
@@ -109,10 +105,9 @@ gdb_breakpoint "thread2"
|
||||||
|
gdb_test "continue" "Continuing.*Breakpoint.* thread2 .*" "thread 2 is running"
|
||||||
|
set thread2_self [pthread_self thread2]
|
||||||
|
|
||||||
|
-set escapedfilename [string_to_regexp ${objdir}/${subdir}/gcore.test]
|
||||||
|
+set escapedfilename [string_to_regexp $corefile]
|
||||||
|
# Drop corefile
|
||||||
|
-gdb_test_multiple "gcore ${objdir}/${subdir}/gcore.test" \
|
||||||
|
- "save a corefile" \
|
||||||
|
+gdb_test_multiple "gcore $corefile" "save a corefile" \
|
||||||
|
{
|
||||||
|
-re "Saved corefile ${escapedfilename}\[\r\n\]+$gdb_prompt $" {
|
||||||
|
pass "save a corefile"
|
||||||
|
@@ -131,31 +126,38 @@ if {!$core_supported} {
|
||||||
|
return -1
|
||||||
|
}
|
||||||
|
|
||||||
|
+
|
||||||
|
# Now restart gdb and load the corefile.
|
||||||
|
-gdb_exit
|
||||||
|
-gdb_start
|
||||||
|
-gdb_reinitialize_dir $srcdir/$subdir
|
||||||
|
-gdb_load ${binfile}
|
||||||
|
-
|
||||||
|
-gdb_test_multiple "core ${objdir}/${subdir}/gcore.test" \
|
||||||
|
- "re-load generated corefile" {
|
||||||
|
- -re ".* is not a core dump:.*$gdb_prompt $" {
|
||||||
|
- fail "re-load generated corefile (bad file format)"
|
||||||
|
- # No use proceeding from here.
|
||||||
|
- return;
|
||||||
|
- }
|
||||||
|
- -re ".*: No such file or directory.*$gdb_prompt $" {
|
||||||
|
- fail "re-load generated corefile (file not found)"
|
||||||
|
- # No use proceeding from here.
|
||||||
|
- return;
|
||||||
|
- }
|
||||||
|
- -re ".*Couldn't find .* registers in core file.*$gdb_prompt $" {
|
||||||
|
- fail "re-load generated corefile (incomplete note section)"
|
||||||
|
- }
|
||||||
|
- -re "Core was generated by .*$gdb_prompt $" {
|
||||||
|
- pass "re-load generated corefile"
|
||||||
|
+clean_restart ${testfile}
|
||||||
|
+
|
||||||
|
+proc load_core { corefile } {
|
||||||
|
+ global gdb_prompt
|
||||||
|
+
|
||||||
|
+ gdb_test_multiple "core $corefile" \
|
||||||
|
+ "re-load generated corefile" {
|
||||||
|
+ -re " is not a core dump:.*\r\n$gdb_prompt $" {
|
||||||
|
+ fail "re-load generated corefile (bad file format)"
|
||||||
|
+ # No use proceeding from here.
|
||||||
|
+ return 0;
|
||||||
|
+ }
|
||||||
|
+ -re ": No such file or directory.*\r\n$gdb_prompt $" {
|
||||||
|
+ fail "re-load generated corefile (file not found)"
|
||||||
|
+ # No use proceeding from here.
|
||||||
|
+ return 0;
|
||||||
|
+ }
|
||||||
|
+ -re "Couldn't find .* registers in core file.*\r\n$gdb_prompt $" {
|
||||||
|
+ fail "re-load generated corefile (incomplete note section)"
|
||||||
|
+ }
|
||||||
|
+ -re "Core was generated by .*\r\n$gdb_prompt $" {
|
||||||
|
+ pass "re-load generated corefile"
|
||||||
|
+ }
|
||||||
|
}
|
||||||
|
- }
|
||||||
|
+ return 1
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+if ![load_core $corefile] {
|
||||||
|
+ return
|
||||||
|
+}
|
||||||
|
|
||||||
|
# FIXME: now what can we test about the thread state?
|
||||||
|
# We do not know for certain that there should be at least
|
||||||
|
@@ -181,5 +183,3 @@ if [istarget "*-*-linux*"] then {
|
||||||
|
gdb_test "info threads" "Thread $thread1_self .*" "thread1 pthread_self found"
|
||||||
|
gdb_test "info threads" "Thread $thread2_self .*" "thread2 pthread_self found"
|
||||||
|
}
|
||||||
|
-
|
||||||
|
-set timeout $prev_timeout
|
105
gdb-core-thread-internalerr-2of3.patch
Normal file
105
gdb-core-thread-internalerr-2of3.patch
Normal file
@ -0,0 +1,105 @@
|
|||||||
|
http://sourceware.org/ml/gdb-patches/2011-02/msg00680.html
|
||||||
|
Subject: [patch 2/3] Fix threading internal error on corrupted memory [rediff]
|
||||||
|
|
||||||
|
[rediff]
|
||||||
|
|
||||||
|
gdb/
|
||||||
|
2011-02-24 Jan Kratochvil <jan.kratochvil@redhat.com>
|
||||||
|
|
||||||
|
* linux-thread-db.c (find_new_threads_callback): Exit on zero TI_TID
|
||||||
|
even if !TARGET_HAS_EXECUTION.
|
||||||
|
|
||||||
|
gdb/testsuite/
|
||||||
|
2011-02-24 Jan Kratochvil <jan.kratochvil@redhat.com>
|
||||||
|
|
||||||
|
* gdb.threads/gcore-thread.exp ($core0file): New variable.
|
||||||
|
(clear __stack_user.next, clear stack_used.next)
|
||||||
|
(save a zeroed-threads corefile): New test.
|
||||||
|
Call core_load for $core0file.
|
||||||
|
(zeroed-threads cannot be listed): New test.
|
||||||
|
|
||||||
|
Index: gdb-7.2/gdb/linux-thread-db.c
|
||||||
|
===================================================================
|
||||||
|
--- gdb-7.2.orig/gdb/linux-thread-db.c 2011-02-24 09:56:04.000000000 +0100
|
||||||
|
+++ gdb-7.2/gdb/linux-thread-db.c 2011-02-24 09:57:12.000000000 +0100
|
||||||
|
@@ -1321,7 +1321,7 @@ find_new_threads_callback (const td_thrh
|
||||||
|
if (ti.ti_state == TD_THR_UNKNOWN || ti.ti_state == TD_THR_ZOMBIE)
|
||||||
|
return 0; /* A zombie -- ignore. */
|
||||||
|
|
||||||
|
- if (ti.ti_tid == 0 && target_has_execution)
|
||||||
|
+ if (ti.ti_tid == 0)
|
||||||
|
{
|
||||||
|
/* A thread ID of zero means that this is the main thread, but
|
||||||
|
glibc has not yet initialized thread-local storage and the
|
||||||
|
@@ -1333,10 +1333,13 @@ find_new_threads_callback (const td_thrh
|
||||||
|
need this glibc bug workaround. */
|
||||||
|
info->need_stale_parent_threads_check = 0;
|
||||||
|
|
||||||
|
- err = info->td_thr_event_enable_p (th_p, 1);
|
||||||
|
- if (err != TD_OK)
|
||||||
|
- error (_("Cannot enable thread event reporting for LWP %d: %s"),
|
||||||
|
- (int) ti.ti_lid, thread_db_err_str (err));
|
||||||
|
+ if (target_has_execution)
|
||||||
|
+ {
|
||||||
|
+ err = info->td_thr_event_enable_p (th_p, 1);
|
||||||
|
+ if (err != TD_OK)
|
||||||
|
+ error (_("Cannot enable thread event reporting for LWP %d: %s"),
|
||||||
|
+ (int) ti.ti_lid, thread_db_err_str (err));
|
||||||
|
+ }
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
Index: gdb-7.2/gdb/testsuite/gdb.threads/gcore-thread.exp
|
||||||
|
===================================================================
|
||||||
|
--- gdb-7.2.orig/gdb/testsuite/gdb.threads/gcore-thread.exp 2011-02-24 09:56:57.000000000 +0100
|
||||||
|
+++ gdb-7.2/gdb/testsuite/gdb.threads/gcore-thread.exp 2011-02-24 09:57:27.000000000 +0100
|
||||||
|
@@ -26,6 +26,7 @@ set testfile "gcore-thread"
|
||||||
|
set srcfile pthreads.c
|
||||||
|
set binfile ${objdir}/${subdir}/${testfile}
|
||||||
|
set corefile ${objdir}/${subdir}/${testfile}.test
|
||||||
|
+set core0file ${objdir}/${subdir}/${testfile}0.test
|
||||||
|
|
||||||
|
if [istarget "*-*-linux"] then {
|
||||||
|
set target_cflags "-D_MIT_POSIX_THREADS"
|
||||||
|
@@ -127,6 +128,29 @@ if {!$core_supported} {
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
+# Test the uninitialized thread list.
|
||||||
|
+# Provide the case of glibc td_thr_get_info handling of:
|
||||||
|
+# /* Special case for the main thread before initialization. */
|
||||||
|
+
|
||||||
|
+foreach symbol {__stack_user stack_used} {
|
||||||
|
+ set test "clear ${symbol}.next"
|
||||||
|
+ gdb_test_multiple "p *(void **) &${symbol} = 0" $test {
|
||||||
|
+ -re " = \\(void \\*\\) 0x0\r\n$gdb_prompt $" {
|
||||||
|
+ pass $test
|
||||||
|
+ }
|
||||||
|
+ -re "No symbol \"${symbol}\" in current context\\.\r\n$gdb_prompt $" {
|
||||||
|
+ xfail $test
|
||||||
|
+ # Do not do the verification.
|
||||||
|
+ set core0file ""
|
||||||
|
+ }
|
||||||
|
+ }
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+if {"$core0file" != ""} {
|
||||||
|
+ gdb_test "gcore $core0file" "Saved corefile .*" "save a zeroed-threads corefile"
|
||||||
|
+}
|
||||||
|
+
|
||||||
|
+
|
||||||
|
# Now restart gdb and load the corefile.
|
||||||
|
clean_restart ${testfile}
|
||||||
|
|
||||||
|
@@ -183,3 +207,11 @@ if [istarget "*-*-linux*"] then {
|
||||||
|
gdb_test "info threads" "Thread $thread1_self .*" "thread1 pthread_self found"
|
||||||
|
gdb_test "info threads" "Thread $thread2_self .*" "thread2 pthread_self found"
|
||||||
|
}
|
||||||
|
+
|
||||||
|
+
|
||||||
|
+# Test the uninitialized thread list.
|
||||||
|
+
|
||||||
|
+if {"$core0file" != "" && [load_core $core0file]} {
|
||||||
|
+
|
||||||
|
+ gdb_test "info threads" "Cannot find new threads: .*" "zeroed-threads cannot be listed"
|
||||||
|
+}
|
99
gdb-core-thread-internalerr-3of3.patch
Normal file
99
gdb-core-thread-internalerr-3of3.patch
Normal file
@ -0,0 +1,99 @@
|
|||||||
|
http://sourceware.org/ml/gdb-patches/2011-02/msg00675.html
|
||||||
|
Subject: [patch 3/3] Display core reasons even during thread error
|
||||||
|
|
||||||
|
Hi,
|
||||||
|
|
||||||
|
this is mostly unrelated. But after the patch 2/3 it will still FAIL:
|
||||||
|
Loaded symbols for /lib64/ld-linux-x86-64.so.2
|
||||||
|
Cannot find new threads: debugger service failed
|
||||||
|
(gdb) FAIL: gdb.threads/gcore-thread.exp: re-load generated corefile
|
||||||
|
|
||||||
|
as it is a common bug I dislike for years I have fixed it here:
|
||||||
|
Loaded symbols for /lib64/ld-linux-x86-64.so.2
|
||||||
|
Cannot find new threads: debugger service failed
|
||||||
|
Core was generated by `.../gdb/testsuite/gdb.threads/gcore-thread'.
|
||||||
|
Program terminated with signal 5, Trace/breakpoint trap.
|
||||||
|
#0 thread2 (arg=0xdeadbeef) at ./gdb.threads/pthreads.c:91
|
||||||
|
91 int k = 0;
|
||||||
|
(gdb) PASS: gdb.threads/gcore-thread.exp: re-load generated corefile
|
||||||
|
|
||||||
|
No regressions on {x86_64,x86_64-m32,i686}-fedora15-linux-gnu.
|
||||||
|
|
||||||
|
|
||||||
|
Thanks,
|
||||||
|
Jan
|
||||||
|
|
||||||
|
|
||||||
|
gdb/
|
||||||
|
2011-02-24 Jan Kratochvil <jan.kratochvil@redhat.com>
|
||||||
|
|
||||||
|
* corelow.c: Include wrapper.h.
|
||||||
|
(core_open): Call now gdb_target_find_new_threads.
|
||||||
|
* wrapper.c: Include target.h.
|
||||||
|
(gdb_target_find_new_threads): New.
|
||||||
|
* wrapper.h (gdb_target_find_new_threads): New declaration.
|
||||||
|
|
||||||
|
--- a/gdb/corelow.c
|
||||||
|
+++ b/gdb/corelow.c
|
||||||
|
@@ -47,6 +47,7 @@
|
||||||
|
#include "auxv.h"
|
||||||
|
#include "elf/common.h"
|
||||||
|
#include "gdbcmd.h"
|
||||||
|
+#include "wrapper.h"
|
||||||
|
|
||||||
|
|
||||||
|
#ifndef O_LARGEFILE
|
||||||
|
@@ -428,7 +429,7 @@ core_open (char *filename, int from_tty)
|
||||||
|
may be a thread_stratum target loaded on top of target core by
|
||||||
|
now. The layer above should claim threads found in the BFD
|
||||||
|
sections. */
|
||||||
|
- target_find_new_threads ();
|
||||||
|
+ gdb_target_find_new_threads ();
|
||||||
|
|
||||||
|
p = bfd_core_file_failing_command (core_bfd);
|
||||||
|
if (p)
|
||||||
|
--- a/gdb/wrapper.c
|
||||||
|
+++ b/gdb/wrapper.c
|
||||||
|
@@ -21,6 +21,7 @@
|
||||||
|
#include "exceptions.h"
|
||||||
|
#include "wrapper.h"
|
||||||
|
#include "ui-out.h"
|
||||||
|
+#include "target.h"
|
||||||
|
|
||||||
|
int
|
||||||
|
gdb_parse_exp_1 (char **stringptr, struct block *block, int comma,
|
||||||
|
@@ -161,3 +162,24 @@ gdb_value_struct_elt (struct ui_out *uiout, struct value **result,
|
||||||
|
return GDB_RC_FAIL;
|
||||||
|
return GDB_RC_OK;
|
||||||
|
}
|
||||||
|
+
|
||||||
|
+/* Call target_find_new_threads without throwing exception. Exception is
|
||||||
|
+ printed if it got thrown. */
|
||||||
|
+
|
||||||
|
+int
|
||||||
|
+gdb_target_find_new_threads (void)
|
||||||
|
+{
|
||||||
|
+ volatile struct gdb_exception except;
|
||||||
|
+
|
||||||
|
+ TRY_CATCH (except, RETURN_MASK_ERROR)
|
||||||
|
+ {
|
||||||
|
+ target_find_new_threads ();
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ if (except.reason < 0)
|
||||||
|
+ {
|
||||||
|
+ exception_print (gdb_stderr, except);
|
||||||
|
+ return 0;
|
||||||
|
+ }
|
||||||
|
+ return 1;
|
||||||
|
+}
|
||||||
|
--- a/gdb/wrapper.h
|
||||||
|
+++ b/gdb/wrapper.h
|
||||||
|
@@ -48,4 +48,6 @@ extern int gdb_value_ind (struct value *val, struct value ** rval);
|
||||||
|
|
||||||
|
extern int gdb_parse_and_eval_type (char *, int, struct type **);
|
||||||
|
|
||||||
|
+extern int gdb_target_find_new_threads (void);
|
||||||
|
+
|
||||||
|
#endif /* wrapper.h */
|
||||||
|
|
141
gdb-prelink-rela.patch
Normal file
141
gdb-prelink-rela.patch
Normal file
@ -0,0 +1,141 @@
|
|||||||
|
http://sourceware.org/ml/gdb-patches/2011-02/msg00630.html
|
||||||
|
Subject: [patch] [i386] Fix {,un}prelinked libraries for attach/core-load
|
||||||
|
|
||||||
|
Hi,
|
||||||
|
|
||||||
|
please see comments in the patch. The adjusted testcase FAILs on i386.
|
||||||
|
|
||||||
|
"Prelink", March 4, 2004 - by Jakub Jelinek:
|
||||||
|
http://people.redhat.com/jakub/prelink.pdf
|
||||||
|
primarily section 7 - REL to RELA conversion
|
||||||
|
|
||||||
|
An example of unprelinked -> prelinked library change:
|
||||||
|
Program Headers:
|
||||||
|
Type Offset VirtAddr PhysAddr FileSiz MemSiz Flg Align
|
||||||
|
- LOAD 0x000000 0x00000000 0x00000000 0x00538 0x00538 R E 0x1000
|
||||||
|
- LOAD 0x000538 0x00001538 0x00001538 0x00100 0x00110 RW 0x1000
|
||||||
|
- DYNAMIC 0x000550 0x00001550 0x00001550 0x000c8 0x000c8 RW 0x4
|
||||||
|
- NOTE 0x0000f4 0x000000f4 0x000000f4 0x00024 0x00024 R 0x4
|
||||||
|
- GNU_EH_FRAME 0x0004e8 0x000004e8 0x000004e8 0x00014 0x00014 R 0x4
|
||||||
|
+ LOAD 0x000000 0x411b3000 0x411b3000 0x00558 0x00558 R E 0x1000
|
||||||
|
+ LOAD 0x000558 0x411b4558 0x411b4558 0x00100 0x00110 RW 0x1000
|
||||||
|
+ DYNAMIC 0x000570 0x411b4570 0x411b4570 0x000c8 0x000c8 RW 0x4
|
||||||
|
+ NOTE 0x0000f4 0x411b30f4 0x411b30f4 0x00024 0x00024 R 0x4
|
||||||
|
+ GNU_EH_FRAME 0x000508 0x411b3508 0x411b3508 0x00014 0x00014 R 0x4
|
||||||
|
GNU_STACK 0x000000 0x00000000 0x00000000 0x00000 0x00000 RW 0x4
|
||||||
|
|
||||||
|
So far GDB expected all such displacements will be always PAGE_SIZE aligned.
|
||||||
|
This applies for example for re-prelinking of an already prelinked file.
|
||||||
|
But it does not apply for prelinking of an unprelinked file or unprelinking of
|
||||||
|
a prelinked file, there can be arbitrary displacement.
|
||||||
|
|
||||||
|
It affects i386 (=i686, prelink doc reports also ARM and MIPS) which uses REL.
|
||||||
|
x86_64 always uses RELA, therefore I have not noticed it so far. i386 still
|
||||||
|
has to be supported.
|
||||||
|
|
||||||
|
This affects both attachment to a PID and core file loads.
|
||||||
|
|
||||||
|
This applies in real world if you transfer a core file between hosts and try to
|
||||||
|
backtrace them, libraries of both hosts may differ whether they are / are not
|
||||||
|
prelinked.
|
||||||
|
|
||||||
|
I could implement some (displacement-forgiving and prelink-modifications
|
||||||
|
forgiving) comparison of both DYNAMIC segments found. But I do not think it is
|
||||||
|
useful, if the DYNAMIC address from linkmap vs. bfd do not match it is still a
|
||||||
|
better chance to try a displacement to make them match. Keeping the file
|
||||||
|
relocation cannot work anyway when the DYNAMIC address is verified as wrong.
|
||||||
|
|
||||||
|
No regressions on {x86_64,x86_64-m32,i686}-fedora15-linux-gnu.
|
||||||
|
|
||||||
|
Mostly do you agree the DYNAMIC content does not have to be verifed?
|
||||||
|
Do you have any comments on the in-code long comments?
|
||||||
|
|
||||||
|
|
||||||
|
Thanks,
|
||||||
|
Jan
|
||||||
|
|
||||||
|
|
||||||
|
gdb/
|
||||||
|
2011-02-22 Jan Kratochvil <jan.kratochvil@redhat.com>
|
||||||
|
|
||||||
|
Fix libraries displacement if they change whether they were prelinked.
|
||||||
|
* solib-svr4.c (LM_ADDR_CHECK): Set L_ADDR even if the DYNAMIC pointer
|
||||||
|
does not match. Comment why.
|
||||||
|
|
||||||
|
gdb/testsuite/
|
||||||
|
2011-02-22 Jan Kratochvil <jan.kratochvil@redhat.com>
|
||||||
|
|
||||||
|
* gdb.base/break-interp-lib.c (v, vptr): New variables.
|
||||||
|
* gdb.base/break-interp.exp (test_attach): New comment.
|
||||||
|
|
||||||
|
--- a/gdb/solib-svr4.c
|
||||||
|
+++ b/gdb/solib-svr4.c
|
||||||
|
@@ -237,11 +237,11 @@ LM_ADDR_CHECK (struct so_list *so, bfd *abfd)
|
||||||
|
|
||||||
|
Even on PPC it must be zero-aligned at least for MINPAGESIZE. */
|
||||||
|
|
||||||
|
+ l_addr = l_dynaddr - dynaddr;
|
||||||
|
+
|
||||||
|
if ((l_addr & (minpagesize - 1)) == 0
|
||||||
|
&& (l_addr & align) == ((l_dynaddr - dynaddr) & align))
|
||||||
|
{
|
||||||
|
- l_addr = l_dynaddr - dynaddr;
|
||||||
|
-
|
||||||
|
if (info_verbose)
|
||||||
|
printf_unfiltered (_("Using PIC (Position Independent Code) "
|
||||||
|
"prelink displacement %s for \"%s\".\n"),
|
||||||
|
@@ -249,9 +249,20 @@ LM_ADDR_CHECK (struct so_list *so, bfd *abfd)
|
||||||
|
so->so_name);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
- warning (_(".dynamic section for \"%s\" "
|
||||||
|
- "is not at the expected address "
|
||||||
|
- "(wrong library or version mismatch?)"), so->so_name);
|
||||||
|
+ {
|
||||||
|
+ /* There is no way to verify the library file matches. prelink
|
||||||
|
+ can during prelinking of an unprelinked file (or unprelinking
|
||||||
|
+ of a prelinked file) shift the DYNAMIC segment by arbitrary
|
||||||
|
+ offset without any page size alignment. There is no way to
|
||||||
|
+ find out the ELF header and/or Program Headers for a limited
|
||||||
|
+ verification if it they match. One could do a verification
|
||||||
|
+ of the DYNAMIC segment. Still the found address is the best
|
||||||
|
+ one GDB could find. */
|
||||||
|
+
|
||||||
|
+ warning (_(".dynamic section for \"%s\" "
|
||||||
|
+ "is not at the expected address "
|
||||||
|
+ "(wrong library or version mismatch?)"), so->so_name);
|
||||||
|
+ }
|
||||||
|
}
|
||||||
|
|
||||||
|
set_addr:
|
||||||
|
--- a/gdb/testsuite/gdb.base/break-interp-lib.c
|
||||||
|
+++ b/gdb/testsuite/gdb.base/break-interp-lib.c
|
||||||
|
@@ -20,6 +20,10 @@
|
||||||
|
#include <assert.h>
|
||||||
|
#include <stdio.h>
|
||||||
|
|
||||||
|
+/* Force REL->RELA conversion on i386, see "Prelink", March 4, 2004. */
|
||||||
|
+volatile int v[2];
|
||||||
|
+volatile int *vptr = &v[1];
|
||||||
|
+
|
||||||
|
void
|
||||||
|
libfunc (const char *action)
|
||||||
|
{
|
||||||
|
--- a/gdb/testsuite/gdb.base/break-interp.exp
|
||||||
|
+++ b/gdb/testsuite/gdb.base/break-interp.exp
|
||||||
|
@@ -352,6 +352,14 @@ proc test_attach {file displacement {relink_args ""}} {
|
||||||
|
# test simplicity, we merged this test and the test above by not
|
||||||
|
# restoring $INTERP after $EXEC prelink. $INTERP gets restored
|
||||||
|
# later below.
|
||||||
|
+ #
|
||||||
|
+ # `(wrong library or version mismatch?)' messages are printed for
|
||||||
|
+ # $binfile_lib on platforms converting REL->RELA relocations by
|
||||||
|
+ # prelink (such as on i386). There is no reliable way to verify
|
||||||
|
+ # the library file matches the running library in such case but
|
||||||
|
+ # GDB at least attempts to set the right displacement. We test
|
||||||
|
+ # `libfunc' is present in the backtrace and therefore the
|
||||||
|
+ # displacement has been guessed right.
|
||||||
|
|
||||||
|
if [prelink$relink $relink_args [file tail $exec]] {
|
||||||
|
# /proc/PID/exe cannot be loaded as it is "EXECNAME (deleted)".
|
||||||
|
|
18
gdb.spec
18
gdb.spec
@ -27,7 +27,7 @@ Version: 7.2
|
|||||||
|
|
||||||
# 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.
|
||||||
Release: 44%{?_with_upstream:.upstream}%{dist}
|
Release: 45%{?_with_upstream:.upstream}%{dist}
|
||||||
|
|
||||||
License: GPLv3+ and GPLv3+ with exceptions and GPLv2+ and GPLv2+ with exceptions and GPL+ and LGPLv2+ and GFDL and BSD and Public Domain
|
License: GPLv3+ and GPLv3+ with exceptions and GPLv2+ and GPLv2+ with exceptions and GPL+ and LGPLv2+ and GFDL and BSD and Public Domain
|
||||||
Group: Development/Debuggers
|
Group: Development/Debuggers
|
||||||
@ -735,6 +735,14 @@ Patch565: gdb-physname-pr11734-1of2.patch
|
|||||||
Patch566: gdb-physname-pr11734-2of2.patch
|
Patch566: gdb-physname-pr11734-2of2.patch
|
||||||
Patch567: gdb-physname-pr12273.patch
|
Patch567: gdb-physname-pr12273.patch
|
||||||
|
|
||||||
|
# Fix attach/core-load of {,un}prelinked i386 libs (bugreport by Michal Toman).
|
||||||
|
Patch571: gdb-prelink-rela.patch
|
||||||
|
|
||||||
|
# Fix threading internal error on corrupted memory (BZ 677654).
|
||||||
|
Patch572: gdb-core-thread-internalerr-1of3.patch
|
||||||
|
Patch573: gdb-core-thread-internalerr-2of3.patch
|
||||||
|
Patch574: gdb-core-thread-internalerr-3of3.patch
|
||||||
|
|
||||||
BuildRequires: ncurses-devel%{?_isa} texinfo gettext flex bison expat-devel%{?_isa}
|
BuildRequires: ncurses-devel%{?_isa} texinfo gettext flex bison expat-devel%{?_isa}
|
||||||
Requires: readline%{?_isa}
|
Requires: readline%{?_isa}
|
||||||
BuildRequires: readline-devel%{?_isa}
|
BuildRequires: readline-devel%{?_isa}
|
||||||
@ -1050,6 +1058,10 @@ rm -f gdb/jv-exp.c gdb/m2-exp.c gdb/objc-exp.c gdb/p-exp.c
|
|||||||
%patch565 -p1
|
%patch565 -p1
|
||||||
%patch566 -p1
|
%patch566 -p1
|
||||||
%patch567 -p1
|
%patch567 -p1
|
||||||
|
%patch571 -p1
|
||||||
|
%patch572 -p1
|
||||||
|
%patch573 -p1
|
||||||
|
%patch574 -p1
|
||||||
|
|
||||||
%patch390 -p1
|
%patch390 -p1
|
||||||
%patch393 -p1
|
%patch393 -p1
|
||||||
@ -1447,6 +1459,10 @@ fi
|
|||||||
%endif
|
%endif
|
||||||
|
|
||||||
%changelog
|
%changelog
|
||||||
|
* Thu Feb 24 2011 Jan Kratochvil <jan.kratochvil@redhat.com> - 7.2-45.fc14
|
||||||
|
- Fix attach/core-load of {,un}prelinked i386 libs (bugreport by Michal Toman).
|
||||||
|
- Fix threading internal error on corrupted memory (BZ 677654).
|
||||||
|
|
||||||
* Mon Feb 21 2011 Jan Kratochvil <jan.kratochvil@redhat.com> - 7.2-44.fc14
|
* Mon Feb 21 2011 Jan Kratochvil <jan.kratochvil@redhat.com> - 7.2-44.fc14
|
||||||
- Fix C++ operators resolving through typedefs (STL from gcc-4.5, BZ 678454).
|
- Fix C++ operators resolving through typedefs (STL from gcc-4.5, BZ 678454).
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user