From: Jan Kratochvil <jan.kratochvil@redhat.com>
To: Michael Snyder <msnyder@vmware.com>
Cc: "gdb-patches@sourceware.org" <gdb-patches@sourceware.org>
Subject: Re: [RFA] mdebugread.c (psymtab_to_symtab_1): assert that 'fh' is not null
Date: Sun, 06 Mar 2011 16:17:00 -0000 [thread overview]
Message-ID: <20110306142337.GB1895@host1.jankratochvil.net> (raw)
In-Reply-To: <4D71648B.1090101@vmware.com>
On Fri, 04 Mar 2011 23:15:39 +0100, Michael Snyder wrote:
> This occurs along a path where fh *could* be null, and then we
> dereference it.
I agree there is a bug.
> + gdb_assert (fh);
[...]
> parse_external (ext_ptr, fh->fBigendian,
> pst->section_offsets, pst->objfile);
But I find as even a worse bug to introduce such an assertion without any
comment there.
I at least myself perceive any assertions that the programmer thinks such
invariant is valid there. That invariant says that if its negation happens
then the programmer was wrong.
If there is a known bug you have found and you just do not intend to fix it
now I find introducing such an assertion as misleading. The reader then
assumes such invariant and can do additional wrong conclusions from it.
In such case there should be primarily a "FIXME" comment, best even to
reference a filed a Bug. There can be also an assertion there but the "FIXME"
I find essential there.
Thanks,
Jan
next prev parent reply other threads:[~2011-03-06 14:23 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-03-04 22:15 Michael Snyder
2011-03-06 16:17 ` Jan Kratochvil [this message]
2011-03-06 18:54 ` Michael Snyder
2011-03-06 19:05 ` Jan Kratochvil
2011-03-07 16:53 ` Tom Tromey
2011-03-07 17:21 ` 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=20110306142337.GB1895@host1.jankratochvil.net \
--to=jan.kratochvil@redhat.com \
--cc=gdb-patches@sourceware.org \
--cc=msnyder@vmware.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