From: Jan Kratochvil <jan.kratochvil@redhat.com>
To: Tom Tromey <tromey@redhat.com>
Cc: gdb-patches@sourceware.org
Subject: Re: RFA: implement "watch -location"
Date: Fri, 13 Aug 2010 21:21:00 -0000 [thread overview]
Message-ID: <20100813212120.GA20999@host1.dyn.jankratochvil.net> (raw)
In-Reply-To: <m31va2z7xx.fsf@fleche.redhat.com>
On Fri, 13 Aug 2010 20:25:14 +0200, Tom Tromey wrote:
> Jan> this patch has a regression (guessing due to -lmcheck) on
>
> The bug was that watch_maybe_just_location did not check for arg==NULL.
> So, a plain "watch" crashed gdb.
There is still a crash:
(gdb) watch -location gdb_stdin
== Invalid read of size 4
== at 0x6420E3: can_use_hardware_watchpoint (breakpoint.c:8295)
== by 0x641AE2: watch_command_1 (breakpoint.c:8140)
== by 0x642342: watch_maybe_just_location (breakpoint.c:8376)
== by 0x64236C: watch_command (breakpoint.c:8382)
== by 0x5F0B04: do_cfunc (cli-decode.c:67)
== by 0x5F3B72: cmd_func (cli-decode.c:1771)
== by 0x48A9ED: execute_command (top.c:422)
== Address 0xcee60a0 is 0 bytes inside a block of size 144 free'd
== at 0x4C25D72: free (vg_replace_malloc.c:325)
== by 0x48E6D3: xfree (utils.c:1505)
== by 0x6554CD: value_free (value.c:687)
== by 0x655503: value_free_to_mark (value.c:701)
== by 0x641950: watch_command_1 (breakpoint.c:8101)
== by 0x642342: watch_maybe_just_location (breakpoint.c:8376)
== by 0x64236C: watch_command (breakpoint.c:8382)
== by 0x5F0B04: do_cfunc (cli-decode.c:67)
== by 0x5F3B72: cmd_func (cli-decode.c:1771)
== by 0x48A9ED: execute_command (top.c:422)
The problem is:
release_value (val);
value_free_to_mark (mark);
should also have some:
val->next = NULL;
as later
mem_cnt = can_use_hardware_watchpoint (val);
will otherwise jump into the stale value_next pointer.
Just it cannot be implemented this way due to:
breakpoint.c:8101:10: error: dereferencing pointer to incomplete type
While trying to fix it one could simplify the code as since
cc7cc38174cfc79e75ea92a00b48591f90c83ea5
http://sourceware.org/ml/gdb-cvs/2009-11/msg00184.html
the result of can_use_hardware_watchpoint() mostly gets immediately dropped as
it all gets recalculated in update_watchpoint again. Still
bp_read_watchpoint/bp_access_watchpoint are not checked in update_watchpoint
so one cannot just drop the can_use_hardware_watchpoint call from
watch_command_1.
Thanks,
Jan
next prev parent reply other threads:[~2010-08-13 21:21 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-08-11 22:04 Tom Tromey
2010-08-11 22:11 ` Michael Snyder
2010-08-11 22:15 ` Tom Tromey
2010-08-12 2:45 ` Hui Zhu
2010-08-12 7:55 ` André Pönitz
2010-08-12 3:07 ` Eli Zaretskii
2010-08-12 8:17 ` Phil Muldoon
2010-08-13 16:39 ` Jan Kratochvil
2010-08-13 18:27 ` Tom Tromey
2010-08-16 19:54 ` Jan Kratochvil
2010-08-13 18:25 ` Tom Tromey
2010-08-13 19:19 ` Eli Zaretskii
2010-08-13 21:21 ` Jan Kratochvil [this message]
2010-08-13 21:24 ` Tom Tromey
2010-08-16 18:13 ` Tom Tromey
2010-08-16 18:43 ` 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=20100813212120.GA20999@host1.dyn.jankratochvil.net \
--to=jan.kratochvil@redhat.com \
--cc=gdb-patches@sourceware.org \
--cc=tromey@redhat.com \
/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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).