From: Jan Kratochvil <jan.kratochvil@redhat.com>
To: gdb-patches@sourceware.org
Subject: [patch] Fix segfault on a failed watchpoint update
Date: Sun, 02 Mar 2008 08:41:00 -0000 [thread overview]
Message-ID: <20080302084050.GA22521@host0.dyn.jankratochvil.net> (raw)
[-- Attachment #1: Type: text/plain, Size: 3222 bytes --]
Hi,
currently GDB HEAD segfaults during one case for the PIE inferiors (failing as
it is the unpatched CVS HEAD), segfault fix attached.
Regards,
Jan
crash reproducibility:
$ runtest --target_board=unix/-fPIE/-pie gdb.base/watchpoint.exp
WARNING: Couldn't find the global config file.
Test Run By jkratoch on Sun Mar 2 09:31:14 2008
Native configuration is x86_64-unknown-linux-gnu
=== gdb tests ===
Schedule of variations:
unix/-fPIE/-pie
Running target unix/-fPIE/-pie
Using /usr/share/dejagnu/baseboards/unix.exp as board description file for target.
Using /usr/share/dejagnu/config/unix.exp as generic interface file for target.
Using ../.././gdb/testsuite/config/unix.exp as tool-and-target-specific interface file.
Running ../.././gdb/testsuite/gdb.base/watchpoint.exp ...
FAIL: gdb.base/watchpoint.exp: run to marker1 in test_simple_watchpoint
ERROR: Process no longer exists
ERROR: Couldn't send disable 3 to GDB.
ERROR: Delete all breakpoints in delete_breakpoints (timeout)
ERROR: Delete all breakpoints in delete_breakpoints (timeout)
FAIL: gdb.base/watchpoint.exp: watch tests suppressed
FAIL: gdb.base/watchpoint.exp: (timeout) disable fast watches
FAIL: gdb.base/watchpoint.exp: (timeout) show disable fast watches
FAIL: gdb.base/watchpoint.exp: (timeout) set slow conditional watch
FAIL: gdb.base/watchpoint.exp: (timeout) trigger slow conditional watch
FAIL: gdb.base/watchpoint.exp: (timeout) rwatch disallowed when can-use-hw-watchpoints cleared
ERROR: Delete all breakpoints in delete_breakpoints (timeout)
=== gdb Summary ===
# of expected passes 7
# of unexpected failures 7
# of unresolved testcases 5
.../sources/gdb/testsuite/../../gdb/gdb version 6.8.50.20080302-cvs -nx
...
(gdb) PASS: gdb.base/watchpoint.exp: disable watchpoint in test_simple_watchpoint
run
Starting program: /home/jkratoch/redhat/sources/gdb/testsuite/gdb.base/watchpoint
Error in re-setting breakpoint 1: Cannot access memory at address 0x86c
Error in re-setting breakpoint 2: Cannot access memory at address 0x872
Error in re-setting breakpoint 3: Cannot access memory at address 0x20127c
Error in re-setting breakpoint 1: Cannot access memory at address 0x86c
Error in re-setting breakpoint 2: Cannot access memory at address 0x872
Error in re-setting breakpoint 3: Cannot access memory at address 0x20127c
Error in re-setting breakpoint 1: Cannot access memory at address 0x86c
Error in re-setting breakpoint 2: Cannot access memory at address 0x872
Error in re-setting breakpoint 3: Cannot access memory at address 0x20127c
Program exited normally.
(gdb) FAIL: gdb.base/watchpoint.exp: run to marker1 in test_simple_watchpoint
info watch
*** glibc detected *** /home/jkratoch/redhat/sources/gdb/testsuite/../../gdb/gdb: double free or corruption (!prev): 0x00000000023f9d20 ***
======= Backtrace: =========
/lib64/libc.so.6[0x3b98672832]
/lib64/libc.so.6(cfree+0x8c)[0x3b98675f2c]
/home/jkratoch/redhat/sources/gdb/testsuite/../../gdb/gdb(xfree+0x1c)[0x44efb6]
/home/jkratoch/redhat/sources/gdb/testsuite/../../gdb/gdb(free_all_values+0x2a)[0x4cd65a]
/home/jkratoch/redhat/sources/gdb/testsuite/../../gdb/gdb(execute_command+0x26)[0x44b9df]
...
[-- Attachment #2: gdb-value-update_watchpoint-exception.patch --]
[-- Type: text/plain, Size: 1045 bytes --]
2008-03-02 Jan Kratochvil <jan.kratochvil@redhat.com>
* breakpoint.c (update_watchpoint): Move B->VAL setting behind the
VALUE_CONTENTS call.
--- ./gdb/breakpoint.c 27 Feb 2008 20:27:49 -0000 1.304
+++ ./gdb/breakpoint.c 2 Mar 2008 08:27:20 -0000
@@ -913,13 +917,15 @@ update_watchpoint (struct breakpoint *b,
during evaluation, and set watchoints at addresses as needed.
Those values are explicitly deleted here. */
v = evaluate_expression (b->exp);
+ /* Fetch the value first as if ti fails and breaks out by the exception
+ there will be no stale V left in B->VAL. */
+ value_contents (v);
/* Avoid setting b->val if it's already set. The meaning of
b->val is 'the last value' user saw, and we should update
it only if we reported that last value to user. As it
happens, the code that reports it updates b->val directly. */
if (b->val == NULL)
b->val = v;
- value_contents (v);
value_release_to_mark (mark);
/* Look at each value on the value chain. */
next reply other threads:[~2008-03-02 8:41 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-03-02 8:41 Jan Kratochvil [this message]
2008-03-02 15:09 ` Daniel Jacobowitz
2008-03-02 15:17 ` Jan Kratochvil
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20080302084050.GA22521@host0.dyn.jankratochvil.net \
--to=jan.kratochvil@redhat.com \
--cc=gdb-patches@sourceware.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox