-PASS: gdb.mi/mi-var-child.exp: get children of struct_declarations.s2.u2.u1s1
+FAIL: gdb.mi/mi-var-child.exp: get children of struct_declarations.s2.u2.u1s1
-PASS: gdb.mi/mi2-var-child.exp: get children of struct_declarations.s2.u2.u1s1
+FAIL: gdb.mi/mi2-var-child.exp: get children of struct_declarations.s2.u2.u1s1
-PASS: gdb.python/py-mi.exp: examine container children=0, no pretty-printing
+FAIL: gdb.python/py-mi.exp: examine container children=0, no pretty-printing
attached a fix on top of existing HEAD.
Original PR gdb/10884 was a regression 6.8 -> 7.0 due to:
RFC: Lazy bitfields
http://sourceware.org/ml/gdb-patches/2009-07/msg00437.htmlhttp://sourceware.org/ml/gdb-cvs/2009-07/msg00143.html
07491b3409f6ace0b7a9a707775a56ce10fece1c
No regressions for HEAD on {x86_64,x86_64-m32,i686}-fedora12-linux-gnu. Plus:
-FAIL: gdb.mi/mi-var-child.exp: get children of struct_declarations.s2.u2.u1s1
+PASS: gdb.mi/mi-var-child.exp: get children of struct_declarations.s2.u2.u1s1
-FAIL: gdb.mi/mi2-var-child.exp: get children of struct_declarations.s2.u2.u1s1
+PASS: gdb.mi/mi2-var-child.exp: get children of struct_declarations.s2.u2.u1s1
-FAIL: gdb.python/py-mi.exp: examine container children=0, no pretty-printing
+PASS: gdb.python/py-mi.exp: examine container children=0, no pretty-printing
Going to check it in also for gdb_7_0-branch after an approval.
Thanks,
Jan
gdb/
2010-01-02 Jan Kratochvil
* value.c (value_primitive_field): Remove one check_typedef call.
Move bitpos and container_bitsize initialization after
allocate_value_lazy. New comment before accessing TYPE_LENGTH.
gdb/testsuite/
2010-01-02 Jan Kratochvil
* gdb.mi/var-cmd.c (do_bitfield_tests): Change "V.sharable" type to
"uint_for_mi_testing".
--- a/gdb/testsuite/gdb.mi/var-cmd.c
+++ b/gdb/testsuite/gdb.mi/var-cmd.c
@@ -494,7 +494,7 @@ void do_bitfield_tests ()
mi_create_varobj V d "create varobj for Data"
mi_list_varobj_children "V" {
{"V.alloc" "alloc" "0" "int"}
- {"V.sharable" "sharable" "0" "unsigned int"}
+ {"V.sharable" "sharable" "0" "uint_for_mi_testing"}
} "list children of Data"
mi_check_varobj_value V.sharable 3 "access bitfield"
:*/
--- a/gdb/value.c
+++ b/gdb/value.c
@@ -1873,7 +1873,6 @@ value_primitive_field (struct value *arg1, int offset,
CHECK_TYPEDEF (arg_type);
type = TYPE_FIELD_TYPE (arg_type, fieldno);
- type = check_typedef (type);
/* Handle packed fields */
@@ -1885,10 +1884,14 @@ value_primitive_field (struct value *arg1, int offset,
Otherwise, adjust offset to the byte containing the first
bit. Assume that the address, offset, and embedded offset
are sufficiently aligned. */
- int bitpos = TYPE_FIELD_BITPOS (arg_type, fieldno);
- int container_bitsize = TYPE_LENGTH (type) * 8;
+ int bitpos, container_bitsize;
v = allocate_value_lazy (type);
+
+ /* TYPE_LENGTH of TYPE gets initialized by allocate_value_lazy. */
+ bitpos = TYPE_FIELD_BITPOS (arg_type, fieldno);
+ container_bitsize = TYPE_LENGTH (type) * 8;
+
v->bitsize = TYPE_FIELD_BITSIZE (arg_type, fieldno);
if ((bitpos % container_bitsize) + v->bitsize <= container_bitsize
&& TYPE_LENGTH (type) <= (int) sizeof (LONGEST))
@@ -1939,6 +1942,8 @@ value_primitive_field (struct value *arg1, int offset,
else
{
v = allocate_value (type);
+
+ /* TYPE_LENGTH of TYPE gets initialized by allocate_value. */
memcpy (value_contents_raw (v),
value_contents_raw (arg1) + offset,
TYPE_LENGTH (type));
++++++ gdb-bz533176-fortran-omp-step.patch ++++++
https://bugzilla.redhat.com/show_bug.cgi?id=533176#c4
I find it a bug in DWARF and gdb behaves correctly according to it. From the
current DWARF's point of view the is a function call which you skip by "next".
If you hide any /usr/lib/debug such as using:
gdb -nx -ex 'set debug-file-directory /qwe' -ex 'file ./tpcommon_gfortran44'
and use "step" command instead of "next" there it will work.
(You need to hide debuginfo from libgomp as you would step into libgomp sources
to maintain the threads for execution.)
There should be some DWARF extension for it, currently tried to detect
substring ".omp_fn." as this function is called "MAIN__.omp_fn.0" and do not
consider such sub-function as a skippable by "next".
Another problem is that with "set scheduler-locking" being "off" (default
upstream) or "step" (default in F/RHEL) the simultaneous execution of the
threads is inconvenient. Setting it to "on" will lockup the debugging as the
threads need to get synchronized at some point. This is a more general
debugging problem of GOMP outside of the scope of this Bug.
--- ./gdb/infrun.c 2009-12-09 22:03:33.000000000 +0100
+++ ./gdb/infrun.c 2009-12-09 22:29:56.000000000 +0100
@@ -3994,6 +3994,12 @@ infrun: not switching back to stepped th
if (ecs->event_thread->step_over_calls == STEP_OVER_ALL)
{
+ struct symbol *stop_fn = find_pc_function (stop_pc);
+
+ if (stop_fn == NULL
+ || strstr (SYMBOL_LINKAGE_NAME (stop_fn), ".omp_fn.") == NULL)
+{ /* ".omp_fn." */
+
/* We're doing a "next".
Normal (forward) execution: set a breakpoint at the
@@ -4020,6 +4026,7 @@ infrun: not switching back to stepped th
keep_going (ecs);
return;
+} /* ".omp_fn." */
}
/* If we are in a function call trampoline (a stub between the
--- ./gdb/testsuite/gdb.fortran/omp-step.exp 1970-01-01 01:00:00.000000000 +0100
+++ ./gdb/testsuite/gdb.fortran/omp-step.exp 2009-12-09 22:31:04.000000000 +0100
@@ -0,0 +1,31 @@
+# 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/.
+
+set testfile "omp-step"
+set srcfile ${testfile}.f90
+if { [prepare_for_testing $testfile.exp $testfile $srcfile {debug f77 additional_flags=-fopenmp}] } {
+ return -1
+}
+
+if ![runto [gdb_get_line_number "start-here"]] {
+ perror "Couldn't run to start-here"
+ return 0
+}
+
+gdb_test "next" {!\$omp parallel} "step closer"
+gdb_test "next" {a\(omp_get_thread_num\(\) \+ 1\) = 1} "step into omp"
+
+gdb_breakpoint [gdb_get_line_number "success"]
+gdb_continue_to_breakpoint "success" ".*success.*"
--- ./gdb/testsuite/gdb.fortran/omp-step.f90 1970-01-01 01:00:00.000000000 +0100
+++ ./gdb/testsuite/gdb.fortran/omp-step.f90 2009-12-09 22:25:35.000000000 +0100
@@ -0,0 +1,32 @@
+! 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/.
+
+ use omp_lib
+ integer nthreads, i, a(1000)
+ nthreads = omp_get_num_threads()
+ if (nthreads .gt. 1000) call abort
+
+ do i = 1, nthreads
+ a(i) = 0
+ end do
+ print *, "start-here"
+!$omp parallel
+ a(omp_get_thread_num() + 1) = 1
+!$omp end parallel
+ do i = 1, nthreads
+ if (a(i) .ne. 1) call abort
+ end do
+ print *, "success"
+ end
++++++ gdb-bz538626-bp_location-accel-bp-cond.patch ++++++
http://sourceware.org/ml/gdb-patches/2009-12/msg00180.html
Subject: [patch] Fix a regression by me on breakpoint-cond-infcall
Hi,
GDB has now a regression since:
Re: [patch] Performance optimize large bp_location count
http://sourceware.org/ml/gdb-patches/2009-10/msg00632.html
=
2009-10-25 Jan Kratochvil
Performance optimize large bp_location count.
on breakpoints with conditions calling inferior.
Bringing the code back to the state before my acceleration patch.
The code before already assumed no breakpoints or their bp_locations can
change across the inferior call which should be true - trying to do some:
break a if b()
break b
command 1
delete 2
end
or similar cannot work as inside "if b()" evaluation no breakpoints can be
added or removed.
update_global_location_list also does not removed/add `struct bp_location's
themselves but only pointers to them in the bp_location array. As the new
iteration no longer uses the bp_location array it is no longer a problem.
Original problem was found by and fixed differently by Phil Muldoon.
No regressions on {x86_64,x86_64-m32,i686}-fedora12-linux-gnu.
Thanks,
Jan
gdb/
2009-12-13 Jan Kratochvil
* breakpoint.c (bpstat_stop_status): Iterate using ALL_BREAKPOINTS and
the B->LOC list. Remove gdb_assert on B. Change bp_hardware_watchpoint
continue to break. Remove variable update_locations. Remove HIT_COUNT
increment protection by an ENABLE_STATE check. Inline the delayed
update_global_location_list call.
gdb/testsuite/
2009-12-13 Jan Kratochvil
Phil Muldoon
* gdb.base/condbreak.exp: Put breakpoint on marker3 and marker4.
(bp_location13, bp_location14, bp_location17, bp_location18)
(marker3_proto, marker4_proto): New variables.
(breakpoint info): Update output.
(run until breakpoint at marker3, run until breakpoint at marker4): New
tests.
[ Backported for F-12. ]
--- ./gdb/breakpoint.c 2009-12-14 00:25:55.000000000 +0100
+++ ./gdb/breakpoint.c 2009-12-14 00:32:32.000000000 +0100
@@ -3298,93 +3298,93 @@ bpstat_stop_status (CORE_ADDR bp_addr, p
/* Pointer to the last thing in the chain currently. */
bpstat bs = root_bs;
int ix;
- int need_remove_insert, update_locations = 0;
+ int need_remove_insert;
- ALL_BP_LOCATIONS (bl, blp_tmp)
- {
- bpstat bs_prev = bs;
+ /* ALL_BP_LOCATIONS iteration would break across
+ update_global_location_list possibly executed by
+ bpstat_check_breakpoint_conditions's inferior call. */
- b = bl->owner;
- gdb_assert (b);
- if (!breakpoint_enabled (b) && b->enable_state != bp_permanent)
- continue;
-
- /* For hardware watchpoints, we look only at the first location.
- The watchpoint_check function will work on entire expression,
- not the individual locations. For read watchopints, the
- watchpoints_triggered function have checked all locations
- alrea
- */
- if (b->type == bp_hardware_watchpoint && bl != b->loc)
- continue;
-
- if (!bpstat_check_location (bl, bp_addr))
- continue;
-
- /* Come here if it's a watchpoint, or if the break address matches */
-
- bs = bpstat_alloc (bl, bs); /* Alloc a bpstat to explain stop */
- gdb_assert (bs_prev->next == bs);
-
- /* Assume we stop. Should we find watchpoint that is not actually
- triggered, or if condition of breakpoint is false, we'll reset
- 'stop' to 0. */
- bs->stop = 1;
- bs->print = 1;
+ ALL_BREAKPOINTS (b)
+ {
+ if (!breakpoint_enabled (b) && b->enable_state != bp_permanent)
+ continue;
- if (!bpstat_check_watchpoint (bs))
- {
- /* Ensure bpstat_explains_signal stays false if this BL could not be
- the cause of this trap. */
+ for (bl = b->loc; bl != NULL; bl = bl->next)
+ {
+ bpstat bs_prev = bs;
+
+ /* For hardware watchpoints, we look only at the first location.
+ The watchpoint_check function will work on entire expression,
+ not the individual locations. For read watchopints, the
+ watchpoints_triggered function have checked all locations
+ alrea
+ */
+ if (b->type == bp_hardware_watchpoint && bl != b->loc)
+ break;
- gdb_assert (bs->print_it == print_it_noop);
- gdb_assert (!bs->stop);
- xfree (bs);
- bs = bs_prev;
- bs->next = NULL;
- continue;
- }
+ if (!bpstat_check_location (bl, bp_addr))
+ continue;
- if (b->type == bp_thread_event || b->type == bp_overlay_event
- || b->type == bp_longjmp_master || b->type == bp_exception_master)
- /* We do not stop for these. */
- bs->stop = 0;
- else
- bpstat_check_breakpoint_conditions (bs, ptid);
-
- if (bs->stop)
- {
- if (b->enable_state != bp_disabled)
- ++(b->hit_count);
+ /* Come here if it's a watchpoint, or if the break address matches */
- /* We will stop here */
- if (b->disposition == disp_disable)
- {
- if (b->enable_state != bp_permanent)
- b->enable_state = bp_disabled;
- update_locations = 1;
- }
- if (b->silent)
- bs->print = 0;
- bs->commands = b->commands;
- if (bs->commands
- && (strcmp ("silent", bs->commands->line) == 0
- || (xdb_commands && strcmp ("Q", bs->commands->line) == 0)))
- {
- bs->commands = bs->commands->next;
- bs->print = 0;
- }
- bs->commands = copy_command_lines (bs->commands);
- }
+ bs = bpstat_alloc (bl, bs); /* Alloc a bpstat to explain stop */
+ gdb_assert (bs_prev->next == bs);
- /* Print nothing for this entry if we dont stop or if we dont print. */
- if (bs->stop == 0 || bs->print == 0)
- bs->print_it = print_it_noop;
- }
+ /* Assume we stop. Should we find watchpoint that is not actually
+ triggered, or if condition of breakpoint is false, we'll reset
+ 'stop' to 0. */
+ bs->stop = 1;
+ bs->print = 1;
- /* Delay this call which would break the ALL_BP_LOCATIONS iteration above. */
- if (update_locations)
- update_global_location_list (0);
+ if (!bpstat_check_watchpoint (bs))
+ {
+ /* Ensure bpstat_explains_signal stays false if this BL could not be
+ the cause of this trap. */
+
+ gdb_assert (bs->print_it == print_it_noop);
+ gdb_assert (!bs->stop);
+ xfree (bs);
+ bs = bs_prev;
+ bs->next = NULL;
+ continue;
+ }
+
+ if (b->type == bp_thread_event || b->type == bp_overlay_event
+ || b->type == bp_longjmp_master || b->type == bp_exception_master)
+ /* We do not stop for these. */
+ bs->stop = 0;
+ else
+ bpstat_check_breakpoint_conditions (bs, ptid);
+
+ if (bs->stop)
+ {
+ ++(b->hit_count);
+
+ /* We will stop here */
+ if (b->disposition == disp_disable)
+ {
+ if (b->enable_state != bp_permanent)
+ b->enable_state = bp_disabled;
+ update_global_location_list (0);
+ }
+ if (b->silent)
+ bs->print = 0;
+ bs->commands = b->commands;
+ if (bs->commands
+ && (strcmp ("silent", bs->commands->line) == 0
+ || (xdb_commands && strcmp ("Q", bs->commands->line) == 0)))
+ {
+ bs->commands = bs->commands->next;
+ bs->print = 0;
+ }
+ bs->commands = copy_command_lines (bs->commands);
+ }
+
+ /* Print nothing for this entry if we dont stop or if we dont print. */
+ if (bs->stop == 0 || bs->print == 0)
+ bs->print_it = print_it_noop;
+ }
+ }
for (ix = 0; VEC_iterate (bp_location_p, moribund_locations, ix, loc); ++ix)
{
--- ./gdb/testsuite/gdb.base/condbreak.exp 2009-01-03 06:58:03.000000000 +0100
+++ ./gdb/testsuite/gdb.base/condbreak.exp 2009-12-14 00:27:21.000000000 +0100
@@ -68,8 +68,12 @@ set bp_location1 [gdb_get_line_number "
set bp_location6 [gdb_get_line_number "set breakpoint 6 here"]
set bp_location8 [gdb_get_line_number "set breakpoint 8 here" $srcfile1]
set bp_location9 [gdb_get_line_number "set breakpoint 9 here" $srcfile1]
+set bp_location13 [gdb_get_line_number "set breakpoint 13 here" $srcfile1]
+set bp_location14 [gdb_get_line_number "set breakpoint 14 here" $srcfile1]
set bp_location15 [gdb_get_line_number "set breakpoint 15 here" $srcfile1]
set bp_location16 [gdb_get_line_number "set breakpoint 16 here" $srcfile1]
+set bp_location17 [gdb_get_line_number "set breakpoint 17 here" $srcfile1]
+set bp_location18 [gdb_get_line_number "set breakpoint 18 here" $srcfile1]
#
# test break at function
@@ -110,15 +114,29 @@ gdb_test "break marker2 if (a==43)" \
"Breakpoint.*at.* file .*$srcfile1, line.*"
#
+# Check break involving inferior function call.
+# Ensure there is at least one additional breakpoint with higher VMA.
+#
+gdb_test "break marker3 if (multi_line_if_conditional(1,1,1)==0)" \
+ "Breakpoint.*at.* file .*$srcfile1, line.*"
+gdb_test "break marker4" \
+ "Breakpoint.*at.* file .*$srcfile1, line.*"
+
+#
# check to see what breakpoints are set
#
if {$hp_aCC_compiler} {
set marker1_proto "\\(void\\)"
set marker2_proto "\\(int\\)"
+ # Not checked.
+ set marker3_proto "\\(char \\*, char \\*\\)"
+ set marker4_proto "\\(long\\)"
} else {
set marker1_proto ""
set marker2_proto ""
+ set marker3_proto ""
+ set marker4_proto ""
}
gdb_test "info break" \
@@ -129,7 +147,10 @@ gdb_test "info break" \
\[0-9\]+\[\t \]+breakpoint keep y.* in main at .*$srcfile:$bp_location1.*
\[\t \]+stop only if \\(1==1\\).*
\[0-9\]+\[\t \]+breakpoint keep y.* in marker2$marker2_proto at .*$srcfile1:($bp_location8|$bp_location9).*
-\[\t \]+stop only if \\(a==43\\).*" \
+\[\t \]+stop only if \\(a==43\\).*
+\[0-9\]+\[\t \]+breakpoint keep y.* in marker3$marker3_proto at .*$srcfile1:($bp_location17|$bp_location18).*
+\[\t \]+stop only if \\(multi_line_if_conditional\\(1,1,1\\)==0\\).*
+\[0-9\]+\[\t \]+breakpoint keep y.* in marker4$marker4_proto at .*$srcfile1:($bp_location13|$bp_location14).*" \
"breakpoint info"
@@ -220,3 +241,23 @@ gdb_expect {
fail "(timeout) run until breakpoint at marker2"
}
}
+
+set test "run until breakpoint at marker3"
+gdb_test_multiple "continue" $test {
+ -re "Continuing\\..*Breakpoint \[0-9\]+, marker3 \\(a=$hex \"stack\", b=$hex \"trace\"\\) at .*$srcfile1:($bp_location17|$bp_location18).*($bp_location17|$bp_location18)\[\t \]+.*$gdb_prompt $" {
+ pass $test
+ }
+ -re "Continuing\\..*Breakpoint \[0-9\]+, $hex in marker3 \\(a=$hex \"stack\", b=$hex \"trace\"\\) at .*$srcfile1:($bp_location17|$bp_location18).*($bp_location17|$bp_location18)\[\t \]+.*$gdb_prompt $" {
+ xfail $test
+ }
+}
+
+set test "run until breakpoint at marker4"
+gdb_test_multiple "continue" $test {
+ -re "Continuing\\..*Breakpoint \[0-9\]+, marker4 \\(d=177601976\\) at .*$srcfile1:($bp_location13|$bp_location14).*($bp_location13|$bp_location14)\[\t \]+.*$gdb_prompt $" {
+ pass $test
+ }
+ -re "Continuing\\..*Breakpoint \[0-9\]+, $hex in marker4 \\(d=177601976\\) at .*$srcfile1:($bp_location13|$bp_location14).*($bp_location13|$bp_location14)\[\t \]+.*$gdb_prompt $" {
+ xfail $test
+ }
+}
++++++ gdb-bz539590-gnu-ifunc.patch ++++++
++++ 974 lines (skipped)
++++++ gdb-bz541866-rwatch-before-run.patch ++++++
[ Rediffed against gdb-7.0.1. ]
watchpoint-hw-hit-once.c is a part of:
http://sourceware.org/ml/gdb-patches/2009-11/msg00444.htmlhttp://sourceware.org/ml/gdb-cvs/2009-11/msg00178.html
ec27fce19a16df73e763281ce3a6d0cdb718174e
--- a/gdb/config/i386/linux64.mh
+++ b/gdb/config/i386/linux64.mh
@@ -2,7 +2,7 @@
NATDEPFILES= inf-ptrace.o fork-child.o \
i386-nat.o amd64-nat.o amd64-linux-nat.o linux-nat.o \
proc-service.o linux-thread-db.o gcore.o linux-fork.o
-NAT_FILE= config/nm-linux.h
+NAT_FILE= nm-linux64.h
# The dynamically loaded libthread_db needs access to symbols in the
# gdb executable.
--- a/gdb/config/i386/nm-linux.h
+++ b/gdb/config/i386/nm-linux.h
@@ -29,4 +29,7 @@
#define FILL_FPXREGSET
#endif
+/* Red Hat backward compatibility with gdb-6.8. */
+#define target_can_use_hardware_watchpoint(type, cnt, ot) 1
+
#endif /* nm-linux.h */
--- /dev/null
+++ b/gdb/config/i386/nm-linux64.h
@@ -0,0 +1,28 @@
+/* Native support for GNU/Linux amd64.
+
+ Copyright 2010 Free Software Foundation, Inc.
+
+ This file is part of GDB.
+
+ 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/. */
+
+#ifndef NM_LINUX64_H
+#define NM_LINUX64_H
+
+#include "config/nm-linux.h"
+
+/* Red Hat backward compatibility with gdb-6.8. */
+#define target_can_use_hardware_watchpoint(type, cnt, ot) 1
+
+#endif /* NM_LINUX64_H */
--- gdb-7.0.1-orig/gdb/config/ia64/linux.mh 2007-04-26 00:17:48.000000000 +0200
+++ gdb-7.0.1/gdb/config/ia64/linux.mh 2010-02-24 01:40:21.000000000 +0100
@@ -1,6 +1,6 @@
# Host: Intel IA-64 running GNU/Linux
-NAT_FILE= config/nm-linux.h
+NAT_FILE= nm-linux.h
NATDEPFILES= inf-ptrace.o fork-child.o corelow.o gcore.o \
core-regset.o ia64-linux-nat.o \
proc-service.o linux-thread-db.o linux-nat.o linux-fork.o
--- /dev/null
+++ b/gdb/config/ia64/nm-linux.h
@@ -0,0 +1,28 @@
+/* Native support for GNU/Linux ia64.
+
+ Copyright 2010 Free Software Foundation, Inc.
+
+ This file is part of GDB.
+
+ 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/. */
+
+#ifndef NM_LINUX_H
+#define NM_LINUX_H
+
+#include "config/nm-linux.h"
+
+/* Red Hat backward compatibility with gdb-6.8. */
+#define target_can_use_hardware_watchpoint(type, cnt, ot) 1
+
+#endif /* NM_LINUX_H */
--- a/gdb/target.h
+++ b/gdb/target.h
@@ -1257,8 +1257,10 @@ extern char *normal_pid_to_str (ptid_t ptid);
bp_hardware_breakpoint. CNT is the number of such watchpoints used so far
(including this one?). OTHERTYPE is who knows what... */
+#ifndef target_can_use_hardware_watchpoint
#define target_can_use_hardware_watchpoint(TYPE,CNT,OTHERTYPE) \
(*current_target.to_can_use_hw_breakpoint) (TYPE, CNT, OTHERTYPE);
+#endif
#define target_region_ok_for_hw_watchpoint(addr, len) \
(*current_target.to_region_ok_for_hw_watchpoint) (addr, len)
--- /dev/null
+++ b/gdb/testsuite/gdb.base/watchpoint-hw-before-run.exp
@@ -0,0 +1,40 @@
+# Copyright 2009, 2010 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/.
+
+# Arch not supporting hw watchpoints does not imply no_hardware_watchpoints set.
+if {(![istarget "i?86-*-*"] && ![istarget "x86_64-*-*"]
+ && ![istarget "ia64-*-*"])
+ || [target_info exists gdb,no_hardware_watchpoints]} then {
+ verbose "Skipping watchpoint-hw-before-run test."
+ return
+}
+
+set test watchpoint-hw-before-run
+set srcfile watchpoint-hw-hit-once.c
+if { [prepare_for_testing ${test}.exp ${test} ${srcfile}] } {
+ return -1
+}
+
+gdb_test "rwatch watchee" "ardware read watchpoint 1: watchee"
+
+# `runto_main' or `runto main' would delete the watchpoint created above.
+
+if { [gdb_start_cmd] < 0 } {
+ untested start
+ return -1
+}
+gdb_test "" "main .* at .*" "start"
+
+gdb_test "continue" "Continuing.\r\nHardware read watchpoint \[0-9\]+: watchee\r\n\r\nValue = 0\r\n.*"
--- /dev/null
+++ b/gdb/testsuite/gdb.base/watchpoint-hw-hit-once.c
@@ -0,0 +1,34 @@
+/* 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/. */
+
+static int watchee;
+
+int
+main (void)
+{
+ volatile int dummy;
+
+ /* Stub lines are present as no breakpoints/watchpoint gets hit if current PC
+ already stays on the line PC while entering "step"/"continue". */
+
+ dummy = 0; /* Stub to catch WATCHEE access after runto_main. */
+ dummy = watchee;
+ dummy = 1; /* Stub to catch break-at-exit after WATCHEE has been hit. */
+ dummy = 2; /* break-at-exit */
+
+ return 0;
+}
++++++ gdb-bz559291-fortran-module-toplevel.patch ++++++
http://sourceware.org/ml/archer/2010-q1/msg00047.html
Subject: [fortran-module] [commit] Fix a regression on setting breakpoint at
[ Backport for F-12. ]
f5c7672a52316155bc3367cbc2f0e7db22523634
https://bugzilla.redhat.com/show_bug.cgi?id=559291
gdb/
2010-02-03 Jan Kratochvil
David Moore
* f-lang.c (f_lookup_symbol_nonlocal): Always fallback on
basic_lookup_symbol_nonlocal.
gdb/testsuite/
2010-02-03 Jan Kratochvil
* gdb.fortran/module.exp (show language, setting breakpoint at module):
New.
* gdb.fortran/module.f90: New statement program module.
--- ./gdb/f-lang.c 2010-02-03 01:50:07.000000000 +0100
+++ ./gdb/f-lang.c 2010-02-03 01:49:06.000000000 +0100
@@ -308,33 +308,33 @@ f_lookup_symbol_nonlocal (const char *na
const struct block *block,
const domain_enum domain)
{
- struct fortran_using *use;
-
- if (!block)
- return NULL;
-
- for (use = BLOCK_FORTRAN_USE (block); use; use = use->next)
+ if (block)
{
- struct symbol *sym;
- struct type *type;
- struct symbol *retval;
-
- sym = lookup_symbol_global (use->module_name, block, MODULE_DOMAIN);
-
- /* Module name lookup should not fail with correct debug info. */
- if (sym == NULL)
- continue;
-
- type = SYMBOL_TYPE (sym);
- gdb_assert (TYPE_CODE (type) == TYPE_CODE_MODULE);
- gdb_assert (TYPE_MODULE_BLOCK (type) != NULL);
-
- retval = lookup_block_symbol (TYPE_MODULE_BLOCK (type), name, domain);
- if (retval)
- return retval;
+ struct fortran_using *use;
+
+ for (use = BLOCK_FORTRAN_USE (block); use; use = use->next)
+ {
+ struct symbol *sym;
+ struct type *type;
+ struct symbol *retval;
+
+ sym = lookup_symbol_global (use->module_name, block, MODULE_DOMAIN);
+
+ /* Module name lookup should not fail with correct debug info. */
+ if (sym == NULL)
+ continue;
+
+ type = SYMBOL_TYPE (sym);
+ gdb_assert (TYPE_CODE (type) == TYPE_CODE_MODULE);
+ gdb_assert (TYPE_MODULE_BLOCK (type) != NULL);
+
+ retval = lookup_block_symbol (TYPE_MODULE_BLOCK (type), name, domain);
+ if (retval)
+ return retval;
+ }
}
- return NULL;
+ return basic_lookup_symbol_nonlocal (name, block, domain);
}
/* This is declared in c-lang.h but it is silly to import that file for what
--- ./gdb/testsuite/gdb.fortran/module.exp 2010-02-03 01:50:13.000000000 +0100
+++ ./gdb/testsuite/gdb.fortran/module.exp 2010-02-03 01:47:42.000000000 +0100
@@ -43,3 +43,13 @@ gdb_test "print var_b" " = 11"
gdb_test "print var_c" "No symbol \"var_c\" in current context\\."
gdb_test "print var_d" " = 12"
gdb_test "print var_i" " = 14" "print var_i value 14"
+
+# Breakpoint would work in language "c".
+gdb_test "show language" {The current source language is "(auto; currently )?fortran".}
+
+# gcc-4.4.2: The main program is always MAIN__ in .symtab so "runto" above
+# works. But DWARF DW_TAG_subprogram contains the name specified by
+# the "program" Fortran statement.
+if [gdb_breakpoint "module"] {
+ pass "setting breakpoint at module"
+}
--- ./gdb/testsuite/gdb.fortran/module.f90 2010-02-03 01:50:07.000000000 +0100
+++ ./gdb/testsuite/gdb.fortran/module.f90 2010-02-03 01:47:42.000000000 +0100
@@ -37,6 +37,8 @@ end module modmany
var_i = var_i ! i-is-2
end
+ program module
+
use modmany, only: var_b, var_d => var_c, var_i
call sub1
++++++ gdb-bz559414-pie-assert-fix.patch ++++++
http://sourceware.org/ml/gdb-patches/2010-01/msg00661.html
Subject: [patch] Fix failed gdb_assert due to the PIE patchset
[ Backport for F-12/7.0. ]
Hi,
the PIE patchset brought in an occasionally failing gdb_assert (according to
Fedora ABRT bugreports).
solib-svr4.c:600: internal-error: scan_dyntag: Assertion `target_section < current_target_sections->sections_end' failed.
Now I understand it as generally current_target_sections are about target-side
data while symbols are the GDB side and there is only loose relation of those.
ABFD can be from multiple places acting for multiple purposes as parsed by
elf_lookup_lib_symbol:
exec_bfd:
It cannot be from exec_one - this BFD has no associated objfile to
pass to symfile_objfile. OK.
symfile_objfile:
It gets translated by elf_lookup_lib_symbol into exec_bfd which
represents the target data. OK.
so_list's objfile's separate_debug_objfile file:
gdb_assert-forbidden as input to elf_lookup_lib_symbol. OK.
so_list's objfile's main file:
update_solib_list must have called add_target_sections. OK.
objfile's separate_debug_objfile file:
gdb_assert-forbidden as input to elf_lookup_lib_symbol. OK.
objfile's main file (if it has no associated so_list):
Such ABFD from add_symbol_file_command has no add_target_sections
called. Still it can have current context BLOCK which crashes
scan_dyntag. BUG.
No regressions on {x86_64,x86_64-m32,i686}-fedora12-linux-gnu.
The patch mostly reverts the PIE part there.
OK to check in?
Sorry,
Jan
gdb/
2010-01-31 Jan Kratochvil
* solib-svr4.c (scan_dyntag): New variable dyn_addr. Replace gdb_assert
by a conditional setting DYN_ADDR. Use DYN_ADDR.
* config/djgpp/fnchange.lst: Add translations for
symbol-without-target_section.exp and symbol-without-target_section.c.
gdb/testsuite/
2010-01-31 Jan Kratochvil
* gdb.base/symbol-without-target_section.exp,
gdb.base/symbol-without-target_section.c: New.
--- a/gdb/config/djgpp/fnchange.lst
+++ b/gdb/config/djgpp/fnchange.lst
@@ -394,6 +394,8 @@
@V@/gdb/testsuite/gdb.base/solib-symbol-main.c @V@/gdb/testsuite/gdb.base/so-symmain.c
@V@/gdb/testsuite/gdb.base/solib-overlap-lib.c @V@/gdb/testsuite/gdb.base/so-ovrlib.c
@V@/gdb/testsuite/gdb.base/solib-overlap-main.c @V@/gdb/testsuite/gdb.base/so-ovrmain.c
+@V@/gdb/testsuite/gdb.base/gdb.base/symbol-without-target_section.exp @V@/gdb/testsuite/gdb.base/symnosec.exp
+@V@/gdb/testsuite/gdb.base/gdb.base/symbol-without-target_section.c @V@/gdb/testsuite/gdb.base/symnosec.c
@V@/gdb/testsuite/gdb.base/type-opaque-lib.c @V@/gdb/testsuite/gdb.base/ty-opqlib.c
@V@/gdb/testsuite/gdb.base/type-opaque-main.c @V@/gdb/testsuite/gdb.base/ty-opqmain.c
@V@/gdb/testsuite/gdb.base/watchpoint-hw.c @V@/gdb/testsuite/gdb.base/wp-hw.c
--- a/gdb/solib-svr4.c
+++ b/gdb/solib-svr4.c
@@ -570,7 +570,7 @@ scan_dyntag (int dyntag, bfd *abfd, CORE_ADDR *ptr)
{
int arch_size, step, sect_size;
long dyn_tag;
- CORE_ADDR dyn_ptr;
+ CORE_ADDR dyn_ptr, dyn_addr;
gdb_byte *bufend, *bufstart, *buf;
Elf32_External_Dyn *x_dynp_32;
Elf64_External_Dyn *x_dynp_64;
@@ -627,7 +627,17 @@ scan_dyntag (int dyntag, bfd *abfd, CORE
target_section++)
if (sect == target_section->the_bfd_section)
break;
- gdb_assert (target_section < target_get_section_table (&exec_ops)->sections_end);
+ if (target_section < target_get_section_table (&exec_ops)->sections_end)
+ dyn_addr = target_section->addr;
+ else
+ {
+ /* ABFD may come from OBJFILE acting only as a symbol file without being
+ loaded into the target (see add_symbol_file_command). This case is
+ such fallback to the file VMA address without the possibility of
+ having the section relocated to its actual in-memory address. */
+
+ dyn_addr = bfd_section_vma (abfd, sect);
+ }
/* Read in .dynamic from the BFD. We will get the actual value
from memory later. */
@@ -639,7 +649,7 @@ scan_dyntag (int dyntag, bfd *abfd, CORE_ADDR *ptr)
CORE_ADDR ptr_addr;
ptr_type = builtin_type (target_gdbarch)->builtin_data_ptr;
- ptr_addr = target_section->addr + (buf - bufstart) + arch_size / 8;
+ ptr_addr = dyn_addr + (buf - bufstart) + arch_size / 8;
if (target_read_memory (ptr_addr, ptr_buf, arch_size / 8) == 0)
dyn_ptr = extract_typed_address (ptr_buf, ptr_type);
*ptr = dyn_ptr;
--- /dev/null
+++ b/gdb/testsuite/gdb.base/symbol-without-target_section.c
@@ -0,0 +1,18 @@
+/* This testcase is part of GDB, the GNU debugger.
+
+ Copyright 2010 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 symbol_without_target_section;
--- /dev/null
+++ b/gdb/testsuite/gdb.base/symbol-without-target_section.exp
@@ -0,0 +1,39 @@
+# Copyright 2010 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/.
+
+# Exploit formerly failed assertion in scan_dyntag when it got called for
+# objfile having ".dynamic" section but without having data loaded in target.
+# Such file is ${binmainfile} through add-symbol-file here. Set context first
+# by "list main" to have some local BLOCK set in lookup_symbol_global.
+
+set testfile symbol-without-target_section
+set srclibfile ${testfile}.c
+set binlibfile ${testfile}.x
+set srcmainfile start.c
+set binmainfile ${testfile}
+if { [gdb_compile "${srcdir}/${subdir}/${srclibfile}" \
+ "${objdir}/${subdir}/${binlibfile}" object {debug}] != "" } {
+ untested ${testfile}.exp
+ return -1
+}
+if {[build_executable ${testfile}.exp ${binmainfile} ${srcmainfile} {debug}] == -1} {
+ return -1
+}
+clean_restart ${binlibfile}
+
+gdb_test "add-symbol-file ${objdir}/${subdir}/${binmainfile} 0" "" "add-symbol-file" \
+ "add symbol table from file \".*\" at.*\\(y or n\\) " "y"
+gdb_test "list main"
+gdb_test "print symbol_without_target_section"
++++++ gdb-bz562517-archer-reread-quick_addrmap.patch ++++++
Fix was a part of merge of master:
e421d7b026e77f4dc127de49c01e80d533eb6825
--- ./gdb/symfile.c 2010-02-28 23:22:31.000000000 +0100
+++ ./gdb/symfile.c 2010-02-28 23:29:00.000000000 +0100
@@ -3448,6 +3448,7 @@ reread_symbols (void)
objfile->symtabs = NULL;
objfile->psymtabs = NULL;
objfile->psymtabs_addrmap = NULL;
+ objfile->quick_addrmap = NULL;
objfile->free_psymtabs = NULL;
objfile->cp_namespace_symtab = NULL;
objfile->msymbols = NULL;
@@ -3458,6 +3459,8 @@ reread_symbols (void)
memset (&objfile->msymbol_demangled_hash, 0,
sizeof (objfile->msymbol_demangled_hash));
+ objfile->flags &= ~OBJF_SYMTABS_READ;
+
objfile->psymbol_cache = bcache_xmalloc ();
objfile->macro_cache = bcache_xmalloc ();
/* obstack_init also initializes the obstack so it is
@@ -3502,8 +3505,6 @@ reread_symbols (void)
wrap_here ("");
}
- objfile->flags &= ~OBJF_SYMTABS_READ;
-
/* We're done reading the symbol file; finish off complaints. */
clear_complaints (&symfile_complaints, 0, 1);
++++++ gdb-empty-namespace.patch ++++++
gdb/
2009-12-20 Jan Kratochvil
Fix compatibility with G++-4.1.
* dwarf2read.c (partial_die_parent_scope): New variable PARENT_NAME.
Ignore parent namespaces with name "::".
(physname_prefix_1): Ignore namespaces with name "::".
gdb/testsuite/
2009-12-20 Jan Kratochvil
* gdb.dwarf2/dw2-empty-namespace.exp, gdb.dwarf2/dw2-empty-namespace.S:
New.
--- a/gdb/dwarf2read.c
+++ b/gdb/dwarf2read.c
@@ -2355,11 +2355,18 @@ partial_die_parent_scope (struct partial_die_info *pdi,
|| parent->tag == DW_TAG_interface_type
|| parent->tag == DW_TAG_union_type)
{
+ char *parent_name = parent->name;
+
+ /* G++ 4.1 produced DW_TAG_namespace with DW_AT_name "::". */
+ if (parent->tag == DW_TAG_namespace && parent_name != NULL
+ && strcmp (parent_name, "::") == 0)
+ parent_name = NULL;
+
if (grandparent_scope == NULL)
- parent->scope = parent->name;
+ parent->scope = parent_name;
else
parent->scope = typename_concat (&cu->comp_unit_obstack, grandparent_scope,
- parent->name, cu);
+ parent_name, cu);
}
else if (parent->tag == DW_TAG_enumeration_type)
/* Enumerators should not get the name of the enumeration as a prefix. */
@@ -9008,6 +9015,9 @@ physname_prefix_1 (struct ui_file *buf, struct die_info *die,
name = dwarf2_name (die, cu);
if (name == NULL)
name = "(anonymous namespace)";
+ /* G++ 4.1 produced DW_TAG_namespace with DW_AT_name "::". */
+ else if (strcmp (name, "::") == 0)
+ name = NULL;
break;
case DW_TAG_class_type:
--- /dev/null
+++ b/gdb/testsuite/gdb.dwarf2/dw2-empty-namespace.S
@@ -0,0 +1,108 @@
+/* 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/. */
+
+/* Test G++ 4.1 producing DW_TAG_namespace with DW_AT_name "::". */
+
+ .data
+var: .4byte 1
+
+ .section .debug_info
+.Lcu1_begin:
+ /* CU header */
+ .4byte .Lcu1_end - .Lcu1_start /* Length of Compilation Unit */
+.Lcu1_start:
+ .2byte 2 /* DWARF Version */
+ .4byte .Labbrev1_begin /* Offset into abbrev section */
+ .byte 4 /* Pointer size */
+
+ /* CU die */
+ .uleb128 1 /* Abbrev: DW_TAG_compile_unit */
+ .ascii "file1.txt\0" /* DW_AT_name */
+ .ascii "GNU C 3.3.3\0" /* DW_AT_producer */
+ .byte 4 /* DW_LANG_C_plus_plus (C++) */
+
+.Ltype_int:
+ .uleb128 2 /* Abbrev: DW_TAG_base_type */
+ .ascii "int\0" /* DW_AT_name */
+ .byte 4 /* DW_AT_byte_size */
+ .byte 5 /* DW_AT_encoding */
+
+ .uleb128 3 /* Abbrev: DW_TAG_namespace */
+ .ascii "::\0" /* DW_AT_name */
+
+ .uleb128 7 /* Abbrev: DW_TAG_variable (location) */
+ .ascii "var\0" /* DW_AT_name */
+ .byte 2f - 1f /* DW_AT_location */
+1: .byte 3 /* DW_OP_addr */
+ .4byte var /* <addr> */
+2: .4byte .Ltype_int-.Lcu1_begin /* DW_AT_type */
+
+ .byte 0 /* End of children of DW_TAG_namespace */
+
+ .byte 0 /* End of children of CU */
+
+.Lcu1_end:
+
+/* Abbrev table */
+ .section .debug_abbrev
+.Labbrev1_begin:
+ .uleb128 1 /* Abbrev code */
+ .uleb128 0x11 /* DW_TAG_compile_unit */
+ .byte 1 /* has_children */
+ .uleb128 0x3 /* DW_AT_name */
+ .uleb128 0x8 /* DW_FORM_string */
+ .uleb128 0x25 /* DW_AT_producer */
+ .uleb128 0x8 /* DW_FORM_string */
+ .uleb128 0x13 /* DW_AT_language */
+ .uleb128 0xb /* DW_FORM_data1 */
+ .byte 0x0 /* Terminator */
+ .byte 0x0 /* Terminator */
+
+ .uleb128 2 /* Abbrev code */
+ .uleb128 0x24 /* DW_TAG_base_type */
+ .byte 0 /* has_children */
+ .uleb128 0x3 /* DW_AT_name */
+ .uleb128 0x8 /* DW_FORM_string */
+ .uleb128 0xb /* DW_AT_byte_size */
+ .uleb128 0xb /* DW_FORM_data1 */
+ .uleb128 0x3e /* DW_AT_encoding */
+ .uleb128 0xb /* DW_FORM_data1 */
+ .byte 0x0 /* Terminator */
+ .byte 0x0 /* Terminator */
+
+ .uleb128 3 /* Abbrev code */
+ .uleb128 0x39 /* DW_TAG_namespace */
+ .byte 1 /* has_children */
+ .uleb128 0x3 /* DW_AT_name */
+ .uleb128 0x8 /* DW_FORM_string */
+ .byte 0x0 /* Terminator */
+ .byte 0x0 /* Terminator */
+
+ .uleb128 7 /* Abbrev code (location) */
+ .uleb128 0x34 /* DW_TAG_variable */
+ .byte 0 /* has_children */
+ .uleb128 0x3 /* DW_AT_name */
+ .uleb128 0x8 /* DW_FORM_string */
+ .uleb128 0x2 /* DW_AT_location */
+ .uleb128 0xa /* DW_FORM_block1 */
+ .uleb128 0x49 /* DW_AT_type */
+ .uleb128 0x13 /* DW_FORM_ref4 */
+ .byte 0x0 /* Terminator */
+ .byte 0x0 /* Terminator */
+
+ .byte 0x0 /* Terminator */
+ .byte 0x0 /* Terminator */
--- /dev/null
+++ b/gdb/testsuite/gdb.dwarf2/dw2-empty-namespace.exp
@@ -0,0 +1,43 @@
+# 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/.
+
+# Test G++ 4.1 producing DW_TAG_namespace with DW_AT_name "::".
+
+# This test can only be run on targets which support DWARF-2 and use gas.
+# For now pick a sampling of likely targets.
+if {![istarget *-*-linux*]
+ && ![istarget *-*-gnu*]
+ && ![istarget *-*-elf*]
+ && ![istarget *-*-openbsd*]
+ && ![istarget arm-*-eabi*]
+ && ![istarget powerpc-*-eabi*]} {
+ return 0
+}
+
+set testfile "dw2-empty-namespace"
+set srcfile ${testfile}.S
+set executable ${testfile}.x
+
+if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${objdir}/${subdir}/${executable}" object {nodebug}] != "" } {
+ return -1
+}
+
+clean_restart $executable
+
+# `p var' below can work without identified DWARF DIE just based on its ELF symbol.
+# Catch it here as `type = '.
+gdb_test "ptype var" "type = int"
+
+gdb_test "p var" " = 1"
++++++ gdb-false-warning-gnu.liblist.patch ++++++
http://sourceware.org/ml/gdb-patches/2010-02/msg00713.html
Subject: Re: [patch] Fix false warning: section .gnu.liblist not found in ... [rediffed]
Hi,
only a technical rediff.
------------------------------------------------------------------------------
On Sat, 13 Feb 2010 23:49:29 +0100, Jan Kratochvil wrote:
Hi,
post-7.0 GDB started to print many false warnings on prelink-ed system:
$ ./gdb -nx -ex r echo
...
Reading symbols from /bin/echo...Reading symbols from /usr/lib/debug/bin/echo.debug...
warning: section .gnu.liblist not found in /usr/lib/debug/bin/echo.debug
warning: section .gnu.conflict not found in /usr/lib/debug/bin/echo.debug
done.
done.
Starting program: /bin/echo
warning: section .gnu.liblist not found in /usr/lib/debug/bin/echo.debug
warning: section .gnu.conflict not found in /usr/lib/debug/bin/echo.debug
warning: section .gnu.liblist not found in /usr/lib/debug/bin/echo.debug
warning: section .gnu.conflict not found in /usr/lib/debug/bin/echo.debug
warning: section .gnu.liblist not found in /usr/lib/debug/bin/echo.debug
warning: section .gnu.conflict not found in /usr/lib/debug/bin/echo.debug
These sections are from prelink and they are not present in the *.debug files.
It is formally a regression by:
commit 3bfec189bb0fa1a2a44f1645dd68a9572e7a841c
2010-01-07 Tristan Gingold
* symfile.c (build_section_addr_info_from_objfile): New function.
(symbol_file_add_separate): Don't use offsets from objfile but
built an addr info.
But I think would be unavoidable even for the unification of PIC+PIE handling.
Found no usable section flag differences for .gnu.liblist vs. for example
.text so used just the section name for the exception.
.gnu.liblist/.gnu.conflict related dumps:
executable:
Section Headers:
[Nr] Name Type Address Off Size ES Flg Lk Inf Al
[ 6] .gnu.liblist GNU_LIBLIST 00000000004006b8 0006b8 000028 14 A 28 0 4
[ 7] .gnu.conflict RELA 00000000004006e0 0006e0 0001c8 18 A 5 0 8
Program Headers:
Type Offset VirtAddr PhysAddr FileSiz MemSiz Flg Align
LOAD 0x000000 0x0000000000400000 0x0000000000400000 0x005254 0x005254 R E 0x200000
Dynamic section at offset 0x52c8 contains 24 entries:
Tag Type Name/Value
0x000000006ffffef9 (GNU_LIBLIST) 0x4006b8
0x000000006ffffdf7 (GNU_LIBLISTSZ) 40 (bytes)
0x000000006ffffef8 (GNU_CONFLICT) 0x4006e0
0x000000006ffffdf6 (GNU_CONFLICTSZ) 456 (bytes)
library:
Section Headers:
[Nr] Name Type Address Off Size ES Flg Lk Inf Al
[74] .gnu.liblist GNU_LIBLIST 0000000000000000 249940 000014 14 75 0 4
No regressions on {x86_64,x86_64-m32,i686}-fedora12-linux-gnu.
Thanks,
Jan
2010-03-01 Jan Kratochvil
* symfile.c (addr_info_make_relative): New variable sect_name, use it.
Do not warn on ".gnu.liblist" and ".gnu.conflict".
--- a/gdb/symfile.c
+++ b/gdb/symfile.c
@@ -597,7 +597,8 @@ addr_info_make_relative (struct section_addr_info *addrs, bfd *abfd)
for (i = 0; i < addrs->num_sections && addrs->other[i].name; i++)
{
- asection *sect = bfd_get_section_by_name (abfd, addrs->other[i].name);
+ const char *sect_name = addrs->other[i].name;
+ asection *sect = bfd_get_section_by_name (abfd, sect_name);
if (sect)
{
@@ -614,8 +615,16 @@ addr_info_make_relative (struct section_addr_info *addrs, bfd *abfd)
}
else
{
- warning (_("section %s not found in %s"), addrs->other[i].name,
- bfd_get_filename (abfd));
+ /* These two sections are intentionally loaded into memory from
+ the DYNAMIC segment and so they have both SEC_ALLOC and SEC_LOAD
+ set in the main executable (not in the library files). They
+ are not present in the separate debug info file, though. */
+
+ if (!(strcmp (sect_name, ".gnu.liblist") == 0
+ || strcmp (sect_name, ".gnu.conflict") == 0))
+ warning (_("section %s not found in %s"), sect_name,
+ bfd_get_filename (abfd));
+
addrs->other[i].addr = 0;
/* SECTINDEX is invalid if ADDR is zero. */
++++++ gdb-follow-child-stale-parent.patch ++++++
Problem occurs with python and its get_current_arch () as it selects
selected_frame and current_frame while still inferior_ptid is valid for the
original parent. But since this place it is already attached and later
unwinders try to access it, breaking:
-PASS: gdb.threads/watchpoint-fork.exp: child: singlethreaded: breakpoint after the first fork
-PASS: gdb.threads/watchpoint-fork.exp: child: singlethreaded: watchpoint after the first fork
-PASS: gdb.threads/watchpoint-fork.exp: child: singlethreaded: breakpoint after the second fork
-PASS: gdb.threads/watchpoint-fork.exp: child: singlethreaded: watchpoint after the second fork
-PASS: gdb.threads/watchpoint-fork.exp: child: singlethreaded: finish
+FAIL: gdb.threads/watchpoint-fork.exp: child: singlethreaded: breakpoint after the first fork
+FAIL: gdb.threads/watchpoint-fork.exp: child: singlethreaded: watchpoint after the first fork
+FAIL: gdb.threads/watchpoint-fork.exp: child: singlethreaded: breakpoint after the second fork
+FAIL: gdb.threads/watchpoint-fork.exp: child: singlethreaded: watchpoint after the second fork
+FAIL: gdb.threads/watchpoint-fork.exp: child: singlethreaded: finish
--- ./gdb/infrun.c 2009-12-21 20:26:30.000000000 +0100
+++ ./gdb/infrun.c 2009-12-21 20:26:11.000000000 +0100
@@ -375,6 +375,9 @@ follow_fork (void)
}
else
{
+ /* Possibly referenced PARENT is no longer valid. */
+ reinit_frame_cache ();
+
/* This pending follow fork event is now handled, one way
or another. The previous selected thread may be gone
from the lists by now, but if it is still around, need
++++++ gdb-ia64-infcall-workaround.patch ++++++
There was a regression by:
Re: [rfc, v3] Fix frame_id_inner comparison false positives
http://sourceware.org/ml/gdb-patches/2008-08/msg00578.htmlhttp://sourceware.org/ml/gdb-cvs/2008-08/msg00182.html
916dde5d38b45a659514e47942ece70aec04cd78
the part:
* stack.c (return_command): Directly pop the selected frame.
Reproducible on:
hp-diablo-01.rhts.eng.bos.redhat.com
RHEL5.5-Server-20100216.nightly
kernel-2.6.18-187.el5.ia64
Not reproducible on:
hp-bl860c-03.rhts.eng.bos.redhat.com
RHEL-4.8
kernel-2.6.9-89.EL.ia64
To make ia64-tdep.c compilable +/- this stack.c check-in one must apply:
Re: [RFC] Remove addr, endaddr, offset from obj_section
http://sourceware.org/ml/gdb-patches/2008-09/msg00011.htmlhttp://sourceware.org/ml/gdb-cvs/2008-09/msg00009.html
99072369ec3c8f94c9a596e5ce30bf1f1c4bf20e
It is reproducible by:
gdb.base/call-signal-resume.exp
although one must first remove the gdb_assert by:
gdb-infcall-sp-underflow.patch
Reproducer:
set confirm no
set breakpoint pending on
set height 0
set width 0
# testcase from: gdb-6.8-37.el5.src
file gdb.base/call-signals
break stop_one
run
call gen_signal ()
bt
frame 3
return
p/x $sp
break stop_two
info break
p/x $pc
p/x $sp
bt
set debug infrun 1
delete 1
continue
bt
p/x $pc
echo Bug is reproduced if sp is now 0:\n
p/x $sp
kill
quit
--- ./gdb/frame.c 2010-02-23 21:35:35.000000000 +0100
+++ ./gdb/frame.c 2010-02-23 21:46:34.000000000 +0100
@@ -517,7 +517,7 @@ frame_id_eq (struct frame_id l, struct f
a stack overflow strategy that cause the handler to be run on a
different stack. */
-static int
+int
frame_id_inner (struct gdbarch *gdbarch, struct frame_id l, struct frame_id r)
{
int inner;
--- ./gdb/frame.h 2009-09-13 18:28:28.000000000 +0200
+++ ./gdb/frame.h 2010-02-23 21:46:10.000000000 +0100
@@ -708,4 +708,7 @@ extern struct frame_info *create_new_fra
extern int frame_unwinder_is (struct frame_info *fi,
const struct frame_unwind *unwinder);
+extern int frame_id_inner (struct gdbarch *gdbarch, struct frame_id l,
+ struct frame_id r);
+
#endif /* !defined (FRAME_H) */
--- ./gdb/stack.c 2010-02-23 21:35:34.000000000 +0100
+++ ./gdb/stack.c 2010-02-23 21:44:39.000000000 +0100
@@ -1967,8 +1967,29 @@ If you continue, the return value that y
error (_("Not confirmed"));
}
- /* Discard the selected frame and all frames inner-to it. */
- frame_pop (get_selected_frame (NULL));
+ /* NOTE: cagney/2003-01-18: Is this silly? Rather than pop each
+ frame in turn, should this code just go straight to the relevant
+ frame and pop that? */
+
+ /* First discard all frames inner-to the selected frame (making the
+ selected frame current). */
+ {
+ struct frame_id selected_id = get_frame_id (get_selected_frame (NULL));
+ while (!frame_id_eq (selected_id, get_frame_id (get_current_frame ())))
+ {
+ struct frame_info *frame = get_current_frame ();
+ if (frame_id_inner (get_frame_arch (frame), selected_id,
+ get_frame_id (frame)))
+ /* Caught in the safety net, oops! We've gone way past the
+ selected frame. */
+ error (_("Problem while popping stack frames (corrupt stack?)"));
+ frame_pop (get_current_frame ());
+ }
+ }
+
+ /* Second discard the selected frame (which is now also the current
+ frame). */
+ frame_pop (get_current_frame ());
/* Store RETURN_VALUE in the just-returned register set. */
if (return_value != NULL)
++++++ gdb-infcall-sp-underflow.patch ++++++
http://sourceware.org/ml/gdb-patches/2010-02/msg00515.html
Subject: [patch] infcall: Remove gdb_assert ($sp overflow)
Hi,
set $sp=0
call something()
->
../../gdb/infcall.c:521: internal-error: call_function_by_hand: Assertion
`(gdbarch_inner_than (gdbarch, 1, 2) && sp <= old_sp) || (gdbarch_inner_than
(gdbarch, 2, 1) && sp >= old_sp)' failed.
as $sp - frame == 0xffffsmth which is not lower than $sp.
It must not be gdb_assert(). It can be an error() but I left it just to do:
(gdb) set $sp=0
(gdb) call doubleit (1)
Cannot access memory at address 0xffffffffffffff78
(gdb) set $sp=-1
(gdb) call doubleit (1)
Cannot access memory at address 0xffffffffffffff68
Unaware how inconvenient is an intentional crash of the testcase on some
embedded/non-MMU systems.
No regressions on {x86_64,x86_64-m32,i686}-fedora12-linux-gnu.
Thanks,
Jan
gdb/
2010-02-19 Jan Kratochvil
* infcall.c (call_function_by_hand): Remove gdb_assert on sp and old_sp.
New comment.
gdb/testsuite/
2010-02-19 Jan Kratochvil
* gdb.base/callfuncs.exp: New tests for $spval 0 and -1. Remove return.
--- a/gdb/infcall.c
+++ b/gdb/infcall.c
@@ -518,10 +518,9 @@ call_function_by_hand (struct value *function, int nargs, struct value **args)
/* Stack grows up. */
sp = gdbarch_frame_align (gdbarch, old_sp + 1);
}
- gdb_assert ((gdbarch_inner_than (gdbarch, 1, 2)
- && sp <= old_sp)
- || (gdbarch_inner_than (gdbarch, 2, 1)
- && sp >= old_sp));
+ /* SP may have overflown address zero here from OLD_SP. Memory access
+ functions will probably fail in such case but that is a target's
+ problem. */
}
else
/* FIXME: cagney/2002-09-18: Hey, you loose!
--- a/gdb/testsuite/gdb.base/callfuncs.exp
+++ b/gdb/testsuite/gdb.base/callfuncs.exp
@@ -469,5 +469,18 @@ if {$old_reg_content == $new_reg_content} then {
fail "nested call dummies preserve register contents"
}
-return 0
+# GDB should not crash by internal error on $sp overflow during the inferior
+# call. It is OK it will stop on some: Cannot access memory at address 0x$hex.
+foreach spval {0 -1} {
+ set old_ldprefix $pf_prefix
+ lappend pf_prefix "sp=$spval:"
+
+ gdb_test {set $old_sp = $sp}
+ gdb_test "set \$sp = $spval"
+
+ gdb_test "call doubleit (1)"
+
+ gdb_test {set $sp = $old_sp}
+ set pf_prefix $old_ldprefix
+}
++++++ gdb-orphanripper.c ++++++
--- /var/tmp/diff_new_pack.BSdPV8/_old 2010-03-12 01:39:36.000000000 +0100
+++ /var/tmp/diff_new_pack.BSdPV8/_new 2010-03-12 01:39:36.000000000 +0100
@@ -276,12 +276,16 @@
assert (signal_chld_hit != 0);
+ /* Do not unset O_NONBLOCK as a stale child (the whole purpose of this
+ program) having open its output pty would block us in read_out. */
+#if 0
i = fcntl (amaster, F_SETFL, O_RDONLY /* !O_NONBLOCK */);
if (i != 0)
{
perror ("fcntl (amaster, F_SETFL, O_RDONLY /* !O_NONBLOCK */)");
exit (EXIT_FAILURE);
}
+#endif
while (read_out (amaster));
++++++ gdb-ppc-hw-watchpoint-twice.patch ++++++
pcc regression from:
http://sourceware.org/ml/gdb-patches/2008-12/msg00143.html
gdb/
2009-12-21 Jan Kratochvil
* breakpoint.c (update_watchpoint): Set B->TYPE to bp_watchpoint before
calling hw_watchpoint_used_count.
--- a/gdb/breakpoint.c
+++ b/gdb/breakpoint.c
@@ -1152,6 +1152,9 @@ update_watchpoint (struct breakpoint *b, int reparse)
{
int i, mem_cnt, other_type_used;
+ /* Do not count with B twice below. */
+ b->type = bp_watchpoint;
+
i = hw_watchpoint_used_count (bp_hardware_watchpoint,
&other_type_used);
mem_cnt = can_use_hardware_watchpoint (val_chain);
++++++ gdb-python-cplus-crash.patch ++++++
--- gdb-7.0.1/gdb/python/py-type.c-orig 2010-01-14 00:00:29.000000000 +0100
+++ gdb-7.0.1/gdb/python/py-type.c 2010-01-14 00:14:26.000000000 +0100
@@ -177,7 +177,10 @@ convert_field (struct type *type, int fi
if (PyObject_SetAttrString (result, "artificial", arg) < 0)
goto failarg;
- arg = field < TYPE_N_BASECLASSES (type) ? Py_True : Py_False;
+ if (TYPE_CODE (type) == TYPE_CODE_CLASS)
+ arg = field < TYPE_N_BASECLASSES (type) ? Py_True : Py_False;
+ else
+ arg = Py_False;
Py_INCREF (arg);
if (PyObject_SetAttrString (result, "is_base_class", arg) < 0)
goto failarg;
++++++ gdb-readline-6.0-signal.patch ++++++
http://sourceware.org/ml/gdb-patches/2009-11/msg00596.html
Subject: [gdb FYI-patch] callback-mode readline-6.0 regression
Hi Chet,
FSF GDB currently ships bundled with readline-5.2 which works fine.
But using --with-system-readline and readline-6.0-patchlevel4 has
a regression:
readline-5.2: Run `gdb -nx -q' and type CTRL-C:
(gdb) Quit
(gdb) _
readline-6.0: Run `gdb -nx -q' and type CTRL-C:
(gdb) _
= nothing happens (it gets buffered and executed later)
(It does also FAIL on gdb.gdb/selftest.exp.)
It is because GDB waits in its own poll() mainloop and readline uses via
rl_callback_handler_install and rl_callback_handler_remove. This way the
readline internal variable _rl_interrupt_immediately remains 0 and CTRL-C gets
only stored to _rl_caught_signal but not executed.
Seen in rl_signal_handler even if _rl_interrupt_immediately is set and
_rl_handle_signal is called then the signal is still stored to
_rl_caught_signal. In the _rl_interrupt_immediately case it should not be
stored when it was already processed.
rl_signal_handler does `_rl_interrupt_immediately = 0;' - while I am not aware
of its meaning it breaks the nest-counting of other routines which do
`_rl_interrupt_immediately++;' and `_rl_interrupt_immediately--;' possibly
creating problematic `_rl_interrupt_immediately == -1'.
`_rl_interrupt_immediately' is an internal variable, how it could be accessed
by a readline application? (OK, maybe it should not be used.)
Attaching a current GDB-side patch but it must access readline internal
variable _rl_caught_signal and it is generally just a workaround. Could you
please include support for signals in this asynchronous mode in readline-6.1?
I find it would be enough to make RL_CHECK_SIGNALS public?
GDB: No regressions on {x86_64,x86_64-m32,i686}-fedora12-linux-gnu.
But this is not a patch intended to be accepted.
Thanks,
Jan
gdb/
2009-11-29 Jan Kratochvil
* config.in, configure: Regenerate.
* configure.ac (for readline_echoing_p): Move inside $LIBS change.
(for _rl_caught_signal): New.
* event-loop.c: Include readline/readline.h.
(gdb_do_one_event) [HAVE_READLINE_CAUGHT_SIGNAL]: New.
gdb/testsuite/
2009-11-29 Jan Kratochvil
* gdb.gdb/selftest.exp (backtrace through signal handler): Move before
SIGINT pass, drop the timeout case.
(send SIGINT signal to child process): Use gdb_test.
(backtrace through readline handler): New.
--- a/gdb/config.in
+++ b/gdb/config.in
@@ -351,6 +351,9 @@
/* Define if Python interpreter is being linked in. */
#undef HAVE_PYTHON
+/* readline-6.0 workaround of blocked signals. */
+#undef HAVE_READLINE_CAUGHT_SIGNAL
+
/* Define to 1 if you have the `realpath' function. */
#undef HAVE_REALPATH
--- a/gdb/configure.ac
+++ b/gdb/configure.ac
@@ -539,17 +539,25 @@ if test "$with_system_readline" = yes; then
# readline-6.0 started to use the name `_rl_echoing_p'.
# `$(READLINE_DIR)/' of bundled readline would not resolve in configure.
- AC_MSG_CHECKING([for readline_echoing_p])
save_LIBS=$LIBS
LIBS="$LIBS $READLINE"
+ AC_MSG_CHECKING([for readline_echoing_p])
AC_LINK_IFELSE(AC_LANG_PROGRAM(,[[extern int readline_echoing_p;
return readline_echoing_p;]]),
[READLINE_ECHOING_P=yes],
[READLINE_ECHOING_P=no
AC_DEFINE([readline_echoing_p], [_rl_echoing_p],
[readline-6.0 started to use different name.])])
- LIBS="$save_LIBS"
AC_MSG_RESULT([$READLINE_ECHOING_P])
+ AC_MSG_CHECKING([for _rl_caught_signal])
+ AC_LINK_IFELSE(AC_LANG_PROGRAM(,[[extern int volatile _rl_caught_signal;
+ return _rl_caught_signal;]]),
+ [READLINE_CAUGHT_SIGNAL=yes
+ AC_DEFINE([HAVE_READLINE_CAUGHT_SIGNAL],,
+ [readline-6.0 workaround of blocked signals.])],
+ [READLINE_CAUGHT_SIGNAL=no])
+ AC_MSG_RESULT([$READLINE_CAUGHT_SIGNAL])
+ LIBS="$save_LIBS"
else
READLINE='$(READLINE_DIR)/libreadline.a'
READLINE_DEPS='$(READLINE)'
--- a/gdb/event-loop.c
+++ b/gdb/event-loop.c
@@ -37,6 +37,7 @@
#include "exceptions.h"
#include "gdb_assert.h"
#include "gdb_select.h"
+#include "readline/readline.h"
/* Data point to pass to the event handler. */
typedef union event_data
@@ -411,6 +412,9 @@ gdb_do_one_event (void *data)
static int event_source_head = 0;
const int number_of_sources = 3;
int current = 0;
+#ifdef HAVE_READLINE_CAUGHT_SIGNAL
+ extern int volatile _rl_caught_signal;
+#endif
/* Any events already waiting in the queue? */
if (process_event ())
@@ -455,6 +459,16 @@ gdb_do_one_event (void *data)
if (gdb_wait_for_event (1) < 0)
return -1;
+#ifdef HAVE_READLINE_CAUGHT_SIGNAL
+ if (async_command_editing_p && RL_ISSTATE (RL_STATE_CALLBACK)
+ && _rl_caught_signal)
+ {
+ /* Call RL_CHECK_SIGNALS this way. */
+ rl_callback_handler_remove ();
+ rl_callback_handler_install (NULL, input_handler);
+ }
+#endif
+
/* Handle any new events occurred while waiting. */
if (process_event ())
return 1;
--- a/gdb/testsuite/gdb.gdb/selftest.exp
+++ b/gdb/testsuite/gdb.gdb/selftest.exp
@@ -464,31 +464,42 @@ GDB.*Copyright \[0-9\]+ Free Software Foundation, Inc..*$gdb_prompt $"\
fail "$description (timeout)"
}
}
-
- set description "send SIGINT signal to child process"
- send_gdb "signal SIGINT\n"
- gdb_expect {
- -re "Continuing with signal SIGINT.*$gdb_prompt $" {
+
+ # get a stack trace with the poll function
+ #
+ # This fails on some linux systems for unknown reasons. On the
+ # systems where it fails, sometimes it works fine when run manually.
+ # The testsuite failures may not be limited to just aout systems.
+ setup_xfail "i*86-pc-linuxaout-gnu"
+ set description "backtrace through signal handler"
+ gdb_test_multiple "backtrace" $description {
+ -re "#0.*(read|poll).*in main \\(.*\\) at .*gdb\\.c.*$gdb_prompt $" {
pass "$description"
}
-re ".*$gdb_prompt $" {
+ # On the alpha, we hit the infamous problem about gdb
+ # being unable to get the frame pointer (mentioned in
+ # gdb/README). As it is intermittent, there is no way to
+ # XFAIL it which will give us an XPASS if the problem goes
+ # away.
+ setup_xfail "alpha*-*-osf*"
fail "$description"
}
- timeout {
- fail "$description (timeout)"
- }
}
- # get a stack trace
+ gdb_test "signal SIGINT" "Continuing with signal SIGINT.*" \
+ "send SIGINT signal to child process"
+
+ # get a stack trace being redelivered by readline
#
# This fails on some linux systems for unknown reasons. On the
# systems where it fails, sometimes it works fine when run manually.
# The testsuite failures may not be limited to just aout systems.
+ # Optional system readline may not have symbols to be shown.
setup_xfail "i*86-pc-linuxaout-gnu"
- set description "backtrace through signal handler"
- send_gdb "backtrace\n"
- gdb_expect {
- -re "#0.*(read|poll).*in main \\(.*\\) at .*gdb\\.c.*$gdb_prompt $" {
+ set description "backtrace through readline handler"
+ gdb_test_multiple "backtrace" $description {
+ -re "#0.*gdb_do_one_event.*in main \\(.*\\) at .*gdb\\.c.*$gdb_prompt $" {
pass "$description"
}
-re ".*$gdb_prompt $" {
@@ -500,9 +510,6 @@ GDB.*Copyright \[0-9\]+ Free Software Foundation, Inc..*$gdb_prompt $"\
setup_xfail "alpha*-*-osf*"
fail "$description"
}
- timeout {
- fail "$description (timeout)"
- }
}
--- gdb-7.0/gdb/configure 2009-12-07 18:53:30.000000000 +0100
+++ gdb-7.0-x/gdb/configure 2009-12-07 18:53:14.000000000 +0100
@@ -9201,15 +9201,11 @@ if test "$with_system_readline" = yes; t
# readline-6.0 started to use the name `_rl_echoing_p'.
# `$(READLINE_DIR)/' of bundled readline would not resolve in configure.
- echo "$as_me:$LINENO: checking for readline_echoing_p" >&5
-echo $ECHO_N "checking for readline_echoing_p... $ECHO_C" >&6
save_LIBS=$LIBS
LIBS="$LIBS $READLINE"
- cat >conftest.$ac_ext <<_ACEOF
-/* confdefs.h. */
-_ACEOF
-cat confdefs.h >>conftest.$ac_ext
-cat >>conftest.$ac_ext <<_ACEOF
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for readline_echoing_p" >&5
+$as_echo_n "checking for readline_echoing_p... " >&6; }
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
/* end confdefs.h. */
int
@@ -9221,45 +9217,45 @@ extern int readline_echoing_p;
return 0;
}
_ACEOF
-rm -f conftest.$ac_objext conftest$ac_exeext
-if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
- (eval $ac_link) 2>conftest.er1
- ac_status=$?
- grep -v '^ *+' conftest.er1 >conftest.err
- rm -f conftest.er1
- cat conftest.err >&5
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); } &&
- { ac_try='test -z "$ac_c_werror_flag"
- || test ! -s conftest.err'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; } &&
- { ac_try='test -s conftest$ac_exeext'
- { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
- (eval $ac_try) 2>&5
- ac_status=$?
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
- (exit $ac_status); }; }; then
+if ac_fn_c_try_link "$LINENO"; then :
READLINE_ECHOING_P=yes
else
- echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
+ READLINE_ECHOING_P=no
-READLINE_ECHOING_P=no
+$as_echo "#define readline_echoing_p _rl_echoing_p" >>confdefs.h
+
+fi
+rm -f core conftest.err conftest.$ac_objext \
+ conftest$ac_exeext conftest.$ac_ext
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $READLINE_ECHOING_P" >&5
+$as_echo "$READLINE_ECHOING_P" >&6; }
+ { $as_echo "$as_me:${as_lineno-$LINENO}: checking for _rl_caught_signal" >&5
+$as_echo_n "checking for _rl_caught_signal... " >&6; }
+ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+/* end confdefs.h. */
-cat >>confdefs.h <<\_ACEOF
-#define readline_echoing_p _rl_echoing_p
+int
+main ()
+{
+extern int volatile _rl_caught_signal;
+ return _rl_caught_signal;
+ ;
+ return 0;
+}
_ACEOF
+if ac_fn_c_try_link "$LINENO"; then :
+ READLINE_CAUGHT_SIGNAL=yes
+
+$as_echo "#define HAVE_READLINE_CAUGHT_SIGNAL /**/" >>confdefs.h
+else
+ READLINE_CAUGHT_SIGNAL=no
fi
-rm -f conftest.err conftest.$ac_objext \
- conftest$ac_exeext conftest.$ac_ext
+rm -f core conftest.err conftest.$ac_objext \
+ conftest$ac_exeext conftest.$ac_ext
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $READLINE_CAUGHT_SIGNAL" >&5
+$as_echo "$READLINE_CAUGHT_SIGNAL" >&6; }
LIBS="$save_LIBS"
- echo "$as_me:$LINENO: result: $READLINE_ECHOING_P" >&5
-echo "${ECHO_T}$READLINE_ECHOING_P" >&6
else
READLINE='$(READLINE_DIR)/libreadline.a'
READLINE_DEPS='$(READLINE)'
++++++ gdb-rhel5-compat.patch ++++++
gdb/linux-nat.c:
- Workaround RHEL-5 kernels for detaching SIGSTOPped processes (BZ 498595).
--- gdb-6.8/gdb-orig/symfile.c 2008-08-21 00:06:50.000000000 +0200
+++ gdb-6.8/gdb/symfile.c 2008-08-21 22:31:00.000000000 +0200
@@ -1456,8 +1456,10 @@ find_separate_debug_file (struct objfile
/* Prevent looping on a stripped .debug file. */
if (build_id_name != NULL && strcmp (build_id_name, objfile->name) == 0)
{
+#if 0 /* RHEL-5 backward behavior compatibility. */
warning (_("\"%s\": separate debug info file has no debug info"),
build_id_name);
+#endif
xfree (build_id_name);
}
else if (build_id_name != NULL)
--- ./gdb/corelow.c 2010-01-01 16:04:34.000000000 +0100
+++ ./gdb/corelow.c 2010-01-01 16:06:26.000000000 +0100
@@ -277,7 +277,7 @@ add_to_thread_list (bfd *abfd, asection
inferior_ptid = ptid; /* Yes, make it current */
}
-static int build_id_core_loads = 1;
+static int build_id_core_loads = 0;
static void
build_id_locate_exec (int from_tty)
--- ./gdb/symfile.c 2010-01-01 16:04:35.000000000 +0100
+++ ./gdb/symfile.c 2010-01-01 16:06:12.000000000 +0100
@@ -1249,7 +1249,7 @@ symbol_file_clear (int from_tty)
#define BUILD_ID_VERBOSE_NONE 0
#define BUILD_ID_VERBOSE_FILENAMES 1
#define BUILD_ID_VERBOSE_BINARY_PARSE 2
-static int build_id_verbose = BUILD_ID_VERBOSE_FILENAMES;
+static int build_id_verbose = BUILD_ID_VERBOSE_NONE;
static void
show_build_id_verbose (struct ui_file *file, int from_tty,
struct cmd_list_element *c, const char *value)
--- gdb-7.0-orig/gdb/linux-nat.c 2009-12-19 20:53:46.000000000 +0100
+++ gdb-7.0/gdb/linux-nat.c 2009-12-19 20:55:02.000000000 +0100
@@ -1604,8 +1604,22 @@ GPT: lwp %s had signal %s, but it is in
*status = lp->status;
}
- if (*status == 0 && GET_PID (lp->ptid) == pid_was_stopped)
- *status = W_STOPCODE (SIGSTOP);
+ /* Workaround RHEL-5 kernel which has unreliable PTRACE_DETACH, SIGSTOP (that
+ many TIDs are left unstopped). See RH Bug 496732. */
+ if (GET_PID (lp->ptid) == pid_was_stopped)
+ {
+ int err;
+
+ errno = 0;
+ err = kill_lwp (GET_LWP (lp->ptid), SIGSTOP);
+ if (debug_linux_nat)
+ {
+ fprintf_unfiltered (gdb_stdlog,
+ "SC: lwp kill %d %s\n",
+ err,
+ errno ? safe_strerror (errno) : "ERRNO-OK");
+ }
+ }
return 0;
}
++++++ gdb-rhel5-gcc44.patch ++++++
Some functionality is available on RHEL-5.4+ only with gcc44 and gfortran44 as
the default gcc and gfortran binaries are from gcc-4.1.
--- gdb-7.0/gdb/testsuite/gdb.base/vla.exp-orig 2009-12-20 00:38:13.000000000 +0100
+++ gdb-7.0/gdb/testsuite/gdb.base/vla.exp 2009-12-20 00:54:19.000000000 +0100
@@ -16,7 +16,25 @@
set testfile vla
set srcfile ${testfile}.c
set binfile ${objdir}/${subdir}/${testfile}
-if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug}] != "" } {
+# Temporarily provide compiler=gcc44 saving the original value around.
+
+set board [target_info name]
+if [board_info $board exists compiler] {
+ set old_compiler [board_info $board compiler]
+ unset_board_info compiler
+} elseif [info exists old_compiler] {
+ unset old_compiler
+}
+set_board_info compiler gcc44
+
+set err [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug quiet}]
+
+unset_board_info compiler
+if [info exists old_compiler] {
+ set_board_info compiler $old_compiler
+}
+
+if { $err != "" } {
untested "Couldn't compile test program"
return -1
}
--- gdb-7.0/gdb/testsuite/gdb.base/break-interp.exp-orig 2009-12-20 00:38:13.000000000 +0100
+++ gdb-7.0/gdb/testsuite/gdb.base/break-interp.exp 2009-12-20 01:11:47.000000000 +0100
@@ -31,10 +31,30 @@ if [get_compiler_info ${binfile_lib}] {
return -1
}
+# Temporarily provide compiler=gcc44 saving the original value around.
+# RHEL-5 workaround of its:
+# gcc: -soname: linker input file unused because linking not done
+
+set board [target_info name]
+if [board_info $board exists compiler] {
+ set old_compiler [board_info $board compiler]
+ unset_board_info compiler
+} elseif [info exists old_compiler] {
+ unset old_compiler
+}
+set_board_info compiler gcc44
+
# Use -soname so that it is listed with " => " by ldd and this testcase makes
# a copy of ${binfile_lib} for each prelink variant.
-if {[gdb_compile_shlib ${srcdir}/${subdir}/${srcfile_lib} ${binfile_lib} [list debug additional_flags=-Wl,-soname,${test}.so]] != ""} {
+set err [gdb_compile_shlib ${srcdir}/${subdir}/${srcfile_lib} ${binfile_lib} [list debug additional_flags=-Wl,-soname,${test}.so]]
+
+unset_board_info compiler
+if [info exists old_compiler] {
+ set_board_info compiler $old_compiler
+}
+
+if { $err != "" } {
return -1
}
@@ -483,9 +503,33 @@ foreach ldprelink {NO YES} {
if {$binpie == "YES"} {
lappend opts {additional_flags=-fPIE -pie}
}
- if {[build_executable ${test}.exp [file tail $exec] $srcfile $opts] == -1} {
- continue;
+
+
+ # Temporarily provide compiler=gcc44 saving the original value around.
+ # RHEL-5 workaround of its:
+ # gcc: -rpath: linker input file unused because linking not done
+ # gcc: --dynamic-linker: linker input file unused because linking not done
+
+ set board [target_info name]
+ if [board_info $board exists compiler] {
+ set old_compiler [board_info $board compiler]
+ unset_board_info compiler
+ } elseif [info exists old_compiler] {
+ unset old_compiler
+ }
+ set_board_info compiler gcc44
+
+ set err [build_executable ${test}.exp [file tail $exec] $srcfile $opts]
+
+ unset_board_info compiler
+ if [info exists old_compiler] {
+ set_board_info compiler $old_compiler
}
+
+ if { $err == -1 } {
+ continue
+ }
+
if {$binsepdebug == "SEP"} {
gdb_gnu_strip_debug $exec
# Just a sanity check. As gdb_gnu_strip_debug uses the
--- ./gdb/testsuite/gdb.fortran/common-block.exp 2009-12-15 05:13:56.000000000 +0100
+++ ./gdb/testsuite/gdb.fortran/common-block.exp 2009-12-15 05:21:00.000000000 +0100
@@ -20,7 +20,25 @@ set testfile "common-block"
set srcfile ${testfile}.f90
set binfile ${objdir}/${subdir}/${testfile}
-if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug f77 quiet}] != "" } {
+# Temporarily provide f77compiler=gfortran44 saving the original value around.
+
+set board [target_info name]
+if [board_info $board exists f77compiler] {
+ set old_f77compiler [board_info $board f77compiler]
+ unset_board_info f77compiler
+} elseif [info exists old_f77compiler] {
+ unset old_f77compiler
+}
+set_board_info f77compiler gfortran44
+
+set err [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug f77 quiet}]
+
+unset_board_info f77compiler
+if [info exists old_f77compiler] {
+ set_board_info f77compiler $old_f77compiler
+}
+
+if { $err != "" } {
untested "Couldn't compile ${srcfile}"
return -1
}
--- ./gdb/testsuite/gdb.fortran/dwarf-stride.exp 2009-12-15 05:13:56.000000000 +0100
+++ ./gdb/testsuite/gdb.fortran/dwarf-stride.exp 2009-12-15 05:20:07.000000000 +0100
@@ -27,7 +27,25 @@
set testfile dwarf-stride
set srcfile ${testfile}.f90
-if { [prepare_for_testing ${testfile}.exp ${testfile} ${srcfile} {debug f77}] } {
+# Temporarily provide f77compiler=gfortran44 saving the original value around.
+
+set board [target_info name]
+if [board_info $board exists f77compiler] {
+ set old_f77compiler [board_info $board f77compiler]
+ unset_board_info f77compiler
+} elseif [info exists old_f77compiler] {
+ unset old_f77compiler
+}
+set_board_info f77compiler gfortran44
+
+set err [prepare_for_testing ${testfile}.exp ${testfile} ${srcfile} {debug f77}]
+
+unset_board_info f77compiler
+if [info exists old_f77compiler] {
+ set_board_info f77compiler $old_f77compiler
+}
+
+if $err {
return -1
}
--- ./gdb/testsuite/gdb.fortran/dynamic.exp 2009-12-15 05:13:56.000000000 +0100
+++ ./gdb/testsuite/gdb.fortran/dynamic.exp 2009-12-15 05:17:21.000000000 +0100
@@ -25,7 +25,25 @@ set testfile "dynamic"
set srcfile ${testfile}.f90
set binfile ${objdir}/${subdir}/${testfile}
-if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug f77 quiet}] != "" } {
+# Temporarily provide f77compiler=gfortran44 saving the original value around.
+
+set board [target_info name]
+if [board_info $board exists f77compiler] {
+ set old_f77compiler [board_info $board f77compiler]
+ unset_board_info f77compiler
+} elseif [info exists old_f77compiler] {
+ unset old_f77compiler
+}
+set_board_info f77compiler gfortran44
+
+set err [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug f77 quiet}]
+
+unset_board_info f77compiler
+if [info exists old_f77compiler] {
+ set_board_info f77compiler $old_f77compiler
+}
+
+if { $err != "" } {
untested "Couldn't compile ${srcfile}"
return -1
}
--- ./gdb/testsuite/gdb.fortran/library-module.exp 2009-12-15 05:13:56.000000000 +0100
+++ ./gdb/testsuite/gdb.fortran/library-module.exp 2009-12-15 05:22:37.000000000 +0100
@@ -25,16 +25,34 @@ if [get_compiler_info not-used] {
return -1
}
-if { [gdb_compile_shlib "${srcdir}/${subdir}/${srclibfile}" $objdir/$subdir/$libfile {debug f77}] != "" } {
- untested "Couldn't compile ${srclibfile}"
- return -1
+# Temporarily provide f77compiler=gfortran44 saving the original value around.
+
+set board [target_info name]
+if [board_info $board exists f77compiler] {
+ set old_f77compiler [board_info $board f77compiler]
+ unset_board_info f77compiler
+} elseif [info exists old_f77compiler] {
+ unset old_f77compiler
}
+set_board_info f77compiler gfortran44
# prepare_for_testing cannot be used as linking with $libfile cannot be passed
# just for the linking phase (and not the source compilation phase). And any
# warnings on ignored $libfile abort the process.
-if { [gdb_compile [list $srcdir/$subdir/$srcfile $objdir/$subdir/$libfile] $objdir/$subdir/$binfile executable {debug f77}] != "" } {
+set err1 [gdb_compile_shlib "${srcdir}/${subdir}/${srclibfile}" $objdir/$subdir/$libfile {debug f77}]
+set err2 [gdb_compile [list $srcdir/$subdir/$srcfile $objdir/$subdir/$libfile] $objdir/$subdir/$binfile executable {debug f77}]
+
+unset_board_info f77compiler
+if [info exists old_f77compiler] {
+ set_board_info f77compiler $old_f77compiler
+}
+
+if { $err1 != "" } {
+ untested "Couldn't compile ${srclibfile}"
+ return -1
+}
+if { $err2 != "" } {
untested "Couldn't compile ${srcfile}"
return -1
}
--- ./gdb/testsuite/gdb.fortran/module.exp 2009-12-15 05:13:56.000000000 +0100
+++ ./gdb/testsuite/gdb.fortran/module.exp 2009-12-15 05:28:49.000000000 +0100
@@ -16,7 +16,25 @@
set testfile "module"
set srcfile ${testfile}.f90
-if { [prepare_for_testing $testfile.exp $testfile $srcfile {debug f77}] } {
+# Temporarily provide f77compiler=gfortran44 saving the original value around.
+
+set board [target_info name]
+if [board_info $board exists f77compiler] {
+ set old_f77compiler [board_info $board f77compiler]
+ unset_board_info f77compiler
+} elseif [info exists old_f77compiler] {
+ unset old_f77compiler
+}
+set_board_info f77compiler gfortran44
+
+set err [prepare_for_testing $testfile.exp $testfile $srcfile {debug f77}]
+
+unset_board_info f77compiler
+if [info exists old_f77compiler] {
+ set_board_info f77compiler $old_f77compiler
+}
+
+if $err {
return -1
}
--- ./gdb/testsuite/gdb.fortran/string.exp 2009-12-15 05:13:56.000000000 +0100
+++ ./gdb/testsuite/gdb.fortran/string.exp 2009-12-15 05:18:13.000000000 +0100
@@ -23,7 +23,25 @@ set testfile "string"
set srcfile ${testfile}.f90
set binfile ${objdir}/${subdir}/${testfile}
-if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug f77 quiet}] != "" } {
+# Temporarily provide f77compiler=gfortran44 saving the original value around.
+
+set board [target_info name]
+if [board_info $board exists f77compiler] {
+ set old_f77compiler [board_info $board f77compiler]
+ unset_board_info f77compiler
+} elseif [info exists old_f77compiler] {
+ unset old_f77compiler
+}
+set_board_info f77compiler gfortran44
+
+set err [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug f77 quiet}]
+
+unset_board_info f77compiler
+if [info exists old_f77compiler] {
+ set_board_info f77compiler $old_f77compiler
+}
+
+if { $err != "" } {
untested "Couldn't compile ${srcfile}"
return -1
}
--- gdb-7.0/gdb/testsuite/gdb.fortran/omp-step.exp-orig 2009-12-20 09:47:04.000000000 +0100
+++ gdb-7.0/gdb/testsuite/gdb.fortran/omp-step.exp 2009-12-20 09:50:06.000000000 +0100
@@ -15,7 +15,26 @@
set testfile "omp-step"
set srcfile ${testfile}.f90
-if { [prepare_for_testing $testfile.exp $testfile $srcfile {debug f77 additional_flags=-fopenmp}] } {
+
+# Temporarily provide f77compiler=gfortran44 saving the original value around.
+
+set board [target_info name]
+if [board_info $board exists f77compiler] {
+ set old_f77compiler [board_info $board f77compiler]
+ unset_board_info f77compiler
+} elseif [info exists old_f77compiler] {
+ unset old_f77compiler
+}
+set_board_info f77compiler gfortran44
+
+set err [prepare_for_testing ${testfile}.exp ${testfile} ${srcfile} {debug f77 additional_flags=-fopenmp}]
+
+unset_board_info f77compiler
+if [info exists old_f77compiler] {
+ set_board_info f77compiler $old_f77compiler
+}
+
+if $err {
return -1
}
--- ./gdb/testsuite/gdb.fortran/derived-type.exp 2009-01-07 13:39:13.000000000 +0100
+++ ./gdb/testsuite/gdb.fortran/derived-type.exp 2009-12-20 12:37:12.000000000 +0100
@@ -26,7 +26,25 @@ set testfile "derived-type"
set srcfile ${testfile}.f90
set binfile ${objdir}/${subdir}/${testfile}
-if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug f77 quiet}] != "" } {
+# Temporarily provide f77compiler=gfortran44 saving the original value around.
+
+set board [target_info name]
+if [board_info $board exists f77compiler] {
+ set old_f77compiler [board_info $board f77compiler]
+ unset_board_info f77compiler
+} elseif [info exists old_f77compiler] {
+ unset old_f77compiler
+}
+set_board_info f77compiler gfortran44
+
+set err [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug f77 quiet}]
+
+unset_board_info f77compiler
+if [info exists old_f77compiler] {
+ set_board_info f77compiler $old_f77compiler
+}
+
+if { $err != "" } {
untested "Couldn't compile ${srcfile}"
return -1
}
--- ./gdb/testsuite/gdb.fortran/subarray.exp 2009-01-07 13:39:13.000000000 +0100
+++ ./gdb/testsuite/gdb.fortran/subarray.exp 2009-12-20 12:38:00.000000000 +0100
@@ -26,7 +26,25 @@ set testfile "subarray"
set srcfile ${testfile}.f
set binfile ${objdir}/${subdir}/${testfile}
-if { [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug f77 quiet}] != "" } {
+# Temporarily provide f77compiler=gfortran44 saving the original value around.
+
+set board [target_info name]
+if [board_info $board exists f77compiler] {
+ set old_f77compiler [board_info $board f77compiler]
+ unset_board_info f77compiler
+} elseif [info exists old_f77compiler] {
+ unset old_f77compiler
+}
+set_board_info f77compiler gfortran44
+
+set err [gdb_compile "${srcdir}/${subdir}/${srcfile}" "${binfile}" executable {debug f77 quiet}]
+
+unset_board_info f77compiler
+if [info exists old_f77compiler] {
+ set_board_info f77compiler $old_f77compiler
+}
+
+if { $err != "" } {
untested "Couldn't compile ${srcfile}"
return -1
}
--- ./gdb/testsuite/gdb.threads/tls-sepdebug.exp 2009-12-20 12:22:18.000000000 +0100
+++ ./gdb/testsuite/gdb.threads/tls-sepdebug.exp 2009-12-20 12:39:53.000000000 +0100
@@ -32,7 +32,25 @@ set binshareddebugfile ${objdir}/${subdi
# FIXME: gcc dependency (-Wl,-soname).
-if { [gdb_compile_shlib "${srcdir}/${subdir}/${srcsharedfile}" "${binsharedfile}" [list debug additional_flags=-Wl,-soname=${binsharedbase}]] != "" } {
+# Temporarily provide compiler=gcc44 saving the original value around.
+
+set board [target_info name]
+if [board_info $board exists compiler] {
+ set old_compiler [board_info $board compiler]
+ unset_board_info compiler
+} elseif [info exists old_compiler] {
+ unset old_compiler
+}
+set_board_info compiler gcc44
+
+set err [gdb_compile_shlib "${srcdir}/${subdir}/${srcsharedfile}" "${binsharedfile}" [list debug additional_flags=-Wl,-soname=${binsharedbase}]]
+
+unset_board_info compiler
+if [info exists old_compiler] {
+ set_board_info compiler $old_compiler
+}
+
+if { $err != "" } {
untested "Couldn't compile test library"
return -1
}
++++++ gdb-stabs-read_args.patch ++++++
http://sourceware.org/ml/gdb-patches/2010-01/msg00142.html
Subject: [patch] Fix crash reading broken stabs
Hi,
seen this stabs from unknown variant of gcc-4.1.2:
1176586 LSYM 0 154 00000000 16682076 basic_string::_Rep:Tt(0,34)=s12!1,020,(0,35)=xs_Rep_base:;_S_max_size:/2(0,36)=k(0,30):_ZNSs4_Rep11_S_max_sizeE;_S_terminal:/2(0,22):_ZNSs4_Rep11_S_terminalE;_S_empty_rep_storage:/2(0,37)=ar(0,38)=r(0,38);0;037777777777;;0;3;(0,30):_ZNSs4_Rep20_S_empty_rep_storageE;_S_empty_rep::(0,39)=f(0,40)=&(0,34):_ZNSs4_Rep12_S_empty_repEv;2A?;_M_is_leaked::(0,41)=#(0,34),(0,42)=@s8;-16;,(0,43)=*(0,44)=k(0,34),(0,1);:_ZNKSs4_Rep12_M_is_leakedEv;2B.;_M_is_shared::(0,41):_ZNKSs4_Rep12_M_is_sharedEv;2B.;_M_set_leaked::(0,45)=#(0,34),(0,1),(0,33),(0,1);:_ZNSs4_Rep13_M_set_leakedEv;2A.;_M_set_sharable::(0,45):_ZNSs4_Rep15_M_set_sharableEv;2A.;_M_set_length_and_sharable::(0,46)=#(0,34),(0,1),(0,33),(0,25),(0,1);:_ZNSs4_Rep26_M_set_length_and_sharableEj;2A.;_M_refdata::(0,47)=#(0,34),(0,3),(0,33),(0,1);:_ZNSs4_Rep10_M_refdataEv;2A.;_M_grab::(0,48)=#(0,34),(0,3),(0,33),(0,5),(0,5),(0,1);:_ZNSs4_Rep7_M_grabERKSaIcES2_;2A.;_S_create::(0,49)=f(0,33):_ZNSs4_Rep9_S_createEjjRKSaIcE;2A?;_M_dispose::(0,50)=#(0,34),(0,1),(0,33),(0,5),(0,1);:_ZNSs4_Rep10_M_disposeERKSaIcE;2A.;_M_destroy::(0,51)=#(0,34),(0,1),(0,33),(0,5),(0,1);:_ZNSs4_Rep10_M_destroyERKSaIcE;2A.;_M_refcopy::(0,47):_ZNSs4_Rep10_M_refcopyEv;2A.;_M_clone::(0,52)=#(0,34),(0,3),(0,33),(0,5),(0,25),(0,1);:_ZNSs4_Rep8_M_cloneERKSaIcEj;2A.;;
There is a GDB crash at:
_M_is_leaked::(0,41)=#(0,34),(0,42)=@s8;-16;,(0,43)=*(0,44)=k(0,34),(0,1);
^^
+ [...] Some broken stabs
+ output contained `(0,41),(0,42)=@s8;-16;,(0,43),(0,1);' where should
+ have been present ";-16,(0,43)" reference instead. This way the
+ excessive ";" marker prematurely stops the parameters parsing. */
Still I was unable to reproduce producing such STABS output.
So this patch does not try to compensate the - presumably - buggy STABS output
and parses such record incorrectly. But it no longer crashes.
No regressions on {x86_64-m32,i686}-fedora12-linux-gnu
using --target_board unix/-gstabs+/-m32.
Thanks,
Jan
gdb/
2010-01-07 Jan Kratochvil
* stabsread.c (read_args): Handle zero arguments.
gdb/testsuite/
2010-01-07 Jan Kratochvil
* gdb.stabs/weird.def (args93): New.
--- a/gdb/stabsread.c
+++ b/gdb/stabsread.c
@@ -4111,7 +4111,17 @@ read_args (char **pp, int end, struct objfile *objfile, int *nargsp,
}
(*pp)++; /* get past `end' (the ':' character) */
- if (TYPE_CODE (types[n - 1]) != TYPE_CODE_VOID)
+ if (n == 0)
+ {
+ /* We should read at least the THIS parameter here. Some broken stabs
+ output contained `(0,41),(0,42)=@s8;-16;,(0,43),(0,1);' where should
+ have been present ";-16,(0,43)" reference instead. This way the
+ excessive ";" marker prematurely stops the parameters parsing. */
+
+ complaint (&symfile_complaints, _("Invalid (empty) method arguments"));
+ *varargsp = 0;
+ }
+ else if (TYPE_CODE (types[n - 1]) != TYPE_CODE_VOID)
*varargsp = 1;
else
{
--- a/gdb/testsuite/gdb.stabs/weird.def
+++ b/gdb/testsuite/gdb.stabs/weird.def
@@ -880,3 +880,6 @@ var3:
.stabs "sym92:\ !#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[]^_`abcdefghijklmnopqrstuvwxyz{|}~",N_LSYM,0,0,0
.stabs "type92:t92=\ !#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[]^_`abcdefghijklmnopqrstuvwxyz{|}~",N_LSYM,0,0,0
.stabs "attr92:G392=@\ !#$%&'()*+,-./0123456789:<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[]^_`abcdefghijklmnopqrstuvwxyz{|}~;1",N_GSYM,0,0, 0
+
+# See read_args "Invalid (empty) method arguments" error.
+.stabs "args93:G93=#(0,93),(0,93)=@s8;-16;,(0,93),(0,93);",N_GSYM,0,0,0
++++++ gdb-stale-related_breakpoint.patch ++++++
http://sourceware.org/ml/gdb-patches/2009-12/msg00364.html
Subject: [patch] related_breakpoint stale ref crash fix
Hi,
getting occasional random:
PASS: gdb.threads/local-watch-wrong-thread.exp: local watchpoint still triggers
PASS: gdb.threads/local-watch-wrong-thread.exp: let thread_function0 return
PASS: gdb.threads/local-watch-wrong-thread.exp: breakpoint on thread_function0's caller
-PASS: gdb.threads/local-watch-wrong-thread.exp: local watchpoint automatically deleted
+ERROR: Process no longer exists
+UNRESOLVED: gdb.threads/local-watch-wrong-thread.exp: local watchpoint automatically deleted
It is even reproducible on HEAD using "input" file below and:
valgrind ../gdb -nx type == bp_none)
return;
[...]
bpt->type = bp_none;
xfree (bpt);
}
While fixing this part may be difficult I find the attached patch easy enough
fixing the IMO currently most common crash due to it.
No regressions on {x86_64,x86_64-m32,i686}-fedora12-linux-gnu.
Thanks,
Jan
"input":
set height 0
set width 0
set confirm no
file ../testsuite/gdb.threads/local-watch-wrong-thread
set can-use-hw-watchpoints 1
break main
run
break local-watch-wrong-thread.c:36
continue
delete breakpoints
watch *myp
continue
delete breakpoints
echo MAKE watch\n
watch *myp if trigger != 0
echo MAKE break\n
break local-watch-wrong-thread.c:60
info break
continue
echo DELETE five\n
delete 5
set trigger=1
continue
set *myp=0
break local-watch-wrong-thread.c:47
continue
2009-12-23 Jan Kratochvil
* breakpoint.c (delete_breakpoint <bpt->related_breakpoint != NULL>):
New.
--- a/gdb/breakpoint.c
+++ b/gdb/breakpoint.c
@@ -8649,6 +8649,16 @@ delete_breakpoint (struct breakpoint *bpt)
if (bpt->type == bp_none)
return;
+ /* At least avoid this stale reference until the reference counting of
+ breakpoints gets resolved. */
+ if (bpt->related_breakpoint != NULL)
+ {
+ gdb_assert (bpt->related_breakpoint->related_breakpoint == bpt);
+ bpt->related_breakpoint->disposition = disp_del_at_next_stop;
+ bpt->related_breakpoint->related_breakpoint = NULL;
+ bpt->related_breakpoint = NULL;
+ }
+
observer_notify_breakpoint_deleted (bpt->number);
if (breakpoint_chain == bpt)
++++++ gdb-stale-sectindex.patch ++++++
http://sourceware.org/ml/gdb-patches/2010-02/msg00477.html
Subject: Re: [patch] Fix crash on stale addrinfo->sectindex
On Fri, 19 Feb 2010 04:01:05 +0100, Tom Tromey wrote:
Oh, by the way, I think this is reasonable for 7.1. It is
straightforward and fixes a reported crash. If Joel agrees, please put
it on the branch. Thanks.
OK for the branch?
Thanks,
Jan
http://sourceware.org/ml/gdb-cvs/2010-02/msg00162.html
### src/gdb/ChangeLog 2010/02/19 00:35:53 1.11380
### src/gdb/ChangeLog 2010/02/19 06:19:44 1.11381
## -1,3 +1,10 @@
+2010-02-19 Jan Kratochvil
+
+ * symfile.c (addr_info_make_relative): Extend comment. Move SECT to
+ a more inner block. Initialize ADDR by LOWER_OFFSET only if it was
+ found by bfd_get_section_by_name.
+ * symfile.h (struct section_addr_info) <sectindex>: New comment.
+
2010-02-19 Joel Brobecker
* NEWS: Add new "[...] since 7.1" section. Rename the "[...] since
--- src/gdb/symfile.c 2010/02/18 19:17:00 1.272
+++ src/gdb/symfile.c 2010/02/19 06:19:45 1.273
@@ -562,13 +562,13 @@
}
/* Relativize absolute addresses in ADDRS into offsets based on ABFD. Fill-in
- also SECTINDEXes there. */
+ also SECTINDEXes specific to ABFD there. This function can be used to
+ rebase ADDRS to start referencing different BFD than before. */
void
addr_info_make_relative (struct section_addr_info *addrs, bfd *abfd)
{
asection *lower_sect;
- asection *sect;
CORE_ADDR lower_offset;
int i;
@@ -597,25 +597,29 @@
for (i = 0; i < addrs->num_sections && addrs->other[i].name; i++)
{
- if (addrs->other[i].addr != 0)
+ asection *sect = bfd_get_section_by_name (abfd, addrs->other[i].name);
+
+ if (sect)
{
- sect = bfd_get_section_by_name (abfd, addrs->other[i].name);
- if (sect)
+ /* This is the index used by BFD. */
+ addrs->other[i].sectindex = sect->index;
+
+ if (addrs->other[i].addr != 0)
{
addrs->other[i].addr -= bfd_section_vma (abfd, sect);
lower_offset = addrs->other[i].addr;
- /* This is the index used by BFD. */
- addrs->other[i].sectindex = sect->index;
}
else
- {
- warning (_("section %s not found in %s"), addrs->other[i].name,
- bfd_get_filename (abfd));
- addrs->other[i].addr = 0;
- }
+ addrs->other[i].addr = lower_offset;
}
else
- addrs->other[i].addr = lower_offset;
+ {
+ warning (_("section %s not found in %s"), addrs->other[i].name,
+ bfd_get_filename (abfd));
+ addrs->other[i].addr = 0;
+
+ /* SECTINDEX is invalid if ADDR is zero. */
+ }
}
}
--- src/gdb/symfile.h 2010/02/03 14:13:16 1.64
+++ src/gdb/symfile.h 2010/02/19 06:19:45 1.65
@@ -80,6 +80,8 @@
{
CORE_ADDR addr;
char *name;
+
+ /* SECTINDEX must be valid for associated BFD if ADDR is not zero. */
int sectindex;
} other[1];
};
++++++ gdb-test-interrupt.exp-timeout.patch ++++++
commit 03729380c318738d19256b219bcc03d333dc54bf
Author: Daniel Jacobowitz
Date: Mon Feb 1 17:51:18 2010 +0000
[...]
* gdb.base/interrupt.exp: Match unexpected gdb prompt.
--- a/gdb/testsuite/gdb.base/interrupt.exp
+++ b/gdb/testsuite/gdb.base/interrupt.exp
@@ -167,6 +167,7 @@ if ![file exists $binfile] then {
# here.
gdb_expect {
-re "^(\r\n|)data\r\n(|data\r\n)$" { pass "echo data" }
+ -re "Undefined command.*$gdb_prompt " { fail "echo data" }
timeout { fail "echo data (timeout)" }
eof { fail "echo data (eof)" }
}
++++++ gdb-testsuite-unknown-output.patch ++++++
http://sourceware.org/ml/gdb-patches/2009-12/msg00473.html
Subject: [patch] testsuite: false MI "unknown output after running" regression
Hi,
the attached patch will turn the results this way:
-KFAIL: gdb.mi/mi-until.exp: until after while loop (unknown output after running) (PRMS: gdb/2104)
+KFAIL: gdb.mi/mi-until.exp: until after while loop (stopped at wrong place) (PRMS: gdb/2104)
-XFAIL: gdb.mi/mi-watch.exp: sw: watchpoint trigger (unknown output after running)
+XFAIL: gdb.mi/mi-watch.exp: sw: watchpoint trigger (stopped at wrong place)
-KFAIL: gdb.mi/mi2-until.exp: until after while loop (unknown output after running) (PRMS: gdb/2104)
+KFAIL: gdb.mi/mi2-until.exp: until after while loop (stopped at wrong place) (PRMS: gdb/2104)
-XFAIL: gdb.mi/mi2-watch.exp: sw: watchpoint trigger (unknown output after running)
+XFAIL: gdb.mi/mi2-watch.exp: sw: watchpoint trigger (stopped at wrong place)
This is a fix of KFAIL-kind regression due to:
commit 26d086d741fb1bb0eee9d50e0bafa7c5e388023f
Re: [RFA] fix *stopped for CLI commands
http://sourceware.org/ml/gdb-patches/2009-02/msg00278.htmlhttp://sourceware.org/ml/gdb-cvs/2009-02/msg00084.html
part:
gdb/testsuite/
2009-02-14 Vladimir Prus
* lib/mi-support.exp (mi_expect_stop): Adjust the order of fields.
(mi_expect_interrupt): Likewise.
* gdb.mi/mi-cli.exp: Check that "step" results in proper *stopped
response.
re-wdiff-ed for your convenience as:
verbose -log "mi_expect_stop: expecting: \\*stopped,${r}${a}${bn}[-thread-id=\"$decimal\",stopped-threads=$any,-]frame=\{addr=\"$hex\",func=\"$func\",args=$args,file=\"$any$file\",fullname=\"${fullname_syntax}$file\",line=\"$line\"\}$after_stopped{+,thread-id=\"$decimal\",stopped-threads=$any+}\r\n($thread_selected_re)?$prompt_re"
-re "\\*stopped,${r}${a}${bn}[-thread-id=\"$decimal\",stopped-threads=$any,-]frame=\{addr=\"$hex\",func=\"$func\",args=$args,file=\"$any$file\",fullname=\"${fullname_syntax}$file\",line=\"($line)\"\}$after_stopped{+,thread-id=\"$decimal\",stopped-threads=$any+}\r\n($thread_selected_re)?$prompt_re" {
-re "\\*stopped,${r}${a}${bn}[-thread-id=\"$decimal\",stopped-threads=$any,-]frame=\{addr=\"$hex\",func=\"$any\",args=\[\\\[\{\]$any\[\\\]\}\],file=\"$any\",fullname=\"${fullname_syntax}$any\",line=\"\[0-9\]*\"\}[-$any-]{+thread-id=\"$decimal\",stopped-threads=$any+}\r\n$prompt_re" {
FYI there is: set any "\[^\n\]*"
"stopped at wrong place" is the right kind of KFAIL/XFAIL (tested
gcc-4.1.2-46.el5_4.1.x86_64 and gcc-4.4.2-20.fc12.x86_64) as discussed
in PR gdb/2104.
In the last case there is missing comma (,) after the former patch above.
$after_stopped was IMO missing there even before. It is in use only by
gdb.mi/mi-simplerun.exp and gdb.mi/mi2-simplerun.exp. Also fixed below.
No regressions on {x86_64,x86_64-m32,i686}-fedora12-linux-gnu.
Thanks,
Jan
gdb/testsuite/
2009-12-31 Jan Kratochvil
* lib/mi-support.exp (mi_expect_stop <stopped at wrong place>): Insert
missing $after_stopped and comma (,) expectation.
--- a/gdb/testsuite/lib/mi-support.exp
+++ b/gdb/testsuite/lib/mi-support.exp
@@ -1038,7 +1038,7 @@ proc mi_expect_stop { reason func args file line extra test } {
pass "$test"
return $expect_out(2,string)
}
- -re "\\*stopped,${r}${a}${bn}frame=\{addr=\"$hex\",func=\"$any\",args=\[\\\[\{\]$any\[\\\]\}\],file=\"$any\",fullname=\"${fullname_syntax}$any\",line=\"\[0-9\]*\"\}thread-id=\"$decimal\",stopped-threads=$any\r\n$prompt_re" {
+ -re "\\*stopped,${r}${a}${bn}frame=\{addr=\"$hex\",func=\"$any\",args=\[\\\[\{\]$any\[\\\]\}\],file=\"$any\",fullname=\"${fullname_syntax}$any\",line=\"\[0-9\]*\"\}$after_stopped,thread-id=\"$decimal\",stopped-threads=$any\r\n$prompt_re" {
verbose -log "got $expect_out(buffer)"
fail "$test (stopped at wrong place)"
return -1
++++++ gdb-watchpoint-cond-gone.patch ++++++
http://sourceware.org/ml/gdb-patches/2009-12/msg00394.html
Subject: [patch] Fix watchpoint-at-epilogue 7.0 regression (s390x)
Hi,
attached testcase regressed 6.8->7.0 on some s390x systems.
At the moment PC is at epilogue (after frame pointer got destroyed and PC is
still in the calleed function) we must not try any unwinding as it can try to
unwind a garbage.
Correct way would be to implement epilogue unwinder (such as
amd64_epilogue_frame_unwind or i386_epilogue_frame_unwind ones) but it would
not be so easy on s390x as it would need full prologue-analyzer: After SP gets
restored there can be various instructions before the last jump - GDB needs to
interpret the jump to find the register value where it is going to jump to.
00000048279aa09c :
[...]
48279aa1b8: eb 6f f0 d0 00 04 lmg %r6,%r15,208(%r15)
48279aa1be: 50 32 10 00 st %r3,0(%r2,%r1) # SP (%r15) is gone hone
48279aa1c2: b3 74 00 00 lzer %r0
48279aa1c6: 07 f4 br %r4 # %r4 is the target
[...]
Just an easy fix is to be more careful and do not try any unwinding if we find
PC is in the epilogue (previous instruction modifies SP=%r15).
It is even a performance optimization and I see no regression risk there.
The specific s390x error is:
#0 throw_error (error=MEMORY_ERROR, fmt=0x8042676a "Cannot access memory at address %s") at exceptions.c:415
#1 in memory_error (status=5, memaddr=0) at corefile.c:220
#2 in read_memory (memaddr=0, myaddr=0x3ffffc7f7f0 "", len=8) at corefile.c:238
#3 in read_memory_unsigned_integer (memaddr=0, len=8, byte_order=BFD_ENDIAN_BIG) at corefile.c:321
#4 in s390_backchain_frame_unwind_cache (this_frame=0x80608958, info=0x80608a08) at s390-tdep.c:1525
#5 in s390_frame_unwind_cache (this_frame=0x80608958, this_prologue_cache=0x80608970) at s390-tdep.c:1572
#6 in s390_frame_this_id (this_frame=0x80608958, this_prologue_cache=0x80608970, this_id=0x806089b8) at s390-tdep.c:1583
#7 in get_frame_id (fi=0x80608958) at frame.c:335
#8 in frame_find_by_id (id={stack_addr = 4398044824952, code_addr = 2147484952, special_addr = 0, stack_addr_p = 1, code_addr_p = 1, special_addr_p = 0, inline_depth = 0}) at frame.c:587
#9 in watchpoint_check (p=0x8095bbc0) at breakpoint.c:3203
#10 in catch_errors (func=0x801262c0 , func_args=0x8095bbc0, errstring=0x80a26410 "Error evaluating expression for watchpoint 3\n", mask=6) at exceptions.c:510
#11 in bpstat_check_watchpoint (bs=0x8095bbc0) at breakpoint.c:3404
#12 in bpstat_stop_status (aspace=0x8061fcb0, bp_addr=2147485040, ptid={pid = 17372, lwp = 17372, tid = 0}) at breakpoint.c:3594
#13 in handle_inferior_event (ecs=0x3ffffc80520) at infrun.c:3588
I did not analyze why 6.8 did not error out, the GDB code is similar there.
No regressions on:
{x86_64,x86_64-m32,i686}-fedora12-linux-gnu (CVS HEAD GDB)
s390x-rhel48-linux-gnu (CVS HEAD GDB)
s390-rhel48-linux-gnu (CVS HEAD GDB)
s390x-rhel54-linux-gnu (Fedora 12 GDB)
s390-rhel54-linux-gnu (Fedora 12 GDB)
Thanks,
Jan
gdb/
2009-12-25 Jan Kratochvil
* breakpoint.c (watchpoint_check): Check the call
gdbarch_in_function_epilogue_p before calling frame_find_by_id.
Extend the comment.
gdb/testsuite/
2009-12-25 Jan Kratochvil
* gdb.base/watchpoint-cond-gone.exp, gdb.base/watchpoint-cond-gone.c,
gdb.base/watchpoint-cond-gone-stripped.c: New.
--- a/gdb/breakpoint.c
+++ b/gdb/breakpoint.c
@@ -3200,6 +3200,17 @@ watchpoint_check (void *p)
struct gdbarch *frame_arch = get_frame_arch (frame);
CORE_ADDR frame_pc = get_frame_pc (frame);
+ /* in_function_epilogue_p() returns a non-zero value if we're still
+ in the function but the stack frame has already been invalidated.
+ Since we can't rely on the values of local variables after the
+ stack has been destroyed, we are treating the watchpoint in that
+ state as `not changed' without further checking. Don't mark
+ watchpoints as changed if the current frame is in an epilogue -
+ even if they are in some other frame, our view of the stack
+ is likely to be wrong and frame_find_by_id could error out. */
+ if (gdbarch_in_function_epilogue_p (frame_arch, frame_pc))
+ return WP_VALUE_NOT_CHANGED;
+
fr = frame_find_by_id (b->watchpoint_frame);
within_current_scope = (fr != NULL);
@@ -3216,17 +3227,6 @@ watchpoint_check (void *p)
within_current_scope = 0;
}
- /* in_function_epilogue_p() returns a non-zero value if we're still
- in the function but the stack frame has already been invalidated.
- Since we can't rely on the values of local variables after the
- stack has been destroyed, we are treating the watchpoint in that
- state as `not changed' without further checking. Don't mark
- watchpoints as changed if the current frame is in an epilogue -
- even if they are in some other frame, our view of the stack
- is likely to be wrong. */
- if (gdbarch_in_function_epilogue_p (frame_arch, frame_pc))
- return WP_VALUE_NOT_CHANGED;
-
if (within_current_scope)
/* If we end up stopping, the current frame will get selected
in normal_stop. So this call to select_frame won't affect
--- /dev/null
+++ b/gdb/testsuite/gdb.base/watchpoint-cond-gone-stripped.c
@@ -0,0 +1,23 @@
+/* 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 2 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, write to the Free Software
+ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
+
+void
+jumper (void (*jumpto) (void))
+{
+ (*jumpto) ();
+}
--- /dev/null
+++ b/gdb/testsuite/gdb.base/watchpoint-cond-gone.c
@@ -0,0 +1,37 @@
+/* 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 2 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, write to the Free Software
+ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
+
+extern void jumper (void (*jumpto) (void));
+
+static void
+func (void)
+{
+ volatile int c;
+
+ c = 5;
+ c = 10; /* watchpoint-here */
+ c = 20;
+}
+
+int
+main (void)
+{
+ jumper (func);
+
+ return 0;
+}
--- /dev/null
+++ b/gdb/testsuite/gdb.base/watchpoint-cond-gone.exp
@@ -0,0 +1,51 @@
+# 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 2 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, write to the Free Software
+# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+
+set testfile "watchpoint-cond-gone"
+set srcfile ${testfile}.c
+set srcfilestripped ${testfile}-stripped.c
+set objfilestripped ${objdir}/${subdir}/${testfile}-stripped.o
+set binfile ${objdir}/${subdir}/${testfile}
+
+# We need to generate a function without DWARF to crash older GDB.
+# Stepping into a dynamic function trampoline or stepping out of MAIN may work
+# but it is not a reliable FAIL case.
+
+if { [gdb_compile "${srcdir}/${subdir}/${srcfilestripped}" "${objfilestripped}" object {}] != ""
+ || [gdb_compile "${srcdir}/${subdir}/${srcfile} ${objfilestripped}" "${binfile}" executable {debug}] != "" } {
+ gdb_suppress_entire_file "Testcase compile failed, so all tests in this file will automatically fail."
+}
+
+clean_restart ${testfile}
+
+# Problem does not occur otherwise.
+gdb_test "set can-use-hw-watchpoints 0"
+
+if ![runto_main] {
+ return -1
+}
+
+gdb_breakpoint [gdb_get_line_number "watchpoint-here"]
+gdb_continue_to_breakpoint "Place to set the watchpoint"
+
+# The condition `c == 30' is the subject being tested.
+gdb_test "watch c if c == 30" "" "Place the watchpoint"
+
+# We may stay either in the function itself or only at the first instruction of
+# its caller depending on the epilogue unwinder (or valid epilogue CFI) presence.
+gdb_test "finish" \
+ "Watchpoint .* deleted because the program has left the block in.*which its expression is valid..*in (jumper|func).*" \
+ "Catch the no longer valid watchpoint"
++++++ gdb-x86_64-i386-syscall-restart.patch ++++++
http://sourceware.org/ml/gdb-patches/2009-11/msg00592.html
Subject: [patch] Fix syscall restarts for amd64->i386 biarch
Hi,
tested only on recent Linux kernels, it should apply also on vanilla ones.
There were various changes of the kernels behavior in the past.
FSF GDB HEAD state:
kernel debugger inferior state
x86_64 x86_64 x86_64 PASS
x86_64 x86_64 i386 FAIL without this patch, PASS with this patch
x86_64 i386 i386 PASS on recent kernels
(FAIL: kernel-2.6.31.5-127.fc12.x86_64 - Fedora 12)
(PASS: kernel-2.6.32-0.55.rc8.git1.fc13.x86_64)
i386 i386 i386 PASS
Currently gdb.base/interrupt.exp fails on amd64 host running under
--target_board unix/-m32 with:
continue
Continuing.
Unknown error 512
:
/*
* These should never be seen by user programs. To return one of ERESTART*
* codes, signal_pending() MUST be set. Note that ptrace can observe these
* at syscall exit tracing, but they will never be left for the debugged user
* process to see.
*/
#define ERESTARTSYS 512
"Unknown error 512" printed above is printed by the inferior itself, not by GDB.
It is because GDB reads it as 0xfffffffffffffe00 but writes it back as
0xfffffe00.
+ /* Sign-extend %eax as during return from a syscall it is being checked
+ for -ERESTART* values -512 being above 0xfffffffffffffe00; tested by
+ interrupt.exp. */
Quote of Roland McGrath from IRC:
roland: in the user_regset model, there are 64-bit user_regset flavors and
32-bit user_regset flavors, so at the kabi level the (kernel) caller can say
what it means: calls on the 32-bit user_regset flavor will behave as if on
a 32-bit kernel/userland. in ptrace, there is no way for x86_64 ptrace calls
to say "i think of the inferior as being 32 bits, so act accordingly" (tho ppc
and/or sparc have ptr
roland: ace requests that do that iirc)
roland: ergo 64-bit ptrace callers must either save/restore full 64-bits so
the kernel's sign-extension choices are preserved, or else grok magic ways to
expand stored 32-bit register contents to 64-bit values to stuff via 64-bit
ptrace
[...]
roland: there is a "32-bit-flavored task", but it's not really true that it
has 32-bit registers. there is no 32-bit-only userland condition. any task
can always ljmp to the 64-bit code segment and run 64-bit insns including
a 64-bit syscall
roland: so a 64-bit debugger should see and be able to fiddle the full
registers. it can even change cs via ptrace to force the inferior into
running 32 or 64 bit code.
Saving whole 64bits for i386 targets on x86_64 hosts does not much match the
GDB architecture as `struct type' for these registers still should be 32bit
etc. Therefore provided just this exception.
The problem is reproducible only if one does an inferior call during the
interruption to do full inferior save/restore from GDB regcache.
Regression tested on {x86_64,x86_64-m32,i686}-fedora12-linux-gnu.
Thanks,
Jan
gdb/
2009-11-29 Jan Kratochvil
* amd64-nat.c (amd64_collect_native_gregset): Do not pre-clear %eax.
Sign extend it afterwards.
--- a/gdb/amd64-nat.c
+++ b/gdb/amd64-nat.c
@@ -131,9 +131,9 @@ amd64_collect_native_gregset (const struct regcache *regcache,
{
num_regs = amd64_native_gregset32_num_regs;
- /* Make sure %eax, %ebx, %ecx, %edx, %esi, %edi, %ebp, %esp and
+ /* Make sure %ebx, %ecx, %edx, %esi, %edi, %ebp, %esp and
%eip get zero-extended to 64 bits. */
- for (i = 0; i <= I386_EIP_REGNUM; i++)
+ for (i = I386_ECX_REGNUM; i <= I386_EIP_REGNUM; i++)
{
if (regnum == -1 || regnum == i)
memset (regs + amd64_native_gregset_reg_offset (gdbarch, i), 0, 8);
@@ -159,4 +159,20 @@ amd64_collect_native_gregset (const struct regcache *regcache,
regcache_raw_collect (regcache, i, regs + offset);
}
}
+
+ if (gdbarch_ptr_bit (gdbarch) == 32)
+ {
+ /* Sign-extend %eax as during return from a syscall it is being checked
+ for -ERESTART* values -512 being above 0xfffffffffffffe00; tested by
+ interrupt.exp. */
+
+ int i = I386_EAX_REGNUM;
+
+ if (regnum == -1 || regnum == i)
+ {
+ void *ptr = regs + amd64_native_gregset_reg_offset (gdbarch, i);
+
+ *(int64_t *) ptr = *(int32_t *) ptr;
+ }
+ }
}
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Remember to have fun...
--
To unsubscribe, e-mail: opensuse-commit+unsubscribe@opensuse.org
For additional commands, e-mail: opensuse-commit+help@opensuse.org