- Temporary rpm-4.5.90 compatibility workaround by Panu Matilainen.

- Fix a regression in the constant watchpoints fix, found by Daniel
    Jacobowitz.
- Fix the prelink testcase for false FAILs on i386.
This commit is contained in:
Jan Kratochvil 2008-07-12 07:02:33 +00:00
parent 5ca2edcb43
commit 535451a6ad
5 changed files with 249 additions and 69 deletions

View File

@ -36,6 +36,10 @@
Disable the warnings for the testsuite not expecting them.
2008-10-12 Jan Kratochvil <jan.kratochvil@redhat.com>
rpm compatibility patch by Panu Matilainen.
Index: gdb-6.8/gdb/Makefile.in
===================================================================
--- gdb-6.8.orig/gdb/Makefile.in 2008-04-19 20:48:13.000000000 +0200
@ -787,7 +791,7 @@ Index: gdb-6.8/gdb/symfile.c
if (retval != NULL && !build_id_verify (retval, build_id))
{
@@ -1314,9 +1714,433 @@ build_id_to_debug_filename (struct build
@@ -1314,9 +1714,432 @@ build_id_to_debug_filename (struct build
retval = NULL;
}
@ -799,7 +803,6 @@ Index: gdb-6.8/gdb/symfile.c
return retval;
}
+#include <rpm/rpmmessages.h>
+#include <rpm/rpmlib.h>
+#include <rpm/rpmts.h>
+#include <rpm/rpmdb.h>

View File

@ -1,23 +1,17 @@
https://bugzilla.redhat.com/bugzilla/show_bug.cgi?id=225783
2007-10-16 Jan Kratochvil <jan.kratochvil@redhat.com>
Port to GDB-6.7.
Index: gdb-6.7/gdb/testsuite/gdb.base/prelink.exp
===================================================================
--- gdb-6.7.orig/gdb/testsuite/gdb.base/prelink.exp 2007-08-23 20:14:17.000000000 +0200
+++ gdb-6.7/gdb/testsuite/gdb.base/prelink.exp 2007-10-16 16:16:51.000000000 +0200
@@ -47,7 +47,7 @@ if { [gdb_compile "${srcdir}/${subdir}/$
return -1
}
-if {[catch "system \"prelink -qNR ${libfile}\""] != 0} {
+if {[catch "system \"/usr/sbin/prelink -qNR ${libfile}\""] != 0} {
--- gdb-6.8/gdb/testsuite/gdb.base/prelink.exp.orig 2008-07-12 08:56:43.000000000 +0200
+++ gdb-6.8/gdb/testsuite/gdb.base/prelink.exp 2008-07-12 08:59:59.000000000 +0200
@@ -55,7 +55,7 @@ if { [gdb_compile "${srcdir}/${subdir}/$
# single new unprelinked library address without wasting the first one/two
# memory areas. We do not care of the efficiency of loading such resulting
# exec-shield unfriendly prelinked library.
-if {[catch "system \"prelink -qNR --no-exec-shield ${libfile}\""] != 0} {
+if {[catch "system \"/usr/sbin/prelink -qNR --no-exec-shield ${libfile}\""] != 0} {
# Maybe we don't have prelink.
return -1
}
@@ -88,11 +88,11 @@ if { $found == 0 } {
@@ -96,11 +96,11 @@ if { $found == 0 } {
return 0
}
@ -26,8 +20,8 @@ Index: gdb-6.7/gdb/testsuite/gdb.base/prelink.exp
untested "${testfile}.so was not prelinked, maybe system libraries are not prelinked?"
return 0
}
-catch "system \"prelink -qNR ${libfile}\""
+catch "system \"/usr/sbin/prelink -qNR ${libfile}\""
-catch "system \"prelink -qNR --no-exec-shield ${libfile}\""
+catch "system \"/usr/sbin/prelink -qNR --no-exec-shield ${libfile}\""
# Start with a fresh gdb

View File

@ -1,46 +1,67 @@
2008-06-09 Jan Kratochvil <jan.kratochvil@redhat.com>
2008-07-10 Jan Kratochvil <jan.kratochvil@redhat.com>
* breakpoint.c (watch_command_1): New variable VAL_RESULT. Fill in
VAL_RESULT by the existing FETCH_WATCHPOINT_VALUE call. Refuse
constant VAL_RESULT list watchpoints.
* breakpoint.c (fetch_watchpoint_value): New comment on unreachable
values.
(watch_command_1): New variable VAL_CHAIN. Refuse constant watchpoints.
* gdbtypes.h (TYPE_CODE_FUNC): New comment regarding pointers to it.
2008-06-09 Jan Kratochvil <jan.kratochvil@redhat.com>
2008-07-10 Jan Kratochvil <jan.kratochvil@redhat.com>
* gdb.texinfo (Set Watchpoints): Document constant value watchpoints.
2008-06-09 Jan Kratochvil <jan.kratochvil@redhat.com>
2008-07-10 Jan Kratochvil <jan.kratochvil@redhat.com>
* gdb.base/watchpoint.exp: New test for constant value watchpoints.
* gdb.base/watchpoint.exp: Call TEST_CONSTANT_WATCHPOINT.
(test_constant_watchpoint): New function.
(test_inaccessible_watchpoint): Cleanup (delete) the watchpoint.
Test also a double-indirection watchpoint.
gdb.base/watchpoint.c (global_ptr_ptr): New variable.
(func4): New testing code for GLOBAL_PTR_PTR.
[ Ported for Fedora GDB. ]
--- ./gdb/breakpoint.c 6 Jun 2008 20:58:08 -0000 1.324
+++ ./gdb/breakpoint.c 9 Jun 2008 06:00:53 -0000
@@ -5818,7 +5818,7 @@ watch_command_1 (char *arg, int accessfl
--- ./gdb/breakpoint.c 8 Jul 2008 11:09:40 -0000 1.330
+++ ./gdb/breakpoint.c 10 Jul 2008 08:19:07 -0000
@@ -824,7 +824,15 @@ is_hardware_watchpoint (struct breakpoin
If VAL_CHAIN is non-NULL, *VAL_CHAIN will be released from the
value chain. The caller must free the values individually. If
VAL_CHAIN is NULL, all generated values will be left on the value
- chain. */
+ chain.
+
+ Inferior unreachable values return:
+ Inferior `int *intp = NULL;' with `watch *intp':
+ *VALP is NULL, *RESULTP contains lazy LVAL_MEMORY address 0, *VAL_CHAIN
+ contains the *RESULTP element and also INTP as LVAL_MEMORY.
+ Inferior `int **intpp = NULL;' with `watch **intpp':
+ *VALP is NULL, *RESULTP is NULL, *VAL_CHAIN contains lazy LVAL_MEMORY
+ address 0 and also INTPP as LVAL_MEMORY. */
static void
fetch_watchpoint_value (struct expression *exp, struct value **valp,
@@ -5832,7 +5840,7 @@ watch_command_1 (char *arg, int accessfl
struct symtab_and_line sal;
struct expression *exp;
struct block *exp_valid_block;
- struct value *val, *mark;
+ struct value *val, *mark, *val_result;
+ struct value *val, *mark, *val_chain;
struct frame_info *frame;
struct frame_info *prev_frame = NULL;
char *exp_start = NULL;
@@ -5903,7 +5903,27 @@ watch_command_1 (char *arg, int accessfl
exp_end = arg;
@@ -5918,6 +5926,27 @@ watch_command_1 (char *arg, int accessfl
exp_valid_block = innermost_block;
mark = value_mark ();
- fetch_watchpoint_value (exp, &val, NULL, NULL);
+ fetch_watchpoint_value (exp, &val, &val_result, NULL);
fetch_watchpoint_value (exp, &val, NULL, NULL);
+
+ /* VAL may be unset for unreachable final values. */
+ while (val_result != NULL)
+ {
+ if (VALUE_LVAL (val_result) == lval_memory
+ || VALUE_LVAL (val_result) == lval_register)
+ break;
+ val_result = value_next (val_result);
+ }
+ if (val_result == NULL)
+ /* VALUE_MARK gets us the same value as FETCH_WATCHPOINT_VALUE's VAL_CHAIN
+ parameter. Just this way we do not have to VALUE_FREE the chained VALUEs
+ ourselves. */
+ for (val_chain = value_mark ();
+ val_chain != mark;
+ val_chain = value_next (val_chain))
+ if ((VALUE_LVAL (val_chain) == lval_memory
+ && TYPE_CODE (value_type (val_chain)) != TYPE_CODE_FUNC)
+ || VALUE_LVAL (val_chain) == lval_register)
+ break;
+ if (val_chain == mark)
+ {
+ int len;
+
@ -49,20 +70,46 @@
+ len--;
+ error (_("Cannot watch constant value %.*s."), len, exp_start);
+ }
+
+ /* Break the VAL_RESULT values chain only after its check above. */
+ /* Break the values chain only after its check above. */
if (val != NULL)
release_value (val);
--- ./gdb/doc/gdb.texinfo 6 Jun 2008 20:58:08 -0000 1.503
+++ ./gdb/doc/gdb.texinfo 9 Jun 2008 06:01:37 -0000
@@ -3375,6 +3375,17 @@ This command prints a list of watchpoint
--- ./gdb/gdbtypes.h 3 May 2008 22:20:13 -0000 1.87
+++ ./gdb/gdbtypes.h 10 Jul 2008 08:19:08 -0000
@@ -69,7 +69,22 @@ enum type_code
TYPE_CODE_UNION, /* C union or Pascal variant part */
TYPE_CODE_ENUM, /* Enumeration type */
TYPE_CODE_FLAGS, /* Bit flags type */
- TYPE_CODE_FUNC, /* Function type */
+
+ /* Function type. It is not a pointer to a function. Function reference
+ by its name (such as `printf') has this type. C automatically converts
+ this function type to a pointer to function for any operation except
+ `sizeof (function_type)' or `&function_type' (unary &).
+ `sizeof (function_type)' is undefined in C. But GCC provides extension
+ (info '(gcc)Pointer Arith') defining its size as 1 byte. DWARF does not
+ define its size but GDB defines the size the GCC compatible way - GDB
+ function MAKE_FUNCTION_TYPE. The address itself is not modifiable.
+ As the function type has size 1 but its real value has `sizeof
+ (CORE_ADDR)' we cannot use NOT_LVAL category because the address would
+ not fit in the VALUE_CONTENTS_RAW container of its VALUE. We use
+ LVAL_MEMORY (and its VALUE_ADDRESS field) for it but we must be careful
+ it is not lvalue, it is the only non-modifiable LVAL_MEMORY. */
+ TYPE_CODE_FUNC,
+
TYPE_CODE_INT, /* Integer type */
/* Floating type. This is *NOT* a complex type. Beware, there are parts
--- ./gdb/doc/gdb.texinfo 7 Jul 2008 12:05:30 -0000 1.506
+++ ./gdb/doc/gdb.texinfo 10 Jul 2008 08:19:37 -0000
@@ -3375,6 +3375,18 @@ This command prints a list of watchpoint
it is the same as @code{info break} (@pxref{Set Breaks}).
@end table
+If you watch for a change in a numerically entered address you need to
+dereference it as the address itself is just a constant number which will never
+change. @value{GDBN} refuses to create a never invokable watchpoint:
+change. @value{GDBN} refuses to create a watchpoint that watches
+a never-changing value:
+
+@smallexample
+(@value{GDBP}) watch 0x600850
@ -74,23 +121,106 @@
@value{GDBN} sets a @dfn{hardware watchpoint} if possible. Hardware
watchpoints execute very quickly, and the debugger reports a change in
value at the exact instruction where the change occurs. If @value{GDBN}
--- gdb-6.8/gdb/testsuite/gdb.base/watchpoint.exp.orig 2008-06-17 13:42:35.000000000 +0200
+++ gdb-6.8/gdb/testsuite/gdb.base/watchpoint.exp 2008-06-17 13:43:38.000000000 +0200
@@ -679,6 +679,17 @@ set prev_timeout $timeout
set timeout 600
verbose "Timeout now 600 sec.\n"
--- ./gdb/testsuite/gdb.base/watchpoint.c 3 Mar 2008 13:24:12 -0000 1.3
+++ ./gdb/testsuite/gdb.base/watchpoint.c 10 Jul 2008 08:19:39 -0000
@@ -40,6 +40,7 @@ struct foo struct1, struct2, *ptr1, *ptr
int doread = 0;
+# Test constant-value watchpoints.
+gdb_test "watch 123" "Cannot watch constant value 123." "constant watchpoint"
+gdb_test "watch 456 if 1 == 2" "Cannot watch constant value 456." \
+ "constant watchpoint with a condition"
+# For unsupported constant-value watchpoints catching we need to reset the
+# breakpoints counter.
+gdb_exit
+gdb_start
+gdb_reinitialize_dir $srcdir/$subdir
+gdb_load $binfile
char *global_ptr;
+char **global_ptr_ptr;
void marker1 ()
{
@@ -118,6 +119,10 @@ func4 ()
buf[0] = 3;
global_ptr = buf;
buf[0] = 7;
+ buf[1] = 5;
+ global_ptr_ptr = &global_ptr;
+ buf[0] = 9;
+ global_ptr++;
}
int main ()
--- ./gdb/testsuite/gdb.base/watchpoint.exp 15 Apr 2008 14:33:54 -0000 1.18
+++ ./gdb/testsuite/gdb.base/watchpoint.exp 10 Jul 2008 08:19:41 -0000
@@ -644,7 +644,21 @@ proc test_watchpoint_and_breakpoint {} {
}
}
}
-
+
gdb_test "set debug solib 1"
if [initialize] then {
+proc test_constant_watchpoint {} {
+ global gdb_prompt
+
+ gdb_test "watch 5" "Cannot watch constant value 5." "number is constant"
+ gdb_test "watch marker1" "Cannot watch constant value marker1." \
+ "marker1 is constant"
+ gdb_test "watch count + 6" ".*atchpoint \[0-9\]+: count \\+ 6"
+ gdb_test "set \$expr_breakpoint_number = \$bpnum" ""
+ gdb_test "delete \$expr_breakpoint_number" ""
+ gdb_test "watch 7 + count" ".*atchpoint \[0-9\]+: 7 \\+ count"
+ gdb_test "set \$expr_breakpoint_number = \$bpnum" ""
+ gdb_test "delete \$expr_breakpoint_number" ""
+}
+
proc test_inaccessible_watchpoint {} {
global gdb_prompt
@@ -653,7 +667,8 @@ proc test_inaccessible_watchpoint {} {
if [runto func4] then {
gdb_test "watch *global_ptr" ".*atchpoint \[0-9\]+: \\*global_ptr"
- gdb_test "next" ".*global_ptr = buf.*"
+ gdb_test "set \$global_ptr_breakpoint_number = \$bpnum" ""
+ gdb_test "next" ".*global_ptr = buf.*" "global_ptr next"
gdb_test_multiple "next" "next over ptr init" {
-re ".*atchpoint \[0-9\]+: \\*global_ptr\r\n\r\nOld value = .*\r\nNew value = 3 .*\r\n.*$gdb_prompt $" {
# We can not test for <unknown> here because NULL may be readable.
@@ -666,6 +681,28 @@ proc test_inaccessible_watchpoint {} {
pass "next over buffer set"
}
}
+ gdb_test "delete \$global_ptr_breakpoint_number" ""
+ gdb_test "watch **global_ptr_ptr" ".*atchpoint \[0-9\]+: \\*\\*global_ptr_ptr"
+ gdb_test "set \$global_ptr_ptr_breakpoint_number = \$bpnum" ""
+ gdb_test "next" ".*global_ptr_ptr = &global_ptr.*" "gloabl_ptr_ptr next"
+ gdb_test_multiple "next" "next over global_ptr_ptr init" {
+ -re ".*atchpoint \[0-9\]+: \\*\\*global_ptr_ptr\r\n\r\nOld value = .*\r\nNew value = 7 .*\r\n.*$gdb_prompt $" {
+ # We can not test for <unknown> here because NULL may be readable.
+ # This test does rely on *NULL != 7.
+ pass "next over global_ptr_ptr init"
+ }
+ }
+ gdb_test_multiple "next" "next over global_ptr_ptr buffer set" {
+ -re ".*atchpoint \[0-9\]+: \\*\\*global_ptr_ptr\r\n\r\nOld value = 7 .*\r\nNew value = 9 .*\r\n.*$gdb_prompt $" {
+ pass "next over global_ptr_ptr buffer set"
+ }
+ }
+ gdb_test_multiple "next" "next over global_ptr_ptr pointer advance" {
+ -re ".*atchpoint \[0-9\]+: \\*\\*global_ptr_ptr\r\n\r\nOld value = 9 .*\r\nNew value = 5 .*\r\n.*$gdb_prompt $" {
+ pass "next over global_ptr_ptr pointer advance"
+ }
+ }
+ gdb_test "delete \$global_ptr_ptr_breakpoint_number" ""
}
}
@@ -833,6 +870,17 @@ if [initialize] then {
}
test_watchpoint_and_breakpoint
+
+ # See above.
+ if [istarget "mips-idt-*"] then {
+ gdb_exit
+ gdb_start
+ gdb_reinitialize_dir $srcdir/$subdir
+ gdb_load $binfile
+ initialize
+ }
+
+ test_constant_watchpoint
}
# Restore old timeout

View File

@ -931,3 +931,47 @@ revision 1.1
+gdb_test "print empty()" " = void"
+# We did segfault here.
+gdb_test "help help"
http://sourceware.org/ml/gdb-patches/2008-03/msg00356.html
http://sourceware.org/ml/gdb-cvs/2008-03/msg00130.html
2008-03-24 Jan Kratochvil <jan.kratochvil@redhat.com>
Fix random false FAILs on i386.
* gdb.base/prelink.exp: Use `--no-exec-shield' for prelink.
===================================================================
RCS file: /cvs/src/src/gdb/testsuite/gdb.base/prelink.exp,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -r1.7 -r1.8
--- src/gdb/testsuite/gdb.base/prelink.exp 2008/01/01 22:53:19 1.7
+++ src/gdb/testsuite/gdb.base/prelink.exp 2008/03/24 15:16:12 1.8
@@ -47,7 +47,15 @@
return -1
}
-if {[catch "system \"prelink -qNR ${libfile}\""] != 0} {
+# `--no-exec-shield' is for i386 where prelink in the exec-shield mode is
+# forced to push all the libraries tight together to fit into the first two
+# memory areas (either the ASCII Shield area or at least below the executable).
+# In this case its -R option cannot be applied and we falsely FAIL here as if
+# the system is already prelinked prelink has no choice how to randomize the
+# single new unprelinked library address without wasting the first one/two
+# memory areas. We do not care of the efficiency of loading such resulting
+# exec-shield unfriendly prelinked library.
+if {[catch "system \"prelink -qNR --no-exec-shield ${libfile}\""] != 0} {
# Maybe we don't have prelink.
return -1
}
@@ -92,7 +100,7 @@
untested "${testfile}.so was not prelinked, maybe system libraries are not prelinked?"
return 0
}
-catch "system \"prelink -qNR ${libfile}\""
+catch "system \"prelink -qNR --no-exec-shield ${libfile}\""
# Start with a fresh gdb

View File

@ -13,7 +13,7 @@ Version: 6.8
# The release always contains a leading reserved number, start it at 1.
# `upstream' is not a part of `name' to stay fully rpm dependencies compatible for the testing.
Release: 14%{?_with_upstream:.upstream}%{?dist}
Release: 15%{?_with_upstream:.upstream}%{?dist}
License: GPLv3+
Group: Development/Debuggers
@ -606,6 +606,10 @@ g77="`which gfortran 2>/dev/null || true`"
test -z "$g77" || ln -s "$g77" ./g77
export CFLAGS="$RPM_OPT_FLAGS"
# FIXME: Temporary rpm compatibility cludge, port: gdb-6.6-buildid-locate.patch
CFLAGS="$CFLAGS -D_RPM_4_4_COMPAT -Wno-deprecated-declarations"
%if 0%{?_with_debug:1}
# --enable-werror could conflict with `-Wall -O0' but this is no longer true
# for recent GCCs.
@ -828,6 +832,11 @@ fi
%endif
%changelog
* Sat Jul 12 2008 Jan Kratochvil <jan.kratochvil@redhat.com> - 6.8-15
- Temporary rpm-4.5.90 compatibility workaround by Panu Matilainen.
- Fix a regression in the constant watchpoints fix, found by Daniel Jacobowitz.
- Fix the prelink testcase for false FAILs on i386.
* Tue Jul 8 2008 Jan Kratochvil <jan.kratochvil@redhat.com> - 6.8-14
- Fix crash due to calling an inferior function right after a watchpoint stop.